File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
TestWebAppCore/Controllers Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 88using System . Security . Claims ;
99using TestWebApp . Identity ;
1010using System . IdentityModel . Services ;
11+ using System . Security . Authentication ;
1112
1213namespace TestWebApp . Controllers
1314{
@@ -46,8 +47,12 @@ public ActionResult AssertionConsumerService()
4647 var binding = new Saml2PostBinding ( ) ;
4748 var saml2AuthnResponse = new Saml2AuthnResponse ( config ) ;
4849
50+ binding . ReadSamlResponse ( Request . ToGenericHttpRequest ( ) , saml2AuthnResponse ) ;
51+ if ( saml2AuthnResponse . Status != Saml2StatusCodes . Success )
52+ {
53+ throw new AuthenticationException ( $ "SAML Response status: { saml2AuthnResponse . Status } ") ;
54+ }
4955 binding . Unbind ( Request . ToGenericHttpRequest ( ) , saml2AuthnResponse ) ;
50-
5156 saml2AuthnResponse . CreateSession ( claimsAuthenticationManager : new DefaultClaimsAuthenticationManager ( ) ) ;
5257
5358 var relayStateQuery = binding . GetRelayStateQuery ( ) ;
Original file line number Diff line number Diff line change 99using Microsoft . AspNetCore . Mvc ;
1010using TestWebAppCore . Identity ;
1111using Microsoft . Extensions . Options ;
12+ using System . Security . Authentication ;
1213
1314namespace TestWebAppCore . Controllers
1415{
@@ -50,6 +51,11 @@ public async Task<IActionResult> AssertionConsumerService()
5051 var binding = new Saml2PostBinding ( ) ;
5152 var saml2AuthnResponse = new Saml2AuthnResponse ( config ) ;
5253
54+ binding . ReadSamlResponse ( Request . ToGenericHttpRequest ( ) , saml2AuthnResponse ) ;
55+ if ( saml2AuthnResponse . Status != Saml2StatusCodes . Success )
56+ {
57+ throw new AuthenticationException ( $ "SAML Response status: { saml2AuthnResponse . Status } ") ;
58+ }
5359 binding . Unbind ( Request . ToGenericHttpRequest ( ) , saml2AuthnResponse ) ;
5460 await saml2AuthnResponse . CreateSession ( HttpContext , claimsTransform : ( claimsPrincipal ) => ClaimsTransform . Transform ( claimsPrincipal ) ) ;
5561
You can’t perform that action at this time.
0 commit comments