locked
Building Interactive Client application(Asp.Net core MVC) with Identity Server 4.0 RRS feed

  • Question

  • User1617707200 posted

    Hi,

    I have a requirement where I want to pass client details like clientid, client secret to identity server through an input form. User should be able to test multiple client applications by passing respective information through MVC view. We have developed Identity server 4 application and hosted it in Azure. now to test that we have also developed ASP.net core MVC client application but currently the client values are hardcoded in the startup.cs file services.AddAuthentication(options => ...).AddOpenIdConnect("oidc", options => {... }) method. 

    I want these values to be passed through input form(view). How can I achieve this? I have defined a model class for the view and passing the input values to the controller action on button click. But I am stuck at passing those values further to startup class method to send it to IDS to get access token.

    any solution/suggestions will be appreciated! Please help.

    Thanks in Advance

     

    Tuesday, December 15, 2020 4:13 PM

All replies

  • User475983607 posted

    Mayurib

    I have a requirement where I want to pass client details like clientid, client secret to identity server through an input form. User should be able to test multiple client applications by passing respective information through MVC view. We have developed Identity server 4 application and hosted it in Azure. now to test that we have also developed ASP.net core MVC client application but currently the client values are hardcoded in the startup.cs file services.AddAuthentication(options => ...).AddOpenIdConnect("oidc", options => {... }) method.

    You forgot to explain the subject.  I'll assume you are building an OAuth/OIDC client registration system then the client configuration must be saved in a data store.  The IdentityServer4 documentation illustrates how to store configuration in a database.  

    https://identityserver4.readthedocs.io/en/latest/quickstarts/5_entityframework.html

    Mayurib

    I want these values to be passed through input form(view). How can I achieve this? I have defined a model class for the view and passing the input values to the controller action on button click. But I am stuck at passing those values further to startup class method to send it to IDS to get access token.

    It is up to you to design and write an user interface for registering client applications.  IdnetityServer4 has templates but I'm not sure if they supply free templates for your needs.  https://github.com/IdentityServer

    Tuesday, December 15, 2020 5:20 PM
  • User1617707200 posted

    Yes. We have already built an application with openid-OIDC where we can do client registration and that system is saving client details to SQL database. But further that after the registering clients through this application now we want to test those registered clients with IDS through a client application which is also created as ASP.NEt Core MVC application. But currently this test client application runs on hardcoded client details meaning it tests only one client everytime we run the client app. Now I want to make this configurable. I want to pass the client registration details like clientid, secret key scope etc through a mvc form. form will have input fields and will pass that data to startup class for running openidconnect authentication request

    any suggestions?

    Tuesday, December 15, 2020 8:42 PM
  • User475983607 posted

    But currently this test client application runs on hardcoded client details meaning it tests only one client everytime we run the client app.

    Are you asking how to build a test that loops over client configuration and tests each login?

    Now I want to make this configurable. I want to pass the client registration details like clientid, secret key scope etc through a mvc form.

    The link I provided above explains how to Use EntityFramework Core for configuration and operational data. The startup file reads the configuration stored in the database when the application starts.

    Wednesday, December 16, 2020 12:49 AM