/** * Build new authentication statement. * * @param authnInstant authentication instant * @param authnMethod authentication method * @param principal authenticated principal * @return new authentication statement */ private AuthenticationStatement newAuthenticationStatement( final DateTime authnInstant, final String authnMethod, final String principal) { final AuthenticationStatement authnStatement = newSAMLObject( AuthenticationStatement.class, AuthenticationStatement.DEFAULT_ELEMENT_NAME); authnStatement.setAuthenticationInstant(authnInstant); authnStatement.setAuthenticationMethod(authnMethod); authnStatement.setSubject(newSubject(principal)); return authnStatement; }
/** {@inheritDoc} */ protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException { AuthenticationStatement authenticationStatement = (AuthenticationStatement) samlElement; if (authenticationStatement.getAuthenticationMethod() != null) { domElement.setAttributeNS(null, AuthenticationStatement.AUTHENTICATIONMETHOD_ATTRIB_NAME, authenticationStatement.getAuthenticationMethod()); } if (authenticationStatement.getAuthenticationInstant() != null) { String value = SAMLConfigurationSupport.getSAMLDateFormatter().print( authenticationStatement.getAuthenticationInstant()); domElement.setAttributeNS(null, AuthenticationStatement.AUTHENTICATIONINSTANT_ATTRIB_NAME, value); } } }
/** {@inheritDoc} */ protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject) throws UnmarshallingException { AuthenticationStatement authenticationStatement = (AuthenticationStatement) parentSAMLObject; if (childSAMLObject instanceof SubjectLocality) { authenticationStatement.setSubjectLocality((SubjectLocality) childSAMLObject); } else if (childSAMLObject instanceof AuthorityBinding) { authenticationStatement.getAuthorityBindings().add((AuthorityBinding) childSAMLObject); } else { super.processChildElement(parentSAMLObject, childSAMLObject); } }
Subject authSubject = SAML1ComponentBuilder.createSaml1v1Subject(statementBean.getSubject()); authenticationStatement.setSubject(authSubject); authenticationStatement.setAuthenticationInstant( statementBean.getAuthenticationInstant() ); } else { authenticationStatement.setAuthenticationInstant(new DateTime()); authenticationStatement.setAuthenticationMethod( transformAuthenticationMethod(statementBean.getAuthenticationMethod()) ); subjectLocality.setIPAddress(subjectLocalityBean.getIpAddress()); authenticationStatement.setSubjectLocality(subjectLocality);
statement.setAuthenticationInstant(new DateTime(getAuthenticationResult().getAuthenticationInstant())); statement.setAuthenticationMethod(requestedPrincipalContext.getMatchingPrincipal().getName()); } else { statement.setAuthenticationMethod(methodLookupStrategy.apply(profileRequestContext).getName()); final SubjectLocality locality = localityBuilder.buildObject(); locality.setIPAddress(getHttpServletRequest().getRemoteAddr()); statement.setSubjectLocality(locality); } else { log.debug("{} HttpServletRequest not available, omitting SubjectLocality element", getLogPrefix());
/** {@inheritDoc} */ protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException { AuthenticationStatement authenticationStatement = (AuthenticationStatement) samlObject; if (AuthenticationStatement.AUTHENTICATIONINSTANT_ATTRIB_NAME.equals(attribute.getLocalName()) && !Strings.isNullOrEmpty(attribute.getValue())) { DateTime value = new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()); authenticationStatement.setAuthenticationInstant(value); } else if (AuthenticationStatement.AUTHENTICATIONMETHOD_ATTRIB_NAME.equals(attribute.getLocalName())) { authenticationStatement.setAuthenticationMethod(attribute.getValue()); } else { super.processAttribute(samlObject, attribute); } } }
private static org.opensaml.saml.saml1.core.Subject getSaml1Subject(SamlAssertionWrapper assertionW) { for (Statement stmt : assertionW.getSaml1().getStatements()) { org.opensaml.saml.saml1.core.Subject samlSubject = null; if (stmt instanceof AttributeStatement) { AttributeStatement attrStmt = (AttributeStatement) stmt; samlSubject = attrStmt.getSubject(); } else if (stmt instanceof AuthenticationStatement) { AuthenticationStatement authStmt = (AuthenticationStatement) stmt; samlSubject = authStmt.getSubject(); } else { AuthorizationDecisionStatement authzStmt = (AuthorizationDecisionStatement)stmt; samlSubject = authzStmt.getSubject(); } if (samlSubject != null) { return samlSubject; } } return null; }
credential.setAuthenticationMethod(assertion.getAuthenticationStatements().get(0).getAuthenticationMethod());
DateTime authnInstant = authnStatement.getAuthenticationInstant(); String subjectLocalityAddress = null; if (authnStatement.getSubjectLocality() != null && authnStatement.getSubjectLocality().getIPAddress() != null) { subjectLocalityAddress = authnStatement.getSubjectLocality().getIPAddress();
: ((org.opensaml.saml.saml1.core.Response) response).getAssertions()) { for (final AuthenticationStatement statement : assertion.getAuthenticationStatements()) { if (statement.getAuthenticationInstant() != null) { return statement.getAuthenticationInstant();
private static org.opensaml.saml.saml1.core.Subject getSaml1Subject(SamlAssertionWrapper assertionW) { for (Statement stmt : assertionW.getSaml1().getStatements()) { org.opensaml.saml.saml1.core.Subject samlSubject = null; if (stmt instanceof AttributeStatement) { AttributeStatement attrStmt = (AttributeStatement) stmt; samlSubject = attrStmt.getSubject(); } else if (stmt instanceof AuthenticationStatement) { AuthenticationStatement authStmt = (AuthenticationStatement) stmt; samlSubject = authStmt.getSubject(); } else { AuthorizationDecisionStatement authzStmt = (AuthorizationDecisionStatement)stmt; samlSubject = authzStmt.getSubject(); } if (samlSubject != null) { return samlSubject; } } return null; }
: ((org.opensaml.saml.saml1.core.Response) response).getAssertions()) { for (final AuthenticationStatement statement : assertion.getAuthenticationStatements()) { if (statement.getAuthenticationMethod() != null) { return statement.getAuthenticationMethod();
/** * New authentication statement. * * @param authenticationDate the authentication date * @param authenticationMethod the authentication method * @param subjectId the subject id * @return the authentication statement */ public AuthenticationStatement newAuthenticationStatement(final Date authenticationDate, final String authenticationMethod, final String subjectId) { final AuthenticationStatement authnStatement = newSamlObject(AuthenticationStatement.class); authnStatement.setAuthenticationInstant(new DateTime(authenticationDate)); authnStatement.setAuthenticationMethod( authenticationMethod != null ? authenticationMethod : SamlAuthenticationMetaDataPopulator.AUTHN_METHOD_UNSPECIFIED); authnStatement.setSubject(newSubject(subjectId)); return authnStatement; }
if (statement.getSubject() != null && statement.getSubject().getNameIdentifier() != null) { return statement.getSubject().getNameIdentifier().getFormat();
credential.setAuthenticationMethod(assertion.getAuthenticationStatements().get(0).getAuthenticationMethod());
if (statement.getSubject() != null && statement.getSubject().getNameIdentifier() != null) { return statement.getSubject().getNameIdentifier().getValue();
} else if (stmt instanceof AuthenticationStatement) { AuthenticationStatement authStmt = (AuthenticationStatement) stmt; samlSubject = authStmt.getSubject(); } else { AuthorizationDecisionStatement authzStmt =
org.opensaml.saml.saml1.core.AuthenticationStatement authStmt = (org.opensaml.saml.saml1.core.AuthenticationStatement) stmt; samlSubject = authStmt.getSubject(); } else { org.opensaml.saml.saml1.core.AuthorizationDecisionStatement authzStmt =