Package org.opencabstandard.provider
Class IdentityContract
- java.lang.Object
-
- org.opencabstandard.provider.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 AndroidContentProvider
class that follows this contract or should subclass theAbstractIdentityProvider
class and implement the abstract methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IdentityContract.Driver
Object representing a Driver.static class
IdentityContract.LoginCredentials
Object containing the login credentials.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ACTION_DRIVER_LOGIN
This Action is broadcast when the user logs in to the application.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
ACTION_IDENTITY_INFORMATION_CHANGED
This Action is broadcast when the identity information changes.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 theBundle
object that is returned from theIdentityContract
.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 theIdentityContract.LoginCredentials
from theBundle
object that is returned from theIdentityContract
.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 theIdentityContract
for 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 theIdentityContract
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. 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_DRIVERS
The 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.opencabstandard
rather 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_CREDENTIALS
change.- 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:
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 theBundle
object 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.LoginCredentials
from theBundle
object 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
-
-