Created
April 12, 2017 19:13
-
-
Save serac/c6901baa833aaca5be0d3932f63103a9 to your computer and use it in GitHub Desktop.
VT LOA Attribute Definition for Shibboleth IdP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resolver:AttributeDefinition id="loa" xsi:type="ad:Script"> | |
<resolver:Dependency ref="personType" /> | |
<resolver:AttributeEncoder xsi:type="enc:SAML1String" name="urn:mace:vt.edu:ed:attribute-def:loa" /> | |
<resolver:AttributeEncoder xsi:type="enc:SAML2String" name="urn:mace:vt.edu:ed:attribute-def:loa" friendlyName="loa" /> | |
<ad:Script> | |
<![CDATA[ | |
sc = resolutionContext.getParent().getSubcontext("net.shibboleth.idp.session.context.SessionContext"); | |
if (sc != null && sc.getIdPSession() != null) { | |
it = sc.getIdPSession().getAuthenticationResults().iterator(); | |
while (it.hasNext() && loa.getValues().size() == 0) { | |
subject = it.next().getSubject(); | |
pit = subject.getPrincipals().iterator(); | |
attr = null; | |
while (pit.hasNext()) { | |
attr = pit.next(); | |
if (attr.getName().equals("http://id.incommon.org/assurance/silver")) { | |
loa.addValue("http://middleware.vt.edu/assurance/level_4"); | |
loa.addValue("http://id.incommon.org/assurance/silver"); | |
} | |
if (attr.getName().equals("http://id.incommon.org/assurance/bronze")) { | |
loa.addValue("http://middleware.vt.edu/assurance/level_2"); | |
loa.addValue("http://id.incommon.org/assurance/bronze"); | |
} | |
} | |
} | |
if (loa.getValues().size() == 0) { | |
if (personType.getValues().size() > 0 && personType.getValues().get(0).equals("Guest")) { | |
loa.addValue("http://middleware.vt.edu/assurance/level_1"); | |
} else { | |
loa.addValue("http://middleware.vt.edu/assurance/level_2"); | |
} | |
} | |
} | |
]]> | |
</ad:Script> | |
</resolver:AttributeDefinition> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment