|
|
@ -40,17 +40,21 @@ namespace Squidex.Config.Identity |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
services.AddSingleton( |
|
|
services.AddSingleton( |
|
|
GetScopes()); |
|
|
GetApiResources()); |
|
|
|
|
|
services.AddSingleton( |
|
|
|
|
|
GetIdentityResources()); |
|
|
services.AddSingleton<IClientStore, |
|
|
services.AddSingleton<IClientStore, |
|
|
LazyClientStore>(); |
|
|
LazyClientStore>(); |
|
|
services.AddSingleton<IScopeStore, |
|
|
services.AddSingleton<IResourceStore, |
|
|
InMemoryScopeStore>(); |
|
|
InMemoryResourcesStore>(); |
|
|
|
|
|
|
|
|
services.AddIdentityServer(options => |
|
|
services.AddIdentityServer(options => |
|
|
{ |
|
|
{ |
|
|
options.UserInteractionOptions.ErrorUrl = "/account/error/"; |
|
|
options.UserInteractionOptions.ErrorUrl = "/account/error/"; |
|
|
}) |
|
|
}) |
|
|
.SetSigningCredential(certificate) |
|
|
.AddInMemoryApiResources(GetApiResources()) |
|
|
|
|
|
.AddInMemoryIdentityResources(GetIdentityResources()) |
|
|
|
|
|
.AddSigningCredential(certificate) |
|
|
.AddAspNetIdentity<IdentityUser>(); |
|
|
.AddAspNetIdentity<IdentityUser>(); |
|
|
|
|
|
|
|
|
return services; |
|
|
return services; |
|
|
@ -64,26 +68,21 @@ namespace Squidex.Config.Identity |
|
|
return services; |
|
|
return services; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static IEnumerable<Scope> GetScopes() |
|
|
private static IEnumerable<ApiResource> GetApiResources() |
|
|
{ |
|
|
|
|
|
return new List<Scope> |
|
|
|
|
|
{ |
|
|
|
|
|
StandardScopes.OpenId, |
|
|
|
|
|
StandardScopes.Profile, |
|
|
|
|
|
new Scope |
|
|
|
|
|
{ |
|
|
|
|
|
Name = Constants.ProfileScope, Type = ScopeType.Identity, |
|
|
|
|
|
Claims = new List<ScopeClaim> |
|
|
|
|
|
{ |
|
|
{ |
|
|
new ScopeClaim(ExtendedClaimTypes.SquidexDisplayName, true), |
|
|
yield return new ApiResource(Constants.ApiScope); |
|
|
new ScopeClaim(ExtendedClaimTypes.SquidexPictureUrl, true) |
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
|
|
|
new Scope |
|
|
private static IEnumerable<IdentityResource> GetIdentityResources() |
|
|
{ |
|
|
{ |
|
|
Name = Constants.ApiScope, Type = ScopeType.Resource |
|
|
yield return new IdentityResources.OpenId(); |
|
|
} |
|
|
yield return new IdentityResources.Profile(); |
|
|
}; |
|
|
yield return new IdentityResource(Constants.ProfileScope, |
|
|
|
|
|
new[] |
|
|
|
|
|
{ |
|
|
|
|
|
ExtendedClaimTypes.SquidexDisplayName, |
|
|
|
|
|
ExtendedClaimTypes.SquidexPictureUrl |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|