Generate token from SAML assertion - reactjs

I have this repo: https://github.com/oktadeveloper/okta-spring-boot-saml-example . After user login in identity provider(okta, azure AD,...), user can access website.
Flow is:
website request SAML assertion
user login with user and password
identity provider return SAML assertion
server make a post request to /saml/sso with SAML assertion to do authentication
But I have a question: how i get SAML assertion from ReactJS and send SAML assertion to springboot to get access token.
Thanks you for your reading!

the SAML bearer assertion flow of OAuth does help in fetching an OAuth token (access-token) using a SAML Assertion as described here: https://learn.microsoft.com/en-us/azure/active-directory/develop/scenario-token-exchange-saml-oauth

After some brain storm,
I use spring mvc to create a page: server.com/sso, Angular will re-direct to server.com/sso, after user provide credentials to microsoft AD, I will generate token from information in SAML assertion, then send it to Angular by re-direct.
Thanks.

Related

Duende IdentityServer 5.0 - Sign in user after SAML Authentication (from Users IDP)

We have :
Our own IDP --> Duende Identity Server (5.0)
MVC Client that users log into after they are authenticated by our IDP (above)
External Client that wants to have SSO to our MVC Client so will send is a SAML Assertion (IDP initiated SAML ) we user ITfoxtec as a SAML processing library
Once we verify and validate the SAML Assertion and the user, how do we sign in the user to our IDP (Duende Identity Server)
context.SignInAsync(new IdentityServerUser, Auth props);
will this create a new Token and session for the external client user on our IDP
If we re-direct the new user to our MVC application will it be able to tell that the user is indeed Authenticated.
Do we need to specify an Authentication scheme when signing in the user to our Duende IDP ?
context.SignInAsync(AuthenticationScheme scheme, IdentityServerUser user);
Is this correct?
One key requirement is we need to have an Access token that the MVC Client App used for many other needs (Access to other features)

Missing InResponseTo SAML attribute in SP initiated Okta sign on

I am trying to add a new service to an existing Okta setup. The service relies on SAML for authentication and uses strict checking of SAML messages.
When Okta session state is already present in the browser, everything works fine. Okta SAML response contains all the necessary attributes to get verified and everything just works.
However, when using a "clean" browser to initiate a new session, my service can not properly validate the Okta SAML response. The response is valid and properly signed, but is missing the InResponseTo attribute which is required for strict verification.
I wonder if somebody may have encountered an issue like that before? May there be some hidden setting in Okta or some common setup mistake in the authentication provider?
Your service is complaining about the sequence of steps you use to initiate the SSO flow. In a so-called service provider-initiated SSO flow, you click on a link that goes to your service. Your service acting as a SAML service provider (SP) then sends a SAML authentication request to the identity provider (Okta) which then responds to this request with a SAML response. Since the identity provider is responding to the request from a service provider, the SAML response will contain an InResponseTo element.
How do you fix this? This is all about your service rather than Okta. You need to determine the correct URL and/or format of the request to your service that will cause it to fire a SAML authentication request to the identity provider.
See Okta docs for more info

Using salesforce as saml 2.0 idp provider

I am trying to configure salesforce as idp for my saml2.0 based sp. I have enabled domain, sso, created connected app with appropriate profile. with all this I am able to login into sp using using idp initiated url. idp initiated salesforce url correctly, my sp gets correct saml response. but when I try to use sp initiated flow and post saml request to salesforce endpoint, it give error "Insufficient Privileges". Have anyone faced this issue or knows something about this?
I was able to solve this issue. Apparently salesforce doesn't give what is the error. Here I was using redirect request sending to post url.

How IDP connects to End point application in SSO?

This is the 1st time I am working in SSO with SAML.And we are going to use the HTTP Post method and the IDP is salesforce. I got below Steps from net.
User accesses a custom application for the first time
Service Provider Security Filter checks if the security context is available
and redirects the user to IDP with a SAML SSO request
IDP challenges the user with the authentication dialog and redirects the user to
Request Assertion Consumer Service (RACS) after the user has authenticated
RACS validates the response from IDP, establishes a security context and redirects the user
to the original application endpoint
Service Provider Security Filter enforces that a valid security context is available and lets the user access the custom application.
Here my Question is IDP needs to authenticate application endpoint. Here the SAML plays between common web page to IDP to initiate SAML request/response. Then how the IDP connect to endpoint? Is that follow any other language to connect and authenticate endpoint? else how it connects? Could you please someone explain the concept?
During configuration of SAML at your Identity Provider, you define an AssertionConsumer endpoint, which is an URL at your application where you expect to receive response from the IDP. After authentication, IDP connects to this endpoint by sending a SAML Response message to it. IDP typically authenticates to the endpoint by digitally signing the SAML message, which you then verify for validity and trust.
The ways of sending SAML messages between IDP and SP (= connecting IDP to the endpoint) are called bindings. Bindings define how exactly to use existing protocols (such as HTTP) to deliver SAML messages, i.e. it tells what parameters should be sent, which HTTP method should be used... Bindings are part of the SAML 2.0 standard and you can find details on how they function in the SAML 2.0 specification.
The IDP does not directly communicate with the original URL within your application (i.e. the "original application endpoint"). The process of sending user to the correct destination after successful verification of the SAML Response (received at the Assertion Consumer endpoint) can be fully determined by you. For example, in case Assertion Consumer endpoint and the "original application endpoint" are part of the same application and share the security context, you can simply send an HTTP redirect, without need for SAML in this "last mile".

Reading the SAML token response objects using openAM?

I have a saml2.0 response token from IDP and I am using OpenAM as a Service provider. I want to read the SAML using openAM Java api and validate the response. Any help is appreciated. Thanks in advance.
You don't have to do anything manual, if OpenAM is the SP it will consume the SAML assertions from the IdP just fine.

Resources