Skip to content

Commit

Permalink
Minor cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenmacdonald committed May 21, 2015
1 parent 6dd5024 commit 02ab628
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
13 changes: 4 additions & 9 deletions social/backends/saml.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ def sso_url(self):
""" Get the SSO URL for this IdP """
return self.conf['url'] # Required. e.g. "https://idp.testshib.org/idp/profile/SAML2/Redirect/SSO"

@property
def sso_binding(self):
""" Get the method used to submit our request to the SSO URL """
return self.conf.get('binding', 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect')

@property
def x509cert(self):
""" X.509 Public Key Certificate for this IdP """
Expand All @@ -91,7 +86,7 @@ def saml_config_dict(self):
"entityId": self.entity_id,
"singleSignOnService": {
"url": self.sso_url,
"binding": self.sso_binding,
"binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect", # python-saml only supports Redirect
},
"x509cert": self.x509cert,
}
Expand Down Expand Up @@ -174,7 +169,7 @@ def generate_saml_config(self, idp):
"sp": {
"assertionConsumerService": {
"url": abs_completion_url,
"binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST",
"binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST", # python-saml only supports HTTP-POST
},
"entityId": self.setting("SP_ENTITY_ID"),
"NameIDFormats": self.setting("SP_NAMEID_FORMATS", []),
Expand Down Expand Up @@ -231,8 +226,8 @@ def auth_url(self):
idp_name = self.strategy.request_data()['idp']
auth = self._create_saml_auth(idp=self.get_idp(idp_name))
# Below, return_to sets the RelayState, which can contain arbitrary data.
# We use it to store the specific SAML IdP backend name, since we combine
# many backends to a single URL.
# We use it to store the specific SAML IdP name, since we multiple IdPs
# share the same auth_complete URL.
return auth.login(return_to=idp_name)

def get_user_details(self, response):
Expand Down
5 changes: 1 addition & 4 deletions social/tests/backends/data/saml_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
},
"other": {
"entity_id": "https://unused.saml.example.com",
"singleSignOnService": {
"url": "https://unused.saml.example.com/SAML2/Redirect/SSO",
"binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
}
"url": "https://unused.saml.example.com/SAML2/Redirect/SSO"
}
}
}

0 comments on commit 02ab628

Please sign in to comment.