@@ -193,7 +193,7 @@ def service_urls(self, binding=BINDING_HTTP_POST):
193
193
194
194
def create_authn_request (self , destination , vorg = "" , scoping = None ,
195
195
binding = saml2 .BINDING_HTTP_POST ,
196
- nameid_format = NAMEID_FORMAT_TRANSIENT ,
196
+ nameid_format = None ,
197
197
service_url_binding = None , message_id = 0 ,
198
198
consent = None , extensions = None , sign = None ,
199
199
allow_create = False , sign_prepare = False , ** kwargs ):
@@ -261,13 +261,19 @@ def create_authn_request(self, destination, vorg="", scoping=None,
261
261
else :
262
262
allow_create = "false"
263
263
264
- # Profile stuff, should be configurable
265
- if nameid_format is None :
266
- name_id_policy = samlp .NameIDPolicy (
267
- allow_create = allow_create , format = NAMEID_FORMAT_TRANSIENT )
268
- elif nameid_format == "" :
264
+ if nameid_format == "" :
269
265
name_id_policy = None
270
266
else :
267
+ if nameid_format is None :
268
+ nameid_format = self .config .getattr ("name_id_format" , "sp" )
269
+
270
+ if nameid_format is None :
271
+ nameid_format = NAMEID_FORMAT_TRANSIENT
272
+ elif isinstance (nameid_format , list ):
273
+ # NameIDPolicy can only have one format specified
274
+ nameid_format = nameid_format [0 ]
275
+
276
+
271
277
name_id_policy = samlp .NameIDPolicy (allow_create = allow_create ,
272
278
format = nameid_format )
273
279
0 commit comments