64 lines
1.9 KiB
C#
64 lines
1.9 KiB
C#
using System.Collections.Generic;
|
|
using IdentityServer4;
|
|
using IdentityServer4.Models;
|
|
using IdentityServer4.Test;
|
|
|
|
namespace nuget_host
|
|
{
|
|
public static class Config
|
|
{
|
|
public static IEnumerable<IdentityResource> IdentityResources =>
|
|
new List<IdentityResource>
|
|
{
|
|
new IdentityResources.OpenId(),
|
|
new IdentityResources.Profile(),
|
|
};
|
|
|
|
public static IEnumerable<ApiResource> ApiResources =>
|
|
new List<ApiResource>
|
|
{
|
|
new ApiResource(scope_packages)
|
|
};
|
|
|
|
public const string scope_packages = "packages";
|
|
|
|
public static IEnumerable<Client> Clients =>
|
|
new List<Client>
|
|
{
|
|
// machine to machine client
|
|
new Client
|
|
{
|
|
ClientId = "client",
|
|
ClientSecrets = { new Secret("secret".Sha256()) },
|
|
|
|
AllowedGrantTypes = GrantTypes.ClientCredentials,
|
|
// scopes that client has access to
|
|
AllowedScopes = { scope_packages }
|
|
},
|
|
|
|
// interactive ASP.NET Core MVC client
|
|
new Client
|
|
{
|
|
ClientId = "mvc",
|
|
ClientSecrets = { new Secret("secret".Sha256()) },
|
|
|
|
AllowedGrantTypes = GrantTypes.Code,
|
|
|
|
// where to redirect to after login
|
|
RedirectUris = { "https://localhost:5002/signin-oidc" },
|
|
|
|
// where to redirect to after logout
|
|
PostLogoutRedirectUris = { "https://localhost:5002/signout-callback-oidc" },
|
|
|
|
AllowedScopes = new List<string>
|
|
{
|
|
IdentityServerConstants.StandardScopes.OpenId,
|
|
IdentityServerConstants.StandardScopes.Profile,
|
|
scope_packages
|
|
}
|
|
}
|
|
};
|
|
|
|
public static List<TestUser> TestUsers { get; internal set; }
|
|
}
|
|
} |