Class: FedAuthPropertiesBuilder

FedAuthPropertiesBuilder(appName, loginUrl, logoutUrl, loginSuccessUrl, loginFailureUrl)

This is the builder for federated authentication / web SSO. Using this builder to init an authentication flow will return RemoteAuthenticationFlow in the init promise.

In this type of authentication, while logging in, the plugin brings up a WebView and loads the login page provided in the configuration. User has credentials on this page. When login is successful, the WebView will be removed and user will be redirected back to the app. While showing the WebView, plugin provides basic operations such as "Forward", "Back", "Reload" and "Cancel" to deal with any issues the user faces on this page. For example, user may accidentally click a link on the login page. In this case, user can use "Back" button to come back to the login page. For example, if the login page is not loaded correctly, user may want to try reloading the page, before cancelling the login. If user cancels the login, the promise returned by AuthenticationFlow#login will be rejected. For iOS, WKWebView will be used by default.

While logging out, the plugin brings up a WebView and loads the logout page provided in the configuration. Typically this step does not have any user interaction. The logout page loads with a confirmation and then is dismissed. However, some federated authentication servers provide a logout confirmation screen where the user is expected to provide his consent for logout. This feature is introduced by certain federated auth servers as they wanted the user to be fully aware that they are logging out and does not do so accidentally. There are two ways to handle this situation. First by having the confirmation screen dismissed automatically, without user interaction. This can be achieved by setting FedAuthPropertiesBuilder#confirmLogoutAutomatically to true and providing FedAuthPropertiesBuilder#confirmLogoutButtonId if needed. The other way is to wait for user to provide his consent. This can be done by specifying FedAuthPropertiesBuilder#logoutSuccessUrl and FedAuthPropertiesBuilder#logoutFailureUrl. Note: Irrespective of whether user cancels the logout or accepts the logout in the confirmation screen, the user is logged out.

Constructor

new FedAuthPropertiesBuilder(appName, loginUrl, logoutUrl, loginSuccessUrl, loginFailureUrl)

Parameters:
Name Type Description
appName string

Application name

loginUrl string

Fed auth login end point.

logoutUrl string

Fed auth logout end point.

loginSuccessUrl string

End point to which server redirects after successful login.

loginFailureUrl string

End point to which server redirects after unsuccessful login.

Source:

Extends

Methods

appName(appName) → {RemoteAuthPropertiesBuilder}

Parameters:
Name Type Description
appName String

Application name

Inherited From:
Source:
Returns:
Type
RemoteAuthPropertiesBuilder

build() → {Object}

Overrides:
Source:
Returns:

validate and return properties collected.

Type
Object

confirmLogoutAutomatically(automatic) → {FedAuthPropertiesBuilder}

Parameters:
Name Type Description
automatic boolean

whether to confirm the logout automatically when presented with a logout confirmation screen from the server.

Source:
Returns:
Type
FedAuthPropertiesBuilder

confirmLogoutButtonId(buttonId) → {FedAuthPropertiesBuilder}

Parameters:
Name Type Description
buttonId string

DOM id of the logout confirmation button. Used when FedAuthPropertiesBuilder#confirmLogoutAutomatically is turned on.

Source:
Returns:
Type
FedAuthPropertiesBuilder

customAuthHeaders(headers) → {RemoteAuthPropertiesBuilder}

Parameters:
Name Type Description
headers Object.<string, string>

any custom headers. These are returned along with other authentication headers in RemoteAuthenticationFlow#getHeaders()

Inherited From:
Source:
Returns:
Type
RemoteAuthPropertiesBuilder

enableWkWebView(enable) → {FedAuthPropertiesBuilder}

Parameters:
Name Type Description
enable boolean

if WKWebView should be enabled. Applicable only for iOS. Note: App should install cordova-plugin-wkwebview-engine when using this.

Source:
Returns:
Type
FedAuthPropertiesBuilder

idleTimeOutInSeconds(timeout) → {RemoteAuthPropertiesBuilder}

Deprecated: This is not applicable for all remote authentications. Use method available in builder subclasses where applicable.

Parameters:
Name Type Description
timeout number

seconds after which which idle timeout should kick in when user is idle.

Inherited From:
Deprecated:
  • This is not applicable for all remote authentications. Use method available in builder subclasses where applicable.
Source:
Returns:
Type
RemoteAuthPropertiesBuilder

loginFailureUrl(url) → {FedAuthPropertiesBuilder}

Parameters:
Name Type Description
url string

End point to which server redirects after unsuccessful login.

Source:
Returns:
Type
FedAuthPropertiesBuilder

loginSuccessUrl(url) → {FedAuthPropertiesBuilder}

Parameters:
Name Type Description
url string

End point to which server redirects after successful login.

Source:
Returns:
Type
FedAuthPropertiesBuilder

loginUrl(url) → {FedAuthPropertiesBuilder}

Parameters:
Name Type Description
url string

Fed auth login end point.

Source:
Returns:
Type
FedAuthPropertiesBuilder

logoutFailureUrl(url) → {FedAuthPropertiesBuilder}

Parameters:
Name Type Description
url string

End point to which server redirects after unsuccessful logout. Used along with logout confirmation screen usecase.

Source:
Returns:
Type
FedAuthPropertiesBuilder

logoutSuccessUrl(url) → {FedAuthPropertiesBuilder}

Parameters:
Name Type Description
url string

End point to which server redirects after successful logout. Used along with logout confirmation screen usecase.

Source:
Returns:
Type
FedAuthPropertiesBuilder

logoutTimeOutInSeconds(timeout) → {RemoteAuthPropertiesBuilder}

Parameters:
Name Type Description
timeout number

specifiy timeout before which ongoing logout attempt will be aborted.

Inherited From:
Source:
Returns:
Type
RemoteAuthPropertiesBuilder

logoutUrl(url) → {FedAuthPropertiesBuilder}

Parameters:
Name Type Description
url string

Fed auth logout end point.

Source:
Returns:
Type
FedAuthPropertiesBuilder

parseTokenRelayResponse(allow) → {FedAuthPropertiesBuilder}

Parameters:
Name Type Description
allow boolean

if relay response token needs to be parsed. Used in case of SAML flows.

Source:
Returns:
Type
FedAuthPropertiesBuilder

percentageToIdleTimeout(percentage) → {RemoteAuthPropertiesBuilder}

Deprecated: This is not applicable for all remote authentications. Use method available in builder subclasses where applicable.

Parameters:
Name Type Description
percentage number

percentage of idle timeout before which timeout callback should be invoked.

Inherited From:
Deprecated:
  • This is not applicable for all remote authentications. Use method available in builder subclasses where applicable.
Source:
Returns:
Type
RemoteAuthPropertiesBuilder

put(key, value) → {Builder}

Convenience method to add key value pairs of auth settings to properties.

Parameters:
Name Type Description
key string

Authentication property key

value string

Authentication property value

Inherited From:
Source:
Returns:
Type
Builder

sessionActiveOnRestart(active) → {FedAuthPropertiesBuilder}

This does not work for normal FedAuth cases. This is applicable for SAML kind of cases where FedAuthPropertiesBuilder#parseTokenRelayResponse is turned on. In this context, this parameter can be used for turning on access token reuse over app restarts. With this turned on, when app is restarted, a user trying to login won't be prompted for credentials, if there is a valid JWT token.

Parameters:
Name Type Description
active boolean

Whether to preserve login across restarts.

Source:
Returns:
Type
FedAuthPropertiesBuilder

sessionTimeOutInSeconds(timeout) → {FedAuthPropertiesBuilder}

Parameters:
Name Type Description
timeout number

set to the same value as configured in the fed auth server. After these many seconds timeout callback will be invoked. Note: This does not trigger any session timeout on the server. That configuration is controlled by the server. The effect of setting this is only to remove cookies after such time when server session would have time out.

Overrides:
Source:
Returns:
Type
FedAuthPropertiesBuilder

timeoutCallback(callback) → {FedAuthPropertiesBuilder}

Parameters:
Name Type Description
callback RemoteAuthPropertiesBuilder~timeoutCallback

Callback to handle timeout notifications.

Source:
Returns:
Type
FedAuthPropertiesBuilder