8 Service APIs
This section provides a reference for APIs that should be implemented by this Building Block.
The APIs defined here establish a blueprint for how the Building Block will interact with other Building Blocks. Additional APIs may be implemented by the Building Block, but the listed APIs define a minimal set of functionality that should be provided by any implementation of this Building Block.
In common for all services of the Identity Building Block, the API expects the calling Partner has been already authenticated and authorized to access the service. For detailed specifications of APIs with input/output formats please refer to API specifications defined in YAML in the corresponding GitHub repository.
The GovStack non-functional requirements document provides additional information on how 'adaptors' may be used to translate an existing API to the patterns described here. This section also provides guidance on how candidate products are tested and how GovStack validates a product's API against the API specifications defined here.
The tests for the Identity Building Block can be found in this GitHub repository.
API standards
The microservice interfaces are defined as per OPENAPI Ver3.0 standards.
For implementation purposes, it is suggested to refer TMF630_REST_API_Design_Guidelines.
8.1 Identity Usage
The Identity usage APIs are a set of OpenAPI specifications exposed by the Identity Building Block to other building blocks and applications for user verification.
The Identity usage APIs are based on the following principles:
Verification APIs are inspired from OpenID Connect protocol which simplifies integrations using pre-existing libraries
Only secure options in OpenID connect should be supported to ensure the user data is handled securely
All biometric capture for user verification should be done using Secure Biometrics Interface standards
Service Group: Client Management
Create OIDC Client Endpoint
API to add new open ID connect (OIDC) clients, it can be invoked by other modules which manages the relying parties / partners.
Each relying party can associate to one or multiple OIDC client Ids.
On create, OIDC client status will be by default set to "active".
Current date and time when the request is sent
OK
Date and time when the response is generated
Update OIDC Client Endpoint
API to update existing Open ID Connect (OIDC) client, it can be invoked by other modules which manages the relying parties / partners when there any updates on the fields accepted in this API.
Authentication and authorization is based on a valid JWT issued by a trusted IAM system including "update_oidc_client" scope.
Client Identifier
"785b806d0e594657b05aabdb30fff8a4"
Current date and time when the request is sent
OK
Date and time when the response is generated
List of Errors in case of request validation / processing failure in IDBB server. When request processing is fully successful, this array will be empty.
Authorization Endpoint
This is the authorize endpoint of Open ID Connect (OIDC). The relying party applications will do a browser redirect to this endpoint with all required details passed as query parameters.
This endpoint will respond with a HTML page / JS application to be loaded in the browser.
All the validations on the query parameter values will be performed, in case of any failures respective error message will be sent along with browser redirection back to relying party application.
OK
Loads IDBB UI application in browser for interacting with user for Login process
Token Endpoint
Once the client / relying party application receives the authorization code through redirect, this OIDC complaint endpoint will be called from the relying party backend application to get the ID Token and Access Token.
- The only supported client authentication method : private_key_jwt
- ClientAssertion is a signed JWT with client's private key, corresponding public key should be shared with IDBB during the OIDC client creation process.
- clientAssertion JWT payload must be as below:
The JWT MUST contain the following REQUIRED Claim Values and MAY contain few additional OPTIONAL Claim Values:
iss* (Issuer): This MUST contain the client_id of the OIDC / OAuth Client.
sub* (Subject): This MUST contain the client_id of the OIDC / OAuth Client.
aud* (Audience): Value that identifies the IDBB server as an intended audience. The IDBB server MUST verify that it is an intended audience for the token. The audience SHOULD be the URL of the IDBB's token endpoint.
exp* (Expiration): Time on or after which the ID token MUST NOT be accepted for processing.
iat*: Time at which the JWT was issued.
Note: The Client Assertion JWT can contain other Claims. Any Claims used that are not understood WILL be ignored.
Authorization code grant type.
Authorization code, sent as query param in the client's redirect URI.
Client Id of the OIDC client.
Type of the client assertion part of this request.
Private key signed JWT, This JWT payload structure is defined above as part of request description.
Valid client redirect_uri. Must be same as the one sent in the authorize call.
OK
Identity token in JWT format. Will have the below claims in the payload.
The access token in JWT format. This token will be used to call the UserInfo endpoint. Relying party application should handle access token as opaque.
The type of the access token, set to Bearer
The lifetime of the access token, in seconds.
UserInfo Endpoint
Once the access token is received via the token endpoint, relying party backend application can call this OIDC compliant endpoint to request for the user claims.
Consented user claims will be returned as a JWT. This JWT will be a nested JWT which is signed using JWS and then encrypted using JWE.
Example: Assuming the below are the requested claims by the relying party
name : { "essential" : true }
phone: { "essential" : true }
Response 1: When consent is provided for both name and phone number:
{ "name" : "John Doe", "phone" : "033456743" }
Response 2: When consent is provided for only name:
{ "name" : "John Doe" }
Response 3: When Claims are requested with claims_locales : "en fr"
{ "name#en" : "John Doe", "name#fr" : "Jean Doe", "phone" : "033456743" }
Supported User Info Claims
OK
The response is signed and then encrypted, with the result being a Nested JWT. Signed using the IDBB's private key. Signed full JWT will then be encrypted using OIDC client's public key.
JSON Web Key Set Endpoint
Endpoint to fetch all the public keys of the IDBB server. Returns public key set in the JWKS format.
OK
Configuration Endpoint
This endpoint is only for facilitating the OIDC provider details in a standard way.
Reference: https://openid.net/specs/openid-connect-discovery-1_0.html
OK
URL using the https scheme with no query or fragment component that the RP asserts as its Issuer Identifier. This also MUST be identical to the iss Claim value in ID Tokens issued from this Issuer.
URL of the OAuth 2.0 Authorization Endpoint.
URL of the OAuth 2.0 Token Endpoint.
URL of the OP's UserInfo Endpoint.
URL of the OP's JSON Web Key Set [JWK] document.
URL of Client Registration Endpoint.
JSON array containing a list of the OAuth 2.0 [RFC6749] scope values that this server supports.
JSON array containing a list of the OAuth 2.0 response_type values that this OP supports.
JSON array containing a list of the Authentication Context Class References that IDP supports.
JSON array containing a list of the JWS [JWS] signing algorithms.
JSON array containing a list of the JWE [JWE] encryption algorithms.
JSON array containing a list of the JWE encryption algorithms (enc values) [JWA] supported by the UserInfo Endpoint to encode the Claims in a JWT.
JSON array containing a list of Client Authentication methods supported by this Token Endpoint.
JSON array containing a list of the display parameter values that the OpenID Provider supports.
JSON array containing a list of the Claim Types that the OpenID Provider supports.
JSON array containing a list of the Claim Names of the Claims that the OpenID Provider MAY be able to supply values for.
Languages and scripts supported for values in Claims being returned.
Languages and scripts supported for the user interface.
Mechanism to be used for returning parameters from the Authorization Endpoint.
For Identity Building Block implementations that support mobile wallet integration, the following API spec should also be implemented.
Generate Link Code endpoint
Generate link code request is raised from IDBB UI application.
- UI application creates a deeplink with this link-code as parameter.
- This deeplink is embedded in a Machine-readable-code (like QR code) and the same is rendered in the UI.
- End user scans this machine-readable-code to open wallet app.
- On open of wallet-app, wallet-app invokes /link-transaction endpoint.
- In the UI application, once machine-readable-code is rendered, at the same time /link-status endpoint is invoked as a long polling request.
OK
Link status endpoint
The link status endpoint is invoked from IDBB UI application.
- Checks the status of link code and will return the status as LINKED once the /link-transaction endpoint is called from wallet application.
OK
Link authorization code endpoint
Link authorization code endpoint is invoked from UI application.
- This is a Long polling request to IDBB backend.
- validates the transactionId
- validates the linkCode if its LINKED.
- checks the cache to see if the auth-code is generated, if yes returns the response.
- If the auth-code is not yet generated, polling request waits for the configured time.
- On successful response, IDBB UI should redirect to the provided redirectUri with auth-code or error details.
OK
Link Transaction endpoint
The link transaction endpoint is invoked from Wallet-app.
-
Validates the link-code and its expiry and generates the linkTransactionId. This linkTransactionId is linked to transactionId used in the /link-code endpoint.
-
Returns the auth-factors, clientName, logoUrl, User claims, authorize scopes along with linkTransactionId.
Note: Wallet-app will hereafter address the transaction with this linkTransactionId for the /authenticate and /consent endpoints.
OK
Linked Authentication Endpoint
Once end user provides the user identifier (UIN/VID) and all the required auth challenge to the Wallet-app, this endpoint will be invoked from wallet-app.
Supported auth-challenge depends on the integrated IDBB implementation.
- Validates linkedTransactionId.
- Validates null / empty individualId.
On Authentication Success: Only linkTransactionId is returned in the below response without any errors.
On Authentication Failure: Error list will be returned.
yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
OK
List of Errors in case of request validation / processing failure in IDBB server.
Linked Consent Endpoint
Once the authentication is successful and user permission is obtained, this endpoint will be invoked by the wallet app to send the accepted user claims and permitted scopes.
- Validates linkedTransactionId.
- Validate accepted claims and permitted scopes in the request.
- If valid, stores the accepted claims and permitted scopes in the datastore.
yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
OK
Wallet Binding Endpoint (Draft)
Wallet binding endpoint is invoked by Wallet's backend server.
- Action will be initiated from wallet-app with authChallenge by user.
- Wallet backend server will receive the authChallenge, create this request and send to IDBB to complete the binding process.
- Binded walletUserId (WUID) is returned with IDBB signed certificate.
Note: Binding entry uniqueness is combination of these 3 values -> (PSUT, public-key, auth-factor-type)
OK
Detailed API schemas written in YAML that define REST API endpoints for each of the services mentioned above are available on GitHub located at the Identity-Provider YAML.
The GovStack non-functional requirements document provides additional information on how 'adaptors' may be used to translate an existing API to the patterns described here.
8.2 Identity Management
The Enrollment APIs are a set of OpenAPI specifications exposed by the Identity Building Block ‘Enrollment Server’ service to any enrollment client.
The Enrollment APIs are based on the following principles:
When enrollment is done in one step, the CreateEnrollment can contain all the data and an additional flag (finalize) to indicate all data was collected.
During the process, the enrollment structure can be updated. Only the data that changed need to be transferred. Data not included is left unchanged on the server. In the following example, the biographic data is not changed.
Images can be passed by value or reference.
Existing standards are used whenever possible, for instance, the preferred image format for biometric data is ISO-19794. The underlying data should be of open mime types that offer good compression without loss of data (for example JPEG2000 for images).
This Services APIs is not yet specified, but it should be the purpose of a next iteration of the Identity Building Block Specification.
8.3 Credential Management
This Services APIs is not yet specified, but it should be the purpose of a next iteration of the Identity Building Block Specification.
8.4 Subscription Management
This Services APIs is not yet specified, but it should be the purpose of a next iteration of the Identity Building Block Specification.
8.5 Administration Management
This Services APIs is not yet specified, but it should be the purpose of a next iteration of the Identity Building Block Specification.
Last updated