Construct OIDC application credentials¶
Parse a decrypted raw credential string into a ClientId/ClientSecret pair. This operation is triggered when a consumer constructs OidcAppCredentials from a raw string decrypted from CryptoApi.
| Field | Value |
|---|---|
| Operation ID | OP-01 |
| Trigger | A consumer constructs OidcAppCredentials from a raw string decrypted from CryptoApi. |
| Inputs | raw (string, expected format clientId\|clientSecret) |
| Outputs | An OidcAppCredentials struct with ClientId and ClientSecret populated. |
| Primary components | OidcAppCredentials..ctor(string) |
| Entry point | src/SAIF.NetCore.ServiceContracts/SAIF.NetCore.ServiceContracts/SAIF.NetCore.ServiceContracts/OidcAppCredentials.cs |
Steps¶
- Check
rawfor null. (BR-001) - On failure: throw
ArgumentNullException(nameof(raw)); nothing is constructed. - Split
rawon the'|'character. - Verify the split produced exactly two segments. (BR-002)
- On failure: throw
ArgumentException("Raw credential parameter does not contain valid credential data."). An empty string yields 1 part;"a|b|c"yields 3 parts — both throw. - Assign
ClientId = parts[0]andClientSecret = parts[1]. Empty segments are accepted (for example"|"). (BR-002)
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Construct OidcAppCredentials]) --> NullCheck{raw is null?}
NullCheck -->|Yes| ThrowNull([Throw ArgumentNullException])
NullCheck -->|No| Split["Split raw on '|'"]
Split --> CountCheck{Exactly 2 segments?}
CountCheck -->|No| ThrowArg([Throw ArgumentException])
CountCheck -->|Yes| Assign[Assign ClientId and ClientSecret]
Assign --> End([Return populated struct])
Failure and edge-case behavior¶
rawisnull: throwsArgumentNullException.rawsplits into 1 or 3+ segments: throwsArgumentException.- A segment is an empty string: accepted without error (e.g.
"|"yields emptyClientIdandClientSecret).
Related documentation¶
Sources¶
src/SAIF.NetCore.ServiceContracts/SAIF.NetCore.ServiceContracts/SAIF.NetCore.ServiceContracts/OidcAppCredentials.cs