Что я могу использовать IdentityServer4 Oauth на Графане - PullRequest
0 голосов
/ 13 марта 2020

Я использую IdentityServer4 для настройки одного Сервера, а InMemoryConfiguration.cs для инициализации моих данных

InMemoryConfiguration.cs

new Client
{
   ClientId = "client.api.service",
   ClientSecrets = new [] { new Secret("clientsecret".Sha256()) },
   RedirectUris = { $"http://10.228.51.220:3000/login/generic_oauth" ,
                    $"http://10.228.51.221:56458/signin-oidc",
                    $"http://10.228.51.220:3000/signin-oidc",
                    $"http://localhost:12415/signin-oidc"},
   AllowedGrantTypes = GrantTypes.ResourceOwnerPasswordAndClientCredentials,
   AllowedScopes = new [] {
           IdentityServerConstants.StandardScopes.OpenId,
           IdentityServerConstants.StandardScopes.Profile,
           IdentityServerConstants.StandardScopes.Email,
           "agentservice", "clientservice", "productservice"
   },
},
new Client
{
   ClientId = "product.api.service",
   ClientSecrets = new [] { new Secret("productsecret".Sha256()) },
   RedirectUris = { $"http://10.228.51.220:3000/login/generic_oauth" ,
                    $"http://10.228.51.221:56458/signin-oidc",
                    $"http://10.228.51.220:3000/signin-oidc",
                    $"http://localhost:12415/signin-oidc"},
   AllowedGrantTypes = GrantTypes.ResourceOwnerPasswordAndClientCredentials,
   AllowedScopes = new [] {
           IdentityServerConstants.StandardScopes.OpenId,
           IdentityServerConstants.StandardScopes.Profile,
           IdentityServerConstants.StandardScopes.Email,
           "agentservice", "clientservice", "productservice"
   },
 },
 new Client
 {
    ClientId = "agent.api.service",
    ClientSecrets = new [] { new Secret("agentsecret".Sha256()) },
    RedirectUris = { $"http://10.228.51.220:3000/login/generic_oauth" ,
                     $"http://10.228.51.221:56458/signin-oidc",
                     $"http://10.228.51.220:3000/signin-oidc",
                     $"http://localhost:12415/signin-oidc"},
    AllowedGrantTypes = GrantTypes.ResourceOwnerPasswordAndClientCredentials,
    AllowedScopes = new [] {
           IdentityServerConstants.StandardScopes.OpenId,
           IdentityServerConstants.StandardScopes.Profile,
           IdentityServerConstants.StandardScopes.Email,
           "agentservice", "clientservice", "productservice"
    },
 },
 new Client
 {
    ClientId = "cas.mvc.client.implicit",
    ClientName = "CAS MVC Web App Client",
    AllowedGrantTypes = GrantTypes.Implicit,
    RedirectUris = { $"http://10.228.51.220:3000/login/generic_oauth" ,
                     $"http://10.228.51.221:56458/signin-oidc",
                     $"http://10.228.51.220:3000/signin-oidc",
                     $"http://localhost:12415/signin-oidc",
                     $"http://10.228.51.220:3000/login"},
    PostLogoutRedirectUris = { $"http://10.228.51.220:3000/login/generic_oauth",
                               $"http://localhost:12415/signin-oidc",
                               $"http://10.228.51.220:3000",
                               $"http://10.228.51.220:3000/login"},
     AllowedScopes = new [] {
             IdentityServerConstants.StandardScopes.OpenId,
             IdentityServerConstants.StandardScopes.Profile,
             IdentityServerConstants.StandardScopes.Email,
             "agentservice", "clientservice", "productservice"
     },
     AllowAccessTokensViaBrowser = true // can return access_token to this client

 },

Но это не может работать, если я использую Grafana click Oauth login. Это показывает

Извините, произошла ошибка:

unauthorized_client Id запроса: 0HLU6VUML3LN5: 00000002

I Установка RedirectUris, но она может ' это исправить. Что я могу это исправить?

...