Search Results :

×

ASP.NET OAuth Single Sign-On (SSO) Using AWS Cognito As OAuth Provider


ASP.NET OAuth Single Sign-On (SSO) module gives the ability to enable OAuth Single Sign-On for your ASP.NET applications. Using Single Sign-On you can use only one password to access your ASP.NET application and services. Our module is compatible with all the OAuth compliant Identity providers. Here we will go through a step-by-step guide to configure Single Sign-On (SSO) between ASP.NET and AWS Cognito considering AWS Cognito as OAuth provider.

Download And Extract Package

  • Download miniOrange ASP.NET OAuth 2.0 Module.
  • For Setting up the connector, extract the asp-net-oauth-sso-module.zip, you will find a DLL file miniorange-oauth-sso.dll, a configuration file oauthsso.config and a integration.md file which contain the steps for adding the module into your application.

1. Add the connector in your application

  • Add miniorange-oauth-sso.dll in bin folder (where your other DLL files exists) for your application.
  • Register miniorangeoauthsso module in your application according to the provided steps in the integration.md file.
  • Add the provided configuration file oauthsso.config in the root directory for your application.
  • After integration open browser and browse the connector dashboard with URL below:
    https:// <your-application-base-url>/?ssoaction=config
  • If it pop up the registration page or login page, you have successfully added the miniOrange oauth sso connector for your application.
  • ASP.NET AWS Cognito OAuth SSO - register with miniorange
  • Register or Login for configuring the connector.

2. Setup Amazon Cognito as OAuth Provider

  • First of all, go to Amazon Console and sign up/login in your account to Configure AWS Cognito.
  • ASP.NET AWS Cognito OAuth SSO - Login to Amazon Console
  • Search for Cognito in the AWS Services search bar as shown below.
  • ASP.NET AWS Cognito OAuth SSO - Search for AWS Cognito
  • Click on Mange User Pools button to see the list of your user pools.
  • ASP.NET AWS Cognito OAuth SSO - AWS Cognito User Pools
  • Click on Create a user pool to create a new user pool.
  • ASP.NET AWS Cognito OAuth SSO - Create New AWS Cognito Pool
  • Add a Pool Name and click on the Review Defaults button to continue.
  • ASP.NET AWS Cognito OAuth SSO - Name your AWS Cognito User Pool
  • Scroll down and click on the Add App Client option in front of App Clients.
  • ASP.NET AWS Cognito OAuth SSO - AWS Cognito App Client
  • Click on Add an App Client. Enter an App Client Name and click on Create app client to create an App client.
  • ASP.NET AWS Cognito OAuth SSO - Create App Client
  • Click on Return to Pool Details to come back to your configuration.
  • ASP.NET AWS Cognito OAuth SSO - Configure AWS Cognito Pool
  • Click on Create Pool button to save your settings and create a user pool.
  • ASP.NET AWS Cognito OAuth SSO - Save AWS Cognito Pool
  • In the navigation bar present on the left side, click on the App Client Settings option under the App Integration menu.
  • ASP.NET AWS Cognito OAuth SSO - AWS Cognito App Details
  • Enable Identity provider as Cognito user pool and enter your Callback/Redirect URL which you will get from miniOrange ASP.NET OAuth Client under the CallBack URLs text-field. Select Authorization code grant checkbox under the Allowed OAuth Flows and also select openid and profile checkboxes under the Allowed OAuth Scopes option (Please refer to the image below). Click on the Save Changes button to save your configurations.
  • ASP.NET AWS Cognito OAuth SSO - Configure AWS Cognito App Client
  • Click on Choose Domain Name option to set a domain name for your app.
  • ASP.NET AWS Cognito OAuth SSO - AWS Cognito Domain Names
  • Enter your Domain Name under the Domain Prefix text-field and click on the Save Changes button to save your domain name.
  • ASP.NET AWS Cognito OAuth SSO - Configure AWS Cognito Domain Name
  • Click on App Clients option under the General Settings menu in the left side navigation bar. Then, click on the Show Details button to see your App details like Client ID, Client secret etc.
  • ASP.NET AWS Cognito OAuth SSO - AWS Cognito App Client Details
  • Copy the Client App ID and Client App Secret text field values which you will require in Step 3 to configure miniOrange ASP.NET OAuth Client.
  • ASP.NET AWS Cognito OAuth SSO - AWS Cognito App Client Configuration
  • Click on Users and groups option under the General Settings menu in the left side navigation bar. Then, click on the Create user button to add a new user.
  • ASP.NET AWS Cognito OAuth SSO - AWS Cognito App New User Creation
  • Fill all the required details and click on Create user.
  • ASP.NET AWS Cognito OAuth SSO - AWS Cognito App Client Configuration
  • You can see the new user created.
  • ASP.NET AWS Cognito OAuth SSO - AWS Cognito App Client Configuration

    AWS Cognito Endpoints and Scope:


    Client ID : Click Here
    Client Secret : Click Here
    Scope: openid
    Authorize Endpoint: https://<cognito-app-domain>/oauth2/authorize
    Access Token Endpoint: https://<cognito-app-domain>/oauth2/token
    Get User Info Endpoint: https://<cognito-app-domain>/oauth2/userInfo
    Custom redirect URL after logout:[optional] https://<cognito-app-domain>/logout?client_id=<Client-ID>&logout_uri=<Sign out URL configured in Cognito Portal>

3. Configure miniOrange ASP.NET OAuth Client

  • After configuring your OAuth Provider, it will provide you with Client ID, Client Secret, Authorize Endpoint, Access Token Endpoint and Get User Info Endpoint. Configure these values under respective fields.
  • Fill all the required details and click on Save Configuration.
  • ASP.NET AWS Cognito OAuth SSO - save configuration

4. Test Configuration

  • After saving configuration, click on the Test Configuration button to verify if you have configured correctly.
  • On successful configuration, you will get Attributes Name and Attribute Values on Test Configuration window. The below screenshot shows a successful result.
  • ASP.NET AWS Cognito OAuth SSO - test configuration

5. Attribute Mapping

  • Map Attribute Names provided by your OAuth Server with your ASP.NET application Attributes given under Attribute Mapping Section and click on Save Attribute Mapping.
  • ASP.NET AWS Cognito OAuth SSO - attribute mapping
  • Note: All the mapped attributes will be stored in the session so that you can access them in your application.

6. Integration Code

  • You can find the integration code in Integration Code tab in the connector. Just copy-paste that code snippet wherever you want to access the user attributes.
  • ASP.NET AWS Cognito OAuth SSO - integration code

7. Add following link in your application for Single Sign-On (SSO)

  • Use the following URL as a link in your application from where you want to perform SSO:
    http://base-url/?ssoaction=login
  • For example you can use it as:
    <a href="http://base-url/?ssoaction=login”>Log in</a>"

    You can configure the ASP.NET SAML 2.0 Single Sign-On (SSO) module with any Identity Provider such as ADFS, Azure AD, Bitium, Centrify, G Suite, JBoss Keycloak, Okta, OneLogin, Salesforce, AWS Cognito, OpenAM, Oracle, PingFederate, PingOne, RSA SecureID, Shibboleth-2, Shibboleth-3, SimpleSAML, WSO2 or even with your own custom identity provider.

Application LINK
SAML SSO into DotNetNuke (DNN) site Click here
SAML SSO into SiteFinity site Click here
SAML SSO into Umbraco site Click here
Hello there!

Need Help? We are right here!

support
Contact miniOrange Support
success

Thanks for your inquiry.

If you dont hear from us within 24 hours, please feel free to send a follow up email to info@xecurify.com