IdentityServer4 icon indicating copy to clipboard operation
IdentityServer4 copied to clipboard

Extend LocalAuthenticationContext

Open avoxm opened this issue 10 years ago • 9 comments

To login a user aside from username and password I need additional parameter like company id. So I have decided to make a custom login service and implement AuthenticateLocalAsync. However the problem is that LocalAuthenticationContext does not allow to pass custom parameters. So is there a way to pass additional data to AuthenticateLocalAsync ?

avoxm avatar Apr 17 '16 02:04 avoxm

There is no AuthenticateLocalAsync anymore. Do whatever you need to authenticate a user - but you do it yourself.

leastprivilege avatar Apr 17 '16 14:04 leastprivilege

Interesting. Could you please point me to the direction where to look for this. What should be used instead of AuthenticateLocalAsync now ?

avoxm avatar Apr 17 '16 14:04 avoxm

Just have a look at the host project and follow the code path on the login page.

leastprivilege avatar Apr 17 '16 14:04 leastprivilege

Am I right that in IdentityServer4 the UI is completely decoupled from the library, and we always need to copy-paste from the sample project?

tibitoth avatar Apr 17 '16 17:04 tibitoth

You are right about the decoupling - but our plan is to provide the standard UI as a nuget package.

leastprivilege avatar Apr 18 '16 07:04 leastprivilege

Thanks @leastprivilege it looks like this approach simplifies the integration a lot. Am I right to conclude that IdentityServer4 doesn't really care about how you validate the credentials and what is the database structure. As long as you populate claims and pass it in ClaimsPrincipal it will know all it needs to know.

avoxm avatar Apr 18 '16 19:04 avoxm

Yes you are right.

leastprivilege avatar Apr 19 '16 07:04 leastprivilege

Could you please elaborate on what needs to be customized in identity server in order for the custom parameter (e.g.: company-id) to propagate from the client to the login page as a separate parameter?

The request will look like this: Authorize request: /connect/authorize?client_id=my-client&...&company-id=my-company Login Page request: /account/login?returnUrl=/connect/authorize/login?...&company-id=my-company

I see the redirect to the login page is done on LoginPageResult.ExecuteAsync. To add there a new custom query string parameter I guess i should provide an custom implementation for this class, right? How to inject this custom implementation?

kneerun avatar Mar 08 '17 15:03 kneerun

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 15 '20 00:01 lock[bot]