internal static void TokenManagementOptions(AccessTokenManagementOptions options) { string clientId = _configuration["ApplicationIds:IdManagementId"]; options.Client.Clients.Add(clientId, new IdentityModel.Client.ClientCredentialsTokenRequest { Address = _configuration["AppURLS:IS4BaseUrl"] + "/connect/token", ClientId = clientId, ClientSecret = _configuration["ApplicationSecrets:IdManagementSecret"], Scope = _configuration["ApplicationIds:IdApiId"] }); options.Client.Scope = _configuration["ApplicationIds:IdApiId"]; }
/// <summary> /// Adds the token management services to DI /// </summary> /// <param name="services"></param> /// <param name="configureAction"></param> /// <returns></returns> public static TokenManagementBuilder AddAccessTokenManagement(this IServiceCollection services, Action <AccessTokenManagementOptions> configureAction = null) { CheckConfigMarker(services); var options = new AccessTokenManagementOptions(); configureAction?.Invoke(options); services.AddSingleton(options.Client); services.AddSingleton(options.User); services.AddUserAccessTokenManagementInternal(); services.AddClientAccessTokenManagementInternal(); return(new TokenManagementBuilder(services)); }