Class adobeDPS-OAuthRedirectService
- Extends:
- adobeDPS-OAuthRedirectService -> adobeDPS-Service -> adobeDPS-Class
- Platforms:
- iOS, Windows
Service for handling OAuth2.0 authorization responses using HTTP redirection.
Accessible from adobeDPS.oauthRedirectService
Constructor
Static Fields
| Field | Defined By | |
|---|---|---|
|
adobeDPS-OAuthRedirectService.instance
The singleton of the OAuthRedirectService.
|
OAuthRedirectService
|
Fields
| Field | Defined By | |
|---|---|---|
|
clientId
: String
The client Id assigned to the connected app for the authorization host.
|
OAuthRedirectService
|
|
|
redirectURI
: String
The redirect URI used by the authorization server to send responses back to the application.
|
OAuthRedirectService
|
|
|
oauthData
: Object
The authorization data object associated with the authorization server (host) for the active session.
|
OAuthRedirectService
|
|
|
OAuthRedirectServiceErrorCodes
: Object
The supported error codes as an enum object
|
OAuthRedirectService
|
Methods
| Method | Defined By | |
|---|---|---|
|
initAuthData(authSettings:Object, successCB:Function, errorCB:Function)
Initialises the authorization session and retrieves the cached auth data from native keychain into the internal oauthData
|
OAuthRedirectService
|
|
|
startListening(responseCB:Function, successCB:Function, errorCB:Function)
Starts listening for authorization server response in preparation for an OAuth authorization request.
|
OAuthRedirectService
|
|
|
stopListening(successCB:Function, errorCB:Function)
Stops listening for authorization server response.
|
OAuthRedirectService
|
|
|
updateAuthData(authData:Object, successCB:Function, errorCB:Function)
Updates the cached authorization data for the current session (identified by clientId).
|
OAuthRedirectService
|
|
|
resetAuthData(successCB:Function, errorCB:Function)
Resets the cached authorization data for the current session (identified by clientId).
|
OAuthRedirectService
|
|
|
authorize(requestURI:String, useTitle:Boolean, persistCookies:Boolean, successCB:Function, errorCB:Function)
This is a Windows-specific API that replaces the function of the startListening() and
stopListening() APIs.
|
OAuthRedirectService
|
|
|
toString()
Gets the string representation of this instance.
|
This is an internal constructor and shouldn't be called by regular users.
- Platforms:
- iOS, Windows
- Platforms:
- iOS, Windows
- Platforms:
- iOS, Windows
- Platforms:
- iOS, Windows
- See:
- adobeDPS-OAuthRedirectServiceErrorCodes
- Platforms:
- iOS, Windows
| Parameters | ||
|---|---|---|
| authSettings | Object |
The authorization settings objects with the following format:
{ authURL: String, clientId: String, redirectURI: String} where:
|
| successCB | Function | The callback function that handles the success of the request. This function can use the oauthData property to access the tokens needed. It cannot be undefined or null. Signature: successCB() |
| errorCB | Function |
The error callback to handle the error codes below. It cannot be undefined or null. Signature: errorCB(error)
|
- Throws:
- Error If the errorCB is invalid
- Platforms:
- iOS, Windows
| Parameters | ||
|---|---|---|
| responseCB | Function | The callback function that handles the authorization server response object or a timeout message. This handler should be able to differentiate between success or error responses based on the object content according to OAuth spec. It cannot be undefined or null. Signature responseCB(data) |
| successCB | Function | The success callback indicating the request is successful and the viewer is ready for server data. It cannot be undefined or null. The user should use this function to send the authorization request to the server. Signature: successCB() |
| errorCB | Function |
The error callback to handle the error codes below. It cannot be undefined or null. Signature: errorCB(error)
|
- Throws:
- Error If the errorCB is invalid
- Platforms:
- iOS
| Parameters | ||
|---|---|---|
| successCB | Function | The success callback indicating the request is successful and the viewer is ready for server data. It cannot be undefined or null. Signature successCB() |
| errorCB | Function |
The error callback to handle the error codes below. It cannot be undefined or null. Signature: errorCB(error)
|
- Throws:
- Error If the errorCB is invalid
- Platforms:
- iOS
| Parameters | ||
|---|---|---|
| authData | Object | The new authorization data obtained from the token endpoint with refreshed access token and optionally a new refresh token. It cannot be undefined, null or empty. |
| successCB | Function | The callback function indicating the success of the request. The handler can use oauthData to access the new tokens. It cannot be undefined or null. Signature successCB() |
| errorCB | Function |
The error callback to handle the error codes below. It cannot be undefined or null. Signature: errorCB(error)
|
- Throws:
- Error If the errorCB is invalid
- Platforms:
- iOS, Windows
| Parameters | ||
|---|---|---|
| successCB | Function | The callback function that handles the success of the request. It cannot be undefined or null. Signature: successCB() |
| errorCB | Function |
The error callback to handle the error codes below. It cannot be undefined or null. Signature: errorCB(error)
|
- Throws:
- Error If the errorCB is invalid
- Platforms:
- iOS, Windows
authorize() creates an instance of Windows Web Authentication Broker. It is designed by Microsoft to provide support for authentication flows such as SSO (Single Sign-On) and variants that pass back tokens back in the window title string.
Windows Web Authentication Broker looks like a web view that is created on top of the calling application. It contains UI elements that allow the user to cancel the login process and return to the application. Once authentication is finished, the Windows Web Authentication Broker closes itself and returns the data that the server sent to the redirectURI back to the calling application.
authorize() handles internally the functions of startListening() and stopListening(). Once authorize() finishes, successCB() is called and then the authorization data can be retrieved from the oathData instance variable of OauthRedirectService. The JavaScript workflow otherwise stays the same. initAuthData(), resetAuthData() and updateAuthData() are still used on the Windows platform.
| Parameters | ||
|---|---|---|
| requestURI | String | The full URI to call the authorization host with. The URI should contain parameters required by the host such as redirect_uri, response_type and so forth. Please note that the redirectURI parameter given to initAuthData() is used for capturing the response from authorization host. |
| useTitle | Boolean | By default the OS authorization API expects that the authorization host returns authorization data in a query string sent to redirectURI. If the authorization host sends data in the window title string instead, set useTitle to true. |
| persistCookies | Boolean |
If set true, cookies received from authorization host are
preserved over app launches by the OS. This is commonly desired when SSO (single sign-on) is
used.
On Windows, resetAuthData() is unable to clear cookies. If persistCookies is set true, the user may be permanently signed in as long as the cookies are valid. If persistCookies is set true, the redirectURI parameter that is used when calling initAuthData() must be of the form ms-app://SID, where SID matches the SID of the Windows app. See Understanding and debugging the web authentication broker workflow for more documentation. |
| successCB | Function |
The callback function that handles the success of the request. It
cannot be undefined or null. After successCB() is called then the authorization data
from the host can be retrieved from the oauthData instance variable of the
OauthRedirectService object.
Signature: successCB() |
| errorCB | Function |
The error callback to handle the error codes below. It cannot be
undefined or null.
Signature: errorCB(error)
|
- Throws:
- Error If the errorCB is invalid
- Platforms:
- Windows
Documentation generated by JsDoc Toolkit 2.4.0 on Mon Aug 31 2015 09:23:27 GMT-0700 (PDT)