Package org.opencabstandard.provider
Class IdentityContract
- java.lang.Object
-
- org.opencabstandard.provider.IdentityContract
-
public final class IdentityContract extends java.lang.ObjectDefines the contract for the OpenCab Identity Content provider. An OpenCab Identity provider app should define an AndroidContentProviderclass that follows this contract or should subclass theAbstractIdentityProviderclass and implement the abstract methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIdentityContract.DriverObject representing a Driver.static classIdentityContract.LoginCredentialsObject containing the login credentials.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringACTION_DRIVER_LOGINThis Action is broadcast when the user logs in to the application.static java.lang.StringACTION_DRIVER_LOGOUTThis Action is broadcast when the driver logs out of the OpenCab provider app.static java.lang.StringACTION_IDENTITY_INFORMATION_CHANGEDThis Action is broadcast when the identity information changes.static java.lang.StringAUTHORITYThis authority is declared in the manifest for the Identity Content Provider.static java.lang.StringKEY_ACTIVE_DRIVERSUse this key to retrieve the active drivers from theBundleobject that is returned from theIdentityContract.METHOD_GET_ACTIVE_DRIVERS method call.static java.lang.StringKEY_ERRORIf 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.StringKEY_LOGIN_CREDENTIALSUse this key to retrieve theIdentityContract.LoginCredentialsfrom theBundleobject that is returned from theIdentityContract.METHOD_GET_LOGIN_CREDENTIALS method call.static java.lang.StringMETHOD_GET_ACTIVE_DRIVERSProvider method for retrieving the current active drivers.static java.lang.StringMETHOD_GET_LOGIN_CREDENTIALSProvider method for retrieving the login credentials.static java.lang.StringVERSIONThis is the current version of theIdentityContractfor the Open Cab Standard.
-
Constructor Summary
Constructors Constructor Description IdentityContract()
-
-
-
Field Detail
-
VERSION
public static final java.lang.String VERSION
This is the current version of theIdentityContractfor 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. Providers MUST publish this event when a user (either a team driver or the last primary user) logs out of the app. This event SHOULD correspond to a change in the result ofMETHOD_GET_ACTIVE_DRIVERSThe OpenCab consumer app MAY listen to this broadcast and perform a logout of the consumer app.
Note: The underlying string value of this constant erroneously begins with
com.opencabstandardrather thanorg.opencabstandard. This error is preserved in order to maintain backwards compatibility.- See Also:
- Constant Field Values
-
ACTION_IDENTITY_INFORMATION_CHANGED
public static final java.lang.String ACTION_IDENTITY_INFORMATION_CHANGED
This Action is broadcast when the identity information changes.You can subscribe to this event to receive updates indicating the active driver, or information about the active driver (such as their LoginCredentials token) has been updated. To get the updated value, call METHOD_GET_LOGIN_CREDENTIALS after receiving this event.
Providers MUST publish this event when the values returned by
METHOD_GET_LOGIN_CREDENTIALSchange.- See Also:
- Constant Field Values
-
ACTION_DRIVER_LOGIN
public static final java.lang.String ACTION_DRIVER_LOGIN
This Action is broadcast when the user logs in to the application. Providers MUST publish this event when a user authenticates with the app, such as by entering their credentials.- 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:
ContentResolverresolver = getApplicationContext().getContentResolver();Bundleresult = 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:
ContentResolverresolver = getApplicationContext().getContentResolver();Bundleresult = 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 theBundleobject that is returned from theIdentityContract.METHOD_GET_ACTIVE_DRIVERS method call.Example:
ArrayList<Driver> drivers = result.getParcelableArrayList(IdentityContract.KEY_ACTIVE_DRIVERS);- See Also:
- Constant Field Values
-
KEY_LOGIN_CREDENTIALS
public static final java.lang.String KEY_LOGIN_CREDENTIALS
Use this key to retrieve theIdentityContract.LoginCredentialsfrom theBundleobject that is returned from theIdentityContract.METHOD_GET_LOGIN_CREDENTIALS method call.Example:
LoginCredentials credentials = result.getParcelable(IdentityContract.KEY_LOGIN_CREDENTIALS);- 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
-
-