Class IdentityContract


  • public final class IdentityContract
    extends java.lang.Object
    Defines the contract for the OpenCab Identity Content provider. An OpenCab Identity provider app should define an Android ContentProvider class that follows this contract or should subclass the AbstractIdentityProvider class and implement the abstract methods.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ACTION_DRIVER_LOGOUT
      This Action is broadcast when the driver logs out of the OpenCab provider app.
      static java.lang.String AUTHORITY
      This authority is declared in the manifest for the Identity Content Provider.
      static java.lang.String KEY_ACTIVE_DRIVERS
      Use this key to retrieve the active drivers from the Bundle object that is returned from the IdentityContract.METHOD_GET_ACTIVE_DRIVERS method call.
      static java.lang.String KEY_ERROR
      If an error has occurred in one of the provider method calls, use this key to retrieve the error from the Bundle object returned from the provider call method.
      static java.lang.String KEY_LOGIN_CREDENTIALS
      Use this key to retrieve the IdentityContract.LoginCredentials from the Bundle object that is returned from the IdentityContract.METHOD_GET_LOGIN_CREDENTIALS method call.
      static java.lang.String METHOD_GET_ACTIVE_DRIVERS
      Provider method for retrieving the current active drivers.
      static java.lang.String METHOD_GET_LOGIN_CREDENTIALS
      Provider method for retrieving the login credentials.
      static java.lang.String VERSION
      This is the current version of the IdentityContract for the Open Cab Standard.
    • Method Summary

      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • VERSION

        public static final java.lang.String VERSION
        This is the current version of the IdentityContract for the Open Cab Standard. The version will be passed as an argument to all method calls to the provider. The provider may reject or handle appropriately if the VERSION does not match the expected value. An OpenCab Identity provider allows access to authentication related information that can be used by an OpenCab Identity consumer app to enable SSO.
        See Also:
        Constant Field Values
      • AUTHORITY

        public static final java.lang.String AUTHORITY
        This authority is declared in the manifest for the Identity Content Provider. It is then used by the consumer app to identify any providers installed on the device.
        See Also:
        Constant Field Values
      • ACTION_DRIVER_LOGOUT

        public static final java.lang.String ACTION_DRIVER_LOGOUT
        This Action is broadcast when the driver logs out of the OpenCab provider app. The OpenCab consumer app may listen to this broadcast and perform a logout of the consumer app.
        See Also:
        Constant Field Values
      • METHOD_GET_LOGIN_CREDENTIALS

        public static final java.lang.String METHOD_GET_LOGIN_CREDENTIALS
        Provider method for retrieving the login credentials. The credentials include a token that uniquely identifies the driver and can be used to authenticate the driver.

        Example:

         
             ContentResolver resolver = getApplicationContext().getContentResolver();
             Bundle result = resolver.call(Uri.parse("content://" + IdentityContract.AUTHORITY),
        
                                          IdentityContract.METHOD_GET_LOGIN_CREDENTIALS,
                                          IdentityContract.VERSION,
                                          null);
        
             LoginCredentials credentials = result.getParcelable(IdentityContract.KEY_LOGIN_CREDENTIALS);
         
         

        Diagram:

        sequenceDiagram participant A as OpenCab Consumer participant B as OpenCab Provider A->>B: contentResolver.call(Uri.parse("content://org.opencabstandard.identity"), "getLoginCredentials", "0.2", null) B->>A: android.os.Bundle
        See Also:
        Constant Field Values
      • METHOD_GET_ACTIVE_DRIVERS

        public static final java.lang.String METHOD_GET_ACTIVE_DRIVERS
        Provider method for retrieving the current active drivers. Active drivers can include the vehicle operator as well as any co-drivers in the vehicle.

        Example:

         
             ContentResolver resolver = getApplicationContext().getContentResolver();
             Bundle result = resolver.call(Uri.parse("content://" + IdentityContract.AUTHORITY),
                                          IdentityContract.METHOD_GET_ACTIVE_DRIVERS,
                                          IdentityContract.VERSION,
                                          null);
        
             ArrayList<IdentityContract.Driver> drivers =
                      result.getParcelableArrayList(IdentityContract.KEY_ACTIVE_DRIVERS);
         
         

        Diagram:

        sequenceDiagram participant A as OpenCab Consumer participant B as OpenCab Provider A->>B: contentResolver.call(Uri.parse("content://org.opencabstandard.identity"), "getActiveDrivers", "0.2", null) B->>A: android.os.Bundle
        See Also:
        Constant Field Values
      • KEY_ACTIVE_DRIVERS

        public static final java.lang.String KEY_ACTIVE_DRIVERS
        Use this key to retrieve the active drivers from the Bundle object that is returned from the IdentityContract.METHOD_GET_ACTIVE_DRIVERS method call.

        Example:

         
             ArrayList<Driver> drivers =
                      result.getParcelableArrayList(IdentityContract.KEY_ACTIVE_DRIVERS);
         
         
        See Also:
        Constant Field Values
      • KEY_ERROR

        public static final java.lang.String KEY_ERROR
        If an error has occurred in one of the provider method calls, use this key to retrieve the error from the Bundle object returned from the provider call method.

        Example:

         
             String error = result.getString(IdentityContract.KEY_ERROR);
         
         
        See Also:
        Constant Field Values
    • Constructor Detail

      • IdentityContract

        public IdentityContract()