Skip to content

Commit 59d6fa5

Browse files
Merge pull request #729 from johanlundberg/feature_registry_authority_policy
Specify policy configurations based on the registration authority This changeset is backwards compatible, but to get the new features (restrictions based on the registration authority) one needs to properly upgrade, by initializing the Policy object with a metadata store. Usage that involves loading the configuration through the `saml2.config.Config` object get this automatically (this includes, the `saml2.server.Server` (IdP) object and the `saml2.client_base.Base` and `saml2.client.Saml2Client` (SP) objects.)
2 parents 9dae13c + 2641019 commit 59d6fa5

14 files changed

+633
-471
lines changed

docs/howto/config.rst

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -517,28 +517,47 @@ policy
517517
""""""
518518

519519
If the server is an IdP and/or an AA, then there might be reasons to do things
520-
differently depending on who is asking; this is where that is specified.
521-
The keys are 'default' and SP entity identifiers. Default is used whenever
522-
there is no entry for a specific SP. The reasoning is also that if there is
523-
no default and only SP entity identifiers as keys, then the server will only
524-
accept connections from the specified SPs.
520+
differently depending on who is asking (which is the requesting service); the
521+
policy is where this behaviour is specified.
522+
523+
The keys are SP entity identifiers, Registration Authority names, or 'default'.
524+
First, the policy for the requesting service is looked up using the SP entityID.
525+
If no such policy is found, and if the SP metadata includes a Registration
526+
Authority then a policy for the registration authority is looked up using the
527+
Registration Authority name. If no policy is found, then the 'default' is looked
528+
up. If there is no default and only SP entity identifiers as keys, then the
529+
server will only accept connections from the specified SPs.
530+
525531
An example might be::
526532

527533
"service": {
528534
"idp": {
529535
"policy": {
530-
"default": {
531-
"lifetime": {"minutes":15},
532-
"attribute_restrictions": None, # means all I have
533-
"name_form": "urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
534-
},
536+
# a policy for a service
535537
"urn:mace:example.com:saml:roland:sp": {
536538
"lifetime": {"minutes": 5},
537539
"attribute_restrictions": {
538540
"givenName": None,
539541
"surName": None,
540-
}
541-
}
542+
},
543+
},
544+
545+
# a policy for a registration authority
546+
"http://www.swamid.se/": {
547+
"attribute_restrictions": {
548+
"givenName": None,
549+
},
550+
},
551+
552+
# the policy for all other services
553+
"default": {
554+
"lifetime": {"minutes":15},
555+
"attribute_restrictions": None, # means all I have
556+
"name_form": "urn:oasis:names:tc:SAML:2.0:attrname-format:uri",
557+
"entity_categories": [
558+
"edugain",
559+
],
560+
},
542561
}
543562
}
544563
}
@@ -561,6 +580,13 @@ An example might be::
561580
Using this information, the attribute name in the data source will be mapped to
562581
the friendly name, and the saml attribute name will be taken from the uri/oid
563582
defined in the attribute map.
583+
*nameid_format*
584+
Which nameid format that should be used. Defaults to
585+
`urn:oasis:names:tc:SAML:2.0:nameid-format:transient`.
586+
*entity_categories*
587+
Entity categories to apply.
588+
*sign*
589+
Possible choices: "response", "assertion", "on_demand"
564590

565591
If restrictions on values are deemed necessary, those are represented by
566592
regular expressions.::

0 commit comments

Comments
 (0)