OpenID SSO APIs help a developer to use the Single Sign On feature for an app submitted to the EMM.
Use OpenID SSO APIs only if you have selected the Only Sign option in the Signing Rule feature. When you select Only Sign, the Allow SSO feature is enabled in the EMM management console. You must select Yes for the Allow SSO feature for these APIs to work.
Important: You must import the sso_sdk.jar file into your Android project to use SSO APIs.
The storeCookie API stores a single cookie entry in the common storage for the given data.
int:com.kony.signonly.ssohelper.SSOHelper.storeCookie(java.util.Hashtable <java.lang.String,java.lang.Object> params);
Variable Name | params |
Presence | Mandatory |
Type | Hashtable |
Values (Keys in the Hashtable) |
name - The name of the cookie (java.lang.String type and mandatory). value - The value of the cookie (java.lang.String type and mandatory).domain - The domain against which the cookie is stored (java.lang.String type and mandatory). path - The path against which the cookie is stored. If the path key is missing or if the value is null, then the path is ignored (java.lang.String type and optional). context - The application context for the app (android.content.Context type and mandatory). Note: Use the getApplicationContext() API to get the application context. |
Int
Code | Description |
---|---|
200 | SUCCESS |
400 | FAILURE |
201 | NULL input |
202 | INSUFFICIENT number of arguments |
203 | Missing domain key |
204 | NULL or EMPTY domain |
205 | Missing name key |
206 | NULL or EMPTY name |
207 | Missing value key |
208 | NULL or EMPTY value |
209 | Missing context |
210 | Null context |
The getCookie API retrieves all cookies from the common storage (cookies that match the combination of given domain and path).
If the path provided is null or empty, then all cookies that match the given domain are retrieved from the common storage.
java.util.Hashtable:com.kony.signonly.ssohelper.SSOHelper.getCookie(java.util.Hashtable <java.lang.String,java.lang.Object> params)
Variable Name | params |
Presence | Mandatory |
Type | Hashtable |
Values (Keys in the Hashtable) |
domain - The domain for which you need to retrieve the cookies (java.lang.String type and mandatory). path - The path in which the cookie is stored. If the path key is missing or if the value is null, then the path is ignored (java.lang.String type and mandatory).context - The application context for the app (android.content.Context type and mandatory). Note: Use the getApplicationContext() API to get the application context. |
Hashtable
For success, a hashtable with resultcode and cke keys (cookies in the json format) are returned. For example,
{ "cookies":[{"secure":true,"path":"\/","domain":"appdirect.com","value":"yy","name":"AWSELB"} ,{"secure":true,"path":"\/","domain":"appdirect.com","value":"1","name":"__utmt_rollup"}]}
Code | Description |
---|---|
200 | SUCCESS |
400 | FAILURE |
201 | NULL input |
202 | INSUFFICIENT number of arguments |
203 | Missing domain key |
204 | NULL or EMPTY domain |
209 | Missing context |
210 | Null context |
The deleteCookie API deletes all cookies that match the combination of provided domain and path from the common storage.
If the path providded is null or empty, then all cookies that match the provided domain are deleted from the common storage.
int:com.kony.signonly.ssohelper.SSOHelper.deleteCookie(java.util.Hashtable <java.lang.String,java.lang.Object> params)
Variable Name | params |
Presence | Mandatory |
Type | Hashtable |
Values (Keys in a hashtable) |
domain - The domain for which you need to delete the cookies(java.lang.String type and mandatory) path - The path in which the cookie is stored. If the path key is missing or if the value is null, then the path is ignored (java.lang.String type and optional).context - The application context for the app (android.content.Context type and mandatory). Note: Use the getApplicationContext() API to get the application context. |
Int
This API returns the number of cookies deleted (if any cookies were stored) based on the combination given in the domain and the path values.
Code | Description |
---|---|
400 | FAILURE |
201 | NULL input |
202 | INSUFFICIENT number of arguments |
203 | Missing domain key |
204 | NULL or EMPTY domain |
209 | Missing context |
210 | Null context |
Important: You must import SSOHelper.h and libSSOHelper.a files into your XCode project to use SSO APIs.
Note: NSString and NSDictionary are part of the Foundation framework under the iOS SDK.
The storeCookie API stores a single cookie entry in the common storage for the given data.
You must declare a function before using this API.
Function Declaration: +(int) storeCookie:(NSDictionary *)params;
[SSOhelper storeCookie:params];
Important: Params in the signature above is the NSDictionary declared in the function earlier.
Variable Name | params |
Presence | Mandatory |
Type | NSDictionary |
Values |
name - The name of the cookie (NSString type and mandatory). value - The network usage is allowed (NSString type and mandatory).domain - The domain against which the cookie must be set (NSString type and mandatory). path - The path against which the cookie must be set (NSString type and optional). If the path key is missing or if the value is null, then the path is ignored. |
Int
Code | Description |
---|---|
200 | SUCCESS |
400 | FAILURE |
201 | NULL input |
202 | INSUFFICIENT number of arguments |
203 | Missing domain key |
204 | NULL or EMPTY domain |
205 | Missing name key |
206 | NULL or EMPTY name |
207 | Missing value key |
208 | NULL or EMPTY value |
The getCookie API retrieves all cookies from the common storage that match the combination of given domain and path.
If the path given is null or empty, then all cookies that match the provided domain are retrieved from the common storage.
You must declare a function before using this API.
Function Declaration: +(NSDictionary *) getCookie: (NSDictionary *) params;
[SSOHelper getCookie : params];
Important: Params in the signature above is the NSDictoriary declared in the function earlier.
Variable Name | params |
Presence | Mandatory |
Type | NSDictionary |
Values |
domain - The domain for which cookies need to be retrieved (NSString type and mandatory). path - The path in which the cookie is stored (NSString type and optional) . If the path key is missing or if the value is null, then the path is ignored. |
NSDictonary (with resultcode and cke keys)
Code | Description |
---|---|
200 |
SUCCESS For success, along with a result code a cke (cookies in the json format) key returns. For example, { “cookies”:[{<NSHTTPCookie version:0 name:\"ajs_group_id\" value:\"null\" expiresDate:2016-04-22 11:47:46 +0000 created:2015-04-23 11:47:46 +0000 (4.51482e+08) sessionOnly:FALSE domain:\".appdirect.com\" path:\"/\" isSecure:FALSE>}{<NSHTTPCookie version:0 name:\"_gauges_unique\" value:\"1\" expiresDate:2025-04-20 11:41:47 +0000 created:2015-04-23 11:41:47 +0000 (4.51482e+08) sessionOnly:FALSE domain:\"www.appdirect.com\" path:\"/\" isSecure:FALSE>}}} |
400 | FAILURE |
201 | NULL input |
202 | INSUFFICIENT number of arguments |
203 | Missing domain key |
204 | NULL or EMPTY domain |
211 | No cookies found that match the combination of the given domain and path. |
The deleteCookie API deletes all cookies that match the combination of given domain and path from the common storage.
If the path is given as null or empty then all cookies that match the given domain are deleted from the common storage.
You must declare a function before using this API.
Function Declaration: +(int)deleteCookie :(NSDictionary *)params;
[SSOHelper deleteCookie : params];
Important: Params in the signature above is the NSDictoriary declared in the function earlier.
Variable Name | params |
Presence | Mandatory |
Type | NSDictionary |
Values |
domain - The domain for which cookies need to be deleted (NSString and mandatory). path - The path in which the cookie is stored (NSString and optional). If the path key is missing or if the value is null, then the path is ignored. |
Int
If success, this API returns the number of cookies deleted (based on the combination given in domain and path values).
Code | Description |
---|---|
200 |
SUCCESS |
400 | FAILURE |
201 | NULL input |
202 | INSUFFICIENT number of arguments |
203 | Missing domain key |
204 | NULL or EMPTY domain |
Copyright © 2017 Kony, Inc. All rights reserved. |