File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 2929from authentik .providers .saml .processors .assertion import AssertionProcessor
3030from authentik .providers .saml .processors .authn_request_parser import AuthNRequestParser
3131from authentik .sources .saml .exceptions import MismatchedRequestID
32- from authentik .sources .saml .models import SAMLSource
32+ from authentik .sources .saml .models import SAMLBindingTypes , SAMLSource
3333from authentik .sources .saml .processors .request import SESSION_KEY_REQUEST_ID , RequestProcessor
3434from authentik .sources .saml .processors .response import ResponseProcessor
3535
@@ -104,6 +104,7 @@ def setUp(self):
104104 signing_kp = self .cert ,
105105 verification_kp = self .cert ,
106106 signed_assertion = True ,
107+ binding_type = SAMLBindingTypes .POST ,
107108 )
108109
109110 def test_signed_valid (self ):
Original file line number Diff line number Diff line change 1212from authentik .providers .saml .models import SAMLPropertyMapping , SAMLProvider
1313from authentik .providers .saml .processors .assertion import AssertionProcessor
1414from authentik .providers .saml .processors .authn_request_parser import AuthNRequestParser
15- from authentik .sources .saml .models import SAMLSource
15+ from authentik .sources .saml .models import SAMLBindingTypes , SAMLSource
1616from authentik .sources .saml .processors .request import RequestProcessor
1717
1818
@@ -35,6 +35,7 @@ def setUp(self):
3535 issuer = "authentik" ,
3636 signing_kp = cert ,
3737 pre_authentication_flow = create_test_flow (),
38+ binding_type = SAMLBindingTypes .POST ,
3839 )
3940 self .request_factory = RequestFactory ()
4041
Original file line number Diff line number Diff line change 2020from authentik .providers .saml .utils import get_random_id
2121from authentik .providers .saml .utils .encoding import deflate_and_base64_encode
2222from authentik .providers .saml .utils .time import get_time_string
23- from authentik .sources .saml .models import SAMLSource
23+ from authentik .sources .saml .models import SAMLBindingTypes , SAMLSource
2424
2525SESSION_KEY_REQUEST_ID = "authentik/sources/saml/request_id"
2626
@@ -70,7 +70,7 @@ def get_auth_n(self) -> Element:
7070 # Create issuer object
7171 auth_n_request .append (self .get_issuer ())
7272
73- if self .source .signing_kp :
73+ if self .source .signing_kp and self . source . binding_type != SAMLBindingTypes . REDIRECT :
7474 sign_algorithm_transform = SIGN_ALGORITHM_TRANSFORM_MAP .get (
7575 self .source .signature_algorithm , xmlsec .constants .TransformRsaSha1
7676 )
@@ -91,7 +91,7 @@ def build_auth_n(self) -> str:
9191 (used for POST Bindings)"""
9292 auth_n_request = self .get_auth_n ()
9393
94- if self .source .signing_kp :
94+ if self .source .signing_kp and self . source . binding_type != SAMLBindingTypes . REDIRECT :
9595 xmlsec .tree .add_ids (auth_n_request , ["ID" ])
9696
9797 ctx = xmlsec .SignatureContext ()
You can’t perform that action at this time.
0 commit comments