Skip to content

Commit

Permalink
Bugfix for default name_id_policy (#57)
Browse files Browse the repository at this point in the history
Bugfix for default name_id_policy
  • Loading branch information
mjholtkamp authored Feb 3, 2020
1 parent aa0c564 commit 18f16fa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion djangosaml2idp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,12 @@ def get_authn(self, req_info=None):
def build_authn_response(self, user, authn, resp_args, processor: BaseProcessor, sp_config: dict):
""" pysaml2 server.Server.create_authn_response wrapper
"""
sp_config['name_id_format'] = resp_args.get('name_id_policy').format or NAMEID_FORMAT_UNSPECIFIED
policy = resp_args.get('name_id_policy', None)
if policy is None:
sp_config['name_id_format'] = NAMEID_FORMAT_UNSPECIFIED
else:
sp_config['name_id_format'] = policy.format

idp_name_id_format_list = self.IDP.config.getattr("name_id_format", "idp") or [NAMEID_FORMAT_UNSPECIFIED]

if sp_config['name_id_format'] not in idp_name_id_format_list:
Expand Down

0 comments on commit 18f16fa

Please sign in to comment.