protected CopyFromJwt ( string accessToken, string refreshToken = null, string idToken = null ) : Task | ||
accessToken | string | |
refreshToken | string | |
idToken | string | |
return | Task |
/// <summary> /// Converts a set of JWTs into a Keycloak identity /// </summary> /// <param name="parameters"></param> /// <param name="accessToken"></param> /// <param name="refreshToken"></param> /// <param name="idToken"></param> /// <returns></returns> public static async Task <KeycloakIdentity> ConvertFromJwtAsync(IKeycloakParameters parameters, string accessToken, string refreshToken = null, string idToken = null) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } if (accessToken == null) { throw new ArgumentNullException(nameof(accessToken)); } var kcIdentity = new KeycloakIdentity(parameters); try { await kcIdentity.CopyFromJwt(accessToken, refreshToken, idToken); } catch (SecurityTokenExpiredException) { // Load new identity from token endpoint via refresh token (if possible) await kcIdentity.RefreshIdentity(refreshToken); } return(kcIdentity); }
/// <summary> /// Converts a set of JWTs into a Keycloak identity /// </summary> /// <param name="parameters"></param> /// <param name="accessToken"></param> /// <param name="refreshToken"></param> /// <param name="idToken"></param> /// <returns></returns> public static async Task<KeycloakIdentity> ConvertFromJwtAsync(IKeycloakParameters parameters, string accessToken, string refreshToken = null, string idToken = null) { if (parameters == null) throw new ArgumentNullException(nameof(parameters)); if (accessToken == null) throw new ArgumentNullException(nameof(accessToken)); var kcIdentity = new KeycloakIdentity(parameters); try { await kcIdentity.CopyFromJwt(accessToken, refreshToken, idToken); } catch (SecurityTokenExpiredException) { // Load new identity from token endpoint via refresh token (if possible) await kcIdentity.RefreshIdentity(refreshToken); } return kcIdentity; }