Sending Custom Parameters to Login Page #909
Comments
Apologies if the question is trivial for this my first attempt to extend the framework. My intention is that the custom parameter will not be part of the returnUrl but will be a propagated as a separate parameter to the Login action in the Account Controller so that it will like this: Is this possible within the current extensibility of the framework? |
who sends the company ID parameter? the client? |
Yes. The client. |
Right - and the technique I showed you let's you retrieve that from the login page. |
So you do suggest to pass the custom parameter to the Login Page as part of the returnUrl parameter, right? |
You pass the custom parameter to the authorize endpoint. We take care of making it available on the login page. |
I perfectly understand that custom parameter should be sent to the Authorize Endpoint as described in the opening post of this issue:
Question was how to read it in the login page. Based on your instructions I now read it from the returnUrl like this: |
yep. that's correct. |
Sorry for opening this thread, but how would accomplish this exact same task, however using ResourceOwner flow? Thanks! Update For anyone that also needs to do this, its actually pretty simple:
|
by putting extra parameters in the post body. |
@leastprivilege haha thanks I just found out! |
Sorry to reopen this thread again. I need to pass a token parameter to the account/login where the AccountController will talk to a 3rd party Legacy IdP to validate that token and retrieve the user info to do the login in the IS4. I can't let that token shown in the QueryString so the browser history can show it. OpenIdConnectOptions has the However, the account/login callback is done by GET with the redirecturl QueryString parameter which contains my token that I don't want to show in the URL. That account/login will call back the Authorize request: /connect/authorize in GET even it has the I check the codes the account/login is in the CookieMiddelWare where it uses the UseCookieAuthentication, but there is no way to change the CookieAuthenticationOptions to handle the Is it possible to make the account/login and Authorize request in POST? |
no. not right now. |
Please open a separate feature request issue describing the requirements. |
Hi @Haleni888 and the rest!!
And in the Login I have this: But customer_Name is always null. Also I still cannot find how to assign values to acr_values, so any help will be appreciated!!! |
Hi @mrnewrochelle, To send a parameter from MVC hybrid client, I have used the following code as part of the OpenId Connect middleware initialization (.net core 1.x, this method is obsolete in 2.x): app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{
// other middleware initialization code omitted for brevity
Events = new OpenIdConnectEvents
{
OnRedirectToIdentityProvider = (ctx) =>
{
ctx.ProtocolMessage.Parameters.Add("customer-name", "John Doe");
return TaskCache.CompletedTask;
}
}
}); Hope that helps. |
Thanks @Haleni888 Yes, I am looking how to do that exact thing in Core 2.0, so far documentation is not enough for Core 2.0, and all that I found is for Core 1.x. |
I found the problem, I was doing everything with asp.net Core 2.0 Razor Pages, and I move everything to a Controller, and now it works perfectly. Thanks all! |
Hi, Thank you all. This thread was very helpful and solved my queries on MVC client. I would like to know how could same can be achieved in JS/Angular (OIDC-Client) to pass additional parameters? |
You can use the aspnetcore1 branch instead of release branch. |
Hi, |
hi all , Actually to be more clear, the client will send different values to the identity server according to different click, so for example lets us say that the angular app is like a dashboard with buttons to be clicked to go to different applications and when the user click on a given button we will send different value using a given parameter like (AppId) and at the server in the login action : we will get the parameters from the return url in this way. many thanks. |
@Haleni888 @leastprivilege Can you please help I'm also looking for the same. |
This URL mentioned above by @leastprivilege is not working: It would be cool if you can fix it. Btw. There are many invalid URL-s in the current IntentityServer v4 documentation. It could be a generic issue? Thanks |
Well - things change over time. I think you could work this one out yourself. if you find any dead links, please open an issue - or a PR if you can fix it yourself. |
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. |
Following issue #76
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?
The text was updated successfully, but these errors were encountered: