Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Creating authorization code in PreAuthenticateSync causes too many redirect error #907

Closed
v-vairam opened this issue Feb 11, 2015 · 6 comments

Comments

@v-vairam
Copy link

Recieved following error when connecting from client using IMplicity: "has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer."

public virtual Task PreAuthenticateAsync(SignInMessage message)
{
var result = new AuthenticateResult("bob", "bob");
return Task.FromResult(result);
//return Task.FromResult(null);
}

@v-vairam
Copy link
Author

The Unit test path also does not validate this code path condition:
Thinktecture.IdentityServer.Tests.Validation.TestUserService

@brockallen
Copy link
Member

Is "bob" a matching subject identifier in the user store?

@v-vairam
Copy link
Author

yes, same as in InMemoryUser list from examples

@brockallen
Copy link
Member

That's your bug then -- the first param to the AuthenticateResult is the subject identifier. "bob" is just the username. That user's subject value is "88421113".

@brockallen
Copy link
Member

Did this fix it for you?

@v-vairam
Copy link
Author

this is what I have customized and actually it did not work without those additional claim types or the default InMemorUser construct. it worked without PreAuthenticateSync:
new InMemoryUser{Subject = "bob", Username = "bob", Password = "bob",
Claims = new Claim[]
{
new Claim(ClaimTypes.Name, "bob"),
new Claim(ClaimTypes.Upn, "[email protected]"),
new Claim(ClaimTypes.Email, "[email protected]"),
new Claim(ClaimTypes.GivenName, "Bob"),
new Claim(ClaimTypes.Expiration, UserService.ConvertDate(DateTime.Now.AddHours(1))),
new Claim(ClaimTypes.Surname, "Smith"),
}
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants