Info |
---|
PSKnowHOW uses SAML for identity provider integration. |
Prerequisite
AUTH Provider IDP Side
Azure team will be set up SAML IDP configurations
Configuring SAML Single Sign-On (SSO)
Basic SAML Configuration’ section
Configure the User Attribute & Claims section and Adding custom roles
SAML-based Sign-on configuration
Setup API4Saml
Test SSO via azure
After that, you will get below Info From Azure Provider (below info it is Just sample credentials)
Azure Enterprise Application name: APIM4SAML
Unique Identifier (Entity ID): wso2apimv400
TenantID/Directory ID : j52c9ea1-7c21-47b1-82a3-33a74b1f9832 (Specific to the company) (update in below properties as auth.assertingEntityId)
SAML Single Sign-on Service URL: https://login.microsoftonline.com/a74f37bd-de4d-4eb1-954d-445a2ca2a6e8/saml2
SAML Entity ID (Reply URL Assertion Consumer Service URL): https://sts.windows.net/a74f37bd-de4d-4eb1-954d-445a2ca2a6e8/ (Specific To Project Level) (Updated in below properties as auth.holdingEntityId)
Sign-Out URL: https://login.microsoftonline.com/a74f37bd-de4d-4eb1-954d-445a2ca2a6e8/saml2
SAML signing certificate: APIM4SAML.cer(Base64 encoded certificate)
Alias: ps-ad (Specific to Company level)
Central AUTH Application Side
Set Saml required SAML properties
Related to SAML Info Needed To Update below details As per your credentials (for release Version Knowhow 9.0.0 to 9.5.0)
you have to Azure Saml parameter Mapping to auth application.properties file field like this
TenantId map to auth.assertingEntityId
SAML Entity ID map to auth.holdingEntityId
Alias map to auth.alias
SAML Entity ID map to appId in auth.samlLoginUrl
Code Block #NeededToUpdate : Saml info update Start auth.holdingEntityId=spn:a74f37bd-de4d-4eb1-954d-445a2ca2a6e8 auth.assertingEntityId=https://sts.windows.net/j52c9ea1-7c21-47b1-82a3-33a74b1f9832/ auth.alias=ps-ad auth.samlLoginUrl=https://login.microsoftonline.com/j52c9ea1-7c21-47b1-82a3-33a74b1f9832/federationmetadata/2007-06/federationmetadata.xml?appid=a74f37bd-de4d-4eb1-954d-445a2ca2a6e8 #NeededToUpdate : Saml info update End
Related to SAML 2 Code - Same As Per Mention in Properties
Code Block spring.security.saml2.serviceProvider.alias=${auth.alias} spring.security.saml2.serviceProvider.signMetadata=false spring.security.saml2.serviceProvider.signRequests=false spring.security.saml2.serviceProvider.encryptAssertions=false spring.security.saml2.serviceProvider.singleLogoutEnabled=true spring.security.saml2.serviceProvider.wantAssertionsSigned=true spring.security.saml2.serviceProvider.entityId=${auth.holdingEntityId} spring.security.saml2.serviceProvider.basePath=${auth.baseUrl}${server.servlet.context-path} spring.security.saml2.serviceProvider.nameIds=urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress spring.security.saml2.serviceProvider.keys.active.name=sp-signing-key-1 spring.security.saml2.serviceProvider.providers[0].alias=${auth.alias} spring.security.saml2.serviceProvider.providers[0].skipSslValidation=true spring.security.saml2.serviceProvider.providers[0].metadata=${auth.samlLoginUrl} spring.security.saml2.serviceProvider.providers[0].authenticationRequestBinding=urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST auth.samlMaxAuthenticationAgeMillis=604800000 auth.nameId=urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress auth.logoutEmailQueryParam=email auth.loginCallback=${auth.baseUrl}${server.servlet.context-path}/saml/sp/discovery?idp=${auth.assertingEntityId} auth.logoutCallback=${auth.baseUrl}${server.servlet.context-path}/saml/sp/logout?${auth.logoutEmailQueryParam}=%s auth.defaultRedirectToAfterLogout=${auth.baseUrl}${server.servlet.context-path}/hello auth.defaultRedirectToAfterLogin=${auth.baseUiUrl}/login/status auth.loginSuccessPageFormat=${auth.baseUiUrl}/status?authToken=%s
...
Used Below SAML Dependency in Project
Code Block |
---|
<dependency>
<groupId>org.springframework.security.extensions</groupId>
<artifactId>spring-security-saml2-core</artifactId>
<version>2.0.0.M31</version>
</dependency>
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>opensaml-saml-impl</artifactId>
<version>3.2.0</version>
</dependency> |
...
SAML login From UI - it will redirect to Microsoft login page and validate Username/Password internally and give response mention URL endpoint as per properties file and return call back URL
...
Parse SAML XML response
...
If you are Using release Version Knowhow 10.0.0 Onwards you have to use
Saml Mapping to auth application.yml file
SAML Entity ID map to entity-id
TenantId and SAML Entity ID Map to MetaDataUrl
Code Block https://login.microsoftonline.com/{tenant-id}/federationmetadata/2007-06/federationmetadata.xml?appid={your-Entity ID}
Code Block |
---|
security:
filter:
dispatcher-types: async, error, request, forward
saml2:
relyingparty:
registration:
azure:
acs:
location: '{baseUrl}/saml/SSO'
assertingparty:
metadata-uri: =https://login.microsoftonline.com/j52c9ea1-7c21-47b1-82a3-33a74b1f9832/federationmetadata/2007-06/federationmetadata.xml?appid=a74f37bd-de4d-4eb1-954d-445a2ca2a6e8
entity-id: spn:a74f37bd-de4d-4eb1-954d-445a2ca2a6e8
singlelogout:
binding: POST
responseUrl: '{baseUrl}/saml/SingleLogout'
url: '{baseUrl}/saml/logout' |