Custodianship Service Client
Overview
Custodianship is a feature we facilitate for users who need to have a guardian oversee their online actions. Users under custodianship are not legally allowed to use our services.
Freja eID allows Relying Parties to check user's custodianship status through the Custodianship Service.Ā
In order to check the custodianship status for a user, you need to obtain the existing user information for that user in the Freja eID system and pass it in the call to Freja eID services.Ā This must be their personal identity number.
For more detailed information about Custodianships, please refer to Freja eID Relying Party Developers' Documentation.
InitialisingĀ Custodianship Client
Build an instance of theĀ CustodianshipClientApi interface as shown in the examples below. Note that theĀ CustodianshipClient has its own Builder class, which is used for instantiation ofĀ CustodianshipClient objects. This way of creating objects requires passing mandatory parameters in the Builder constructor, while the rest of the parameters can be passed through the BuilderĀ setter functions.
Calling a Service
This section describes how to make calls to the Freja eID API in order to check user custodianship status.Ā
Check User Custodianship Status
This method is used to check the custodianship status for a specific user. As said before, the existing user information for that user in the Freja eID system must be passed as a parameter of this method.
/*
* The CountryID and SSN of the user whose custodianship status you are checking,
* in format SEYYYYMMDDXXXX.
* In the current version of Freja eID, country ID must be equal to "SE".
* Change the countryIdAndCrn value (SE199004101234 in the example) to match your setup.
* See the example below.
*/
String countryIdAndCrn = "SE199004101234";
GetUserCustodianshipStatusRequest getUserCustodianshipRequest = GetUserCustodianshipStatusRequest
.create(countryIdAndCrn);
/*
* The result of getUserCustodianshipStatus is a String with the value of either "UNKNOWN"
* or "USER_HAS_CUSTODIAN"
* "USER_HAS_CUSTODIAN" is the custodianship status when the user has a custodian.
* "UNKNOWN" is the custodianship status when it's unknown if the user has a custodian.
*/
String userCustodianshipStatus = custodianshipClient.getUserCustodianshipStatus(request);
For each Integrated Relying Party, as well as for the IntegratorĀ Relying Party itself, Freja eID generates a unique identifier called relyingPartyId. The IntegratorĀ Relying Party needs to pass this identifier in each request.Ā Read more about Integrator and Integrated Relying Parties here.
Ā
/*
* Parameter relyingPartyId represents a unique ID of the Relying Party
* for which the set/delete custom identifier request should be initiated.
*/
String relyingPartyId = "relying_party_id";
/*
* Get user custodianship status request with relyingPartyId.
*/
GetUserCustodianshipStatusRequest.createCustom()
.setUserCountryIdAndCrn(countryIdAndCrn)
.setRelyingPartyId(relyingPartyId)
.build();
Logging and Error Handling
Details for logging and introduction to client exception can be found in theĀ Logging and Error Handling.