Vlad,
Im all up and running with the project and I have a workable solution but I'd like to get your input on a few points.
1. The only OIDC configuration items that appear to be required in order to enable the standard OIDC id-token validation to pass are as follows:
- issuer: MUST exactly match the value of the iss (issuer) Claim.
- jwks_uri: The uri to the encryption key information. (launcher already properly supporting this element)
- authorization_endpoint: The uri to the OAUTH2 "authorize" endpoint.
- token_endpoint: The uri to the OAUTH2 "token" endpoint.
- subject_types_supported: The type of subject identifier used. The value "public" should be used to indicate that this provides the same sub (subject) value to all Clients.
The elements that need to be added are, "issuer", "authorization_endpoint", "token_endpoint" and "subject_types_supported"... I'll read the code the better understand how I can properly formulate the first three, the last one is jut hard-coded. I'll submit a PR with these additions using the method you outlined above.
2. Epic App Orchard Launcher adds the following STATIC items to their OIDC discovery metadata but I've determined that these may be generally optional:
- id_token_signing_alg_values_supported: The current type of signing algorithm used for the token (same as in header) defaults to "RS256"
- response_types_supported: The type of the response... I believe this is supposed to be "id_token" but Epic shows "code" (this might be wrong on their part).
- scopes_supported: The scopes supported during token negotiations. Epic has: "fhirUser", "launch" and "openid".
- grant_types_supported: The grant types supported during token negotiations. Epic has: "authorization_code", "refresh_token", "client_credentials" and "urn:ietf:params:oauth:grant-type:jwt-bearer".
- token_endpoint_auth_methods_supported: the token endpoint methods supported during the token negotiations. Epic has: "client_secret_post", "client_secret_basic" and "private_key_jwt".
- response_modes_supported: The response modes supported. Epic has: "query"
I'll document these within the PR just in case that these should need to be added in a later PR.
3. The value of the "aud" within the id_token is defined to be as follows:
Audience(s) that this ID Token is intended for. It MUST contain the OAuth 2.0 client_id of the Relying Party as an audience value. It MAY also contain identifiers for other audiences. In the general case, the aud value is an array of case sensitive strings. In the common special case when there is one audience, the aud value MAY be a single case sensitive string.
Currently, the id_token coming back from the SMART launcher always has the value "whatever" as the value of the "aud". I think to properly support this field, we would need to introduce a "client-id" entry field in the tool that allows the user to specify a "client-id" to use during the launch process. This value could be pre-populated with a random GUID value and, more or less, collapsed in some section so that it doesn't overwhelm the UI. The user that needs to set this value could hunt it out, expand it and set it if needed..... any thoughts?
Dave