RS Authentication Server

OpenID Connect discovery document

https://identityserver4.readthedocs.io/en/latest/endpoints/authorize.html


Nuget packages

Authentication provide 3 nuget packages.

  • RSServices.Authentication.Middleware
  • RSServices.Authentication.Abstractions
  • RSServices.Authentication.Middleware.NServiceBus


RSServices.Authentication.Middleware

This packages provide easy setup of Authentication for .NET Core WebApp

In Startup.cs

public void ConfigureServices(IServiceCollection services) { ... services.AddRSAuthentication(Configuration) //Customize default login providers. Support values from ExternalIdentityProviders and LocalProvider .SetDefaultLoginProviders(ExternalIdentityProviders.NorwegianBankIdMobile, LocalProvider.Orgsys) //Optional to customize loginproviders on Controller level .SetLoginProvidersFor<SupportController>(ExternalIdentityProviders.AzureAd); ... } public void Configure(IApplicationBuilder app) { ... app.UseForwardedHeaders(); //Use RS Authentication app.UseRSAuthentication(); //to use [Authorize] app.UseAuthorization(); ... }

AddRSAuthentication(Configuration) configure authentication with values from appsettings.json.

RSAuthentication use Redis as TicketStore and DataProtection, so redis connectionstring is needed in ConnectionStrings section

appsettings.json format

{ "AppName": "YourApplicationName", "Environment": "Test", //UAT,Prod "Authentication": { "ClientId": "YourClientId", "AuthorityUrl": "https://test-authentication.rsservices.rs.no" }, "ConnectionStrings": { "Redis": "redisconnectionstring" } }

Available environments

Contact RSServices team before to get your own clientId


RSServices.Authentication.Abstractions

This package have IPrincipalAccessor to get information of the authenticated user

IPrincipalAccessor.GetPersonId() to get the current loggedIn person id. This can be used to get the logged in Person from RSServices.Person

IPrincipalAccessor.GetAuditPerson() to get the info on who is the current user and who the person has impersonated into.


RSServices.Authentication.Middleware.NServiceBus

Provide IPrincipalAccessor information into NServiceBus messages

BankId test users

Information on ordering new test users can be found here: https://docs.idfy.io/eid-providers/norwegian-bankid

All test users have the same OTP (one time password) and password.
OTP: otp
Password: qwer1234

SSN Lastname Firstname
01025900290LUNDERRIGMOR
01027000289NISSENDAGNY

Orgsys test users

Log in to Orgsys test client, and create a new user. Then trigger export to Staging. The new user will be added on next import

Otherwise, ask for a test user