com.ibm.security.access.mobile.authentication

Class MfaRegistrationContext

  • java.lang.Object
    • com.ibm.security.access.mobile.authentication.MfaRegistrationContext


  • public final class MfaRegistrationContext
    extends java.lang.Object
    Enables mobile applications to register a users device to IBM Security Access Manager. The registration process requires the mobile application to support QR code scanning.
    Since:
    1.2.0
    Version:
    1.2.8
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String createTenantIdentifier(android.content.Context context)
      Creates a new unique identifier for the tenant.
      void discover(java.lang.String endpointUrl, IMfaRegistrationResultCallback callback)
      Acquires the OAuth client identifier and endpoint for converting an authorization code into an access token.
      java.lang.String getDeviceToken(android.content.Context context)
      Returns the unique token to identify the device fo push notifications.
      javax.net.ssl.SSLContext getSslContext()
      Returns the SSLContext object.
      void setConnectionTimeOut(int connectionTimeOut)
      Sets the connection timeout to a specified timeout, in milliseconds.
      void setDeviceToken(android.content.Context context, java.lang.String deviceToken)
      Stores the device token for push notification into SharedPreferences.
      void setHostnameVerifier(javax.net.ssl.HostnameVerifier hostnameVerifier)
      Sets the HostnameVerifier to use self-signed or unknown certificates for HttpsURLConnection, hat the host name is an acceptable match with the server's authentication scheme.
      void setReadTimeOut(int readTimeOut)
      Sets the read timeout to a specified timeout, in milliseconds.
      void setSslContext(javax.net.ssl.SSLContext sslContext)
      Sets the SSLContext to use self-signed or unknown certificates for HttpsURLConnection.
      static MfaRegistrationContext sharedInstance()
      Returns an instance of a new MfaRegistrationContext object.
      void unregisterDevice(java.lang.String endpointUrl, OAuthToken token, java.lang.String authenticator_id, IUnregisterResultCallback callback)
      Unregister the device.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • createTenantIdentifier

        public java.lang.String createTenantIdentifier(android.content.Context context)
        Creates a new unique identifier for the tenant.
        Parameters:
        context - The context of the application.
        Returns:
        String Containing a formated UUID.
        Note:
        This methods saves the generated String to SharedPreferences with the RegistrationAttributes.TENANT_IDENTIFIER key.
      • getDeviceToken

        public java.lang.String getDeviceToken(android.content.Context context)
        Returns the unique token to identify the device fo push notifications.
        Parameters:
        context - the context of the application
        Returns:
        the unique token to identify the device or null if it can not be retrieved
      • setDeviceToken

        public void setDeviceToken(android.content.Context context,
                                   java.lang.String deviceToken)
        Stores the device token for push notification into SharedPreferences.
        Parameters:
        context - the context of the application
        deviceToken - the unique token to identify the device
      • discover

        public void discover(java.lang.String endpointUrl,
                             IMfaRegistrationResultCallback callback)
                      throws java.lang.IllegalArgumentException
        Acquires the OAuth client identifier and endpoint for converting an authorization code into an access token.
        Parameters:
        endpointUrl - the endpoint that gets the additional information for obtaining an access token
        callback - the function delegate that is invoked with a MfaRegistrationResult
        Throws:
        java.lang.IllegalArgumentException - if callback is null
        Since:
        1.2.0
      • unregisterDevice

        public void unregisterDevice(java.lang.String endpointUrl,
                                     OAuthToken token,
                                     java.lang.String authenticator_id,
                                     IUnregisterResultCallback callback)
                              throws java.lang.IllegalArgumentException
        Unregister the device.
        Parameters:
        endpointUrl - the endpoint to unregister the device
        token - the OAuthToken to consume with the request
        authenticator_id - the identifier of the device
        callback - the function delegate that is invoked with a MfaUnregisterDeviceResult
        Throws:
        java.lang.IllegalArgumentException - if callback is null
      • setReadTimeOut

        public void setReadTimeOut(int readTimeOut)
                            throws java.lang.IllegalArgumentException
        Sets the read timeout to a specified timeout, in milliseconds. Default is 30000.
        Parameters:
        readTimeOut - time out in milliseconds
        Throws:
        java.lang.IllegalArgumentException - if parameter is <= 0
      • setConnectionTimeOut

        public void setConnectionTimeOut(int connectionTimeOut)
                                  throws java.lang.IllegalArgumentException
        Sets the connection timeout to a specified timeout, in milliseconds. Default is 30000.
        Parameters:
        connectionTimeOut - time out in milliseconds
        Throws:
        java.lang.IllegalArgumentException - if parameter is <= 0
      • getSslContext

        public javax.net.ssl.SSLContext getSslContext()
        Returns the SSLContext object.
        Returns:
        SSLContext the SSLContext
        Since:
        1.2.0
      • setSslContext

        public void setSslContext(javax.net.ssl.SSLContext sslContext)
        Sets the SSLContext to use self-signed or unknown certificates for HttpsURLConnection. If sslContext is not null, it will be used to validate the HttpsURLConnection, otherwise it won't be set.

        One way to provide a sslContext is described here

        Parameters:
        sslContext - A SSLContext instance that contains the list of certificates.
        Since:
        1.2.0
      • setHostnameVerifier

        public void setHostnameVerifier(javax.net.ssl.HostnameVerifier hostnameVerifier)
        Sets the HostnameVerifier to use self-signed or unknown certificates for HttpsURLConnection, hat the host name is an acceptable match with the server's authentication scheme.

        hostnameVerifier will only be set if BaseNetworkContext.sslContext is set as well (not null).

        If hostnameVerifier is not null, the overwritten HostnameVerifier.verify(String, SSLSession) method will be invoked to verify the host name. Otherwise the inherited HostnameVerifier instance is used.

        Parameters:
        hostnameVerifier - A HostnameVerifier instance that contains an overwritten HostnameVerifier.verify(String, SSLSession) method
        Since:
        1.2.0