Skip to content

Get user profile

Retrieves the SecurityApi's user-profile record for the given user ID.

Field Value
Operation ID OP-05
Trigger Caller code requests a user's profile data.
Inputs userId.
Outputs UserProfile (or a caller-supplied T), or a thrown SecurityClientException.
Primary components SecurityClient.GetUser(userId) / GetUser<T>(userId)
Entry point src/SAIF.NetCore.AuthService/SAIF.NetCore.AuthService/SAIF.NetCore.AuthService/Clients/SecurityClient.cs

Steps

  1. GetUser(userId) calls GetUser<UserProfile>(userId).
  2. Replace \\ with / in userId (BR-AUTH-009), then GET /v1/Users/GetUser/{userId} through HandleSecurityServiceGetResponse<T> (BR-AUTH-011)
  3. 2.1 Await the GET call.
  4. 2.2 On success, return result.GetResult<T>().
  5. 2.3 Otherwise, if result.ErrorException is present, throw SecurityClientException(result.ErrorMessage, result.ErrorException) (error with inner exception).
  6. 2.4 Otherwise (no inner exception), throw SecurityClientException(result.ErrorMessage).

Origin: Steps 2.1–2.4 are implemented in Handle a Security API response (SAIF.NetCore.AuthService) and executed on behalf of this operation.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([GetUser called]) --> Replace["userId: \\ -> /"]
    Replace --> Get["GET /v1/Users/GetUser/userId"]
    Get --> Success{IsSuccessful?}
    Success -->|Yes| Return([Return T]) 
    Success -->|No| Throw([Throw SecurityClientException])

Failure and edge-case behavior

  • A non-success remote response throws SecurityClientException.

Sources

  • src/SAIF.NetCore.AuthService/SAIF.NetCore.AuthService/SAIF.NetCore.AuthService/Clients/SecurityClient.cs