Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IdentityServer4 IsValidReturnUrl returns false for valid url

I've a test project with this client configuration:

public class Clients : IClientStore
    {
        public Task<Client> FindClientByIdAsync(string clientId)
        {
            return Task.FromResult(new Client
            {
                ClientId = "client.webforms",
                ClientName = "WebForms Client",
                AllowedGrantTypes = GrantTypes.Hybrid,
                AllowAccessTokensViaBrowser = false,

                ClientSecrets =
                    {
                        new Secret("1234".Sha256())
                    },

                RedirectUris = { "http://localhost:9869/signin-oidc" },
                PostLogoutRedirectUris = { "http://localhost:9869/" },

                AllowedScopes =
                    {
                        IdentityServerConstants.StandardScopes.OpenId,
                        CstIdSrvScopeTypes.TestWebForms
                    },
                AllowOfflineAccess = false,
                RequireConsent = false,

                AlwaysIncludeUserClaimsInIdToken = true
            });
        }
    }

When I try to validate it in LoginController I'm getting false result (this is from Immediate Window:

returnUrl
"http://localhost:9869/signin-oidc"
this.identityServer.IsValidReturnUrl(returnUrl)
false

Also this.identityServer.GetAuthorizationContextAsync(returnUrl) result is null. Am I doing something wrong?

like image 701
dstr Avatar asked Apr 12 '17 10:04

dstr


1 Answers

Yes - you need to add a single RedirectUri when you configur your client that is one of the RedirectUris that is in the list you have above.

Something like #

app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
        {
            SignInAsAuthenticationType = Settings.AuthenticationType,
            Authority = config.Authority,
            RedirectUri = config.RedirectUri
        }
like image 138
monkeylumps Avatar answered Nov 05 '22 08:11

monkeylumps