Skip to content

Commit

Permalink
Manual approval of OpenConext#46
Browse files Browse the repository at this point in the history
Changed the for-loop to functional style.
  • Loading branch information
oharsta committed Aug 17, 2018
1 parent 540e98e commit 3ff7c9e
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions mujina-idp/src/main/java/mujina/idp/SsoController.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,12 @@ private void doSSO(HttpServletRequest request, HttpServletResponse response, Aut

String assertionConsumerServiceURL = idpConfiguration.getAcsEndpoint() != null ? idpConfiguration.getAcsEndpoint() : authnRequest.getAssertionConsumerServiceURL();

String nameIdType = NameIDType.UNSPECIFIED;
List<SAMLAttribute> attributes = attributes(authentication.getName());
for (SAMLAttribute attr : attributes) {
if ("urn:oasis:names:tc:SAML:1.1:nameid-format".equals(attr.getName())) {
nameIdType = attr.getValue();
break;
}
}

SAMLPrincipal principal = new SAMLPrincipal(
authentication.getName(),
nameIdType,
attributes.stream().filter(attr -> "urn:oasis:names:tc:SAML:1.1:nameid-format".equals(attr.getName()))
.findFirst().map(attr -> attr.getValue()).orElse(NameIDType.UNSPECIFIED),
attributes,
authnRequest.getIssuer().getValue(),
authnRequest.getID(),
Expand Down

0 comments on commit 3ff7c9e

Please sign in to comment.