public static AuthnContextComparisonType fromValue(String v) { for (AuthnContextComparisonType c : AuthnContextComparisonType.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
ract.setComparison(AuthnContextComparisonType.fromValue(comparison.getValue()));
/** * Write a {@code RequestedAuthnContextType} to stream * * @param requestedAuthnContextType * * @throws ProcessingException */ public void write(RequestedAuthnContextType requestedAuthnContextType) throws ProcessingException { StaxUtil.writeStartElement(writer, PROTOCOL_PREFIX, JBossSAMLConstants.REQUESTED_AUTHN_CONTEXT.get(), PROTOCOL_NSURI.get()); AuthnContextComparisonType comparison = requestedAuthnContextType.getComparison(); if (comparison != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.COMPARISON.get(), comparison.value()); } List<String> authnContextClassRef = requestedAuthnContextType.getAuthnContextClassRef(); if (authnContextClassRef != null && !authnContextClassRef.isEmpty()) { for (String classRef : authnContextClassRef) { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.AUTHN_CONTEXT_CLASS_REF.get(), ASSERTION_NSURI.get()); StaxUtil.writeNameSpace(writer, ASSERTION_PREFIX, ASSERTION_NSURI.get()); StaxUtil.writeCharacters(writer, classRef); StaxUtil.writeEndElement(writer); } } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
ract.setComparison(AuthnContextComparisonType.fromValue(comparison.getValue()));
/** * Write a {@code RequestedAuthnContextType} to stream * * @param requestedAuthnContextType * @throws ProcessingException */ public void write(RequestedAuthnContextType requestedAuthnContextType) throws ProcessingException { StaxUtil.writeStartElement(writer, PROTOCOL_PREFIX, JBossSAMLConstants.REQUESTED_AUTHN_CONTEXT.get(), PROTOCOL_NSURI.get()); AuthnContextComparisonType comparison = requestedAuthnContextType.getComparison(); if (comparison != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.COMPARISON.get(), comparison.value()); } List<String> authnContextClassRef = requestedAuthnContextType.getAuthnContextClassRef(); if (authnContextClassRef != null && !authnContextClassRef.isEmpty()) { for (String classRef: authnContextClassRef) { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.AUTHN_CONTEXT_CLASS_REF.get(), ASSERTION_NSURI.get()); StaxUtil.writeNameSpace(writer, ASSERTION_PREFIX, ASSERTION_NSURI.get()); StaxUtil.writeCharacters(writer, classRef); StaxUtil.writeEndElement(writer); } } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
public static AuthnContextComparisonType fromValue(String v) { for (AuthnContextComparisonType c : AuthnContextComparisonType.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
private void createRequestAuthnContext(final AuthnRequestType authn) { String authnContextClasses = (String) handlerConfig.getParameter(GeneralConstants.AUTHN_CONTEXT_CLASSES); if (StringUtil.isNotNull(authnContextClasses)) { RequestedAuthnContextType requestAuthnContext = new RequestedAuthnContextType(); for (String contextClass: authnContextClasses.split(",")) { SAMLAuthenticationContextClass standardClass = SAMLAuthenticationContextClass.forAlias(contextClass); if (standardClass != null) { contextClass = standardClass.getFqn(); } requestAuthnContext.addAuthnContextClassRef(contextClass); } if (!requestAuthnContext.getAuthnContextClassRef().isEmpty()) { authn.setRequestedAuthnContext(requestAuthnContext); String comparison = (String) handlerConfig.getParameter(GeneralConstants.REQUESTED_AUTHN_CONTEXT_COMPARISON); if (StringUtil.isNotNull(comparison)) { requestAuthnContext.setComparison(AuthnContextComparisonType.fromValue(comparison)); } } else { logger.debug("RequestedAuthnContext not set for AuthnRequest. No context class was provided."); } } }
/** * Write a {@code RequestedAuthnContextType} to stream * * @param requestedAuthnContextType * * @throws ProcessingException */ public void write(RequestedAuthnContextType requestedAuthnContextType) throws ProcessingException { StaxUtil.writeStartElement(writer, PROTOCOL_PREFIX, JBossSAMLConstants.REQUESTED_AUTHN_CONTEXT.get(), PROTOCOL_NSURI.get()); AuthnContextComparisonType comparison = requestedAuthnContextType.getComparison(); if (comparison != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.COMPARISON.get(), comparison.value()); } List<String> authnContextClassRef = requestedAuthnContextType.getAuthnContextClassRef(); if (authnContextClassRef != null && !authnContextClassRef.isEmpty()) { for (String classRef : authnContextClassRef) { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.AUTHN_CONTEXT_CLASS_REF.get(), ASSERTION_NSURI.get()); StaxUtil.writeNameSpace(writer, ASSERTION_PREFIX, ASSERTION_NSURI.get()); StaxUtil.writeCharacters(writer, classRef); StaxUtil.writeEndElement(writer); } } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
public static AuthnContextComparisonType fromValue(String v) { for (AuthnContextComparisonType c : AuthnContextComparisonType.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
private void createRequestedAuthnContext(final AuthnRequestType authn) { String authnContextClasses = (String) handlerConfig.getParameter(GeneralConstants.AUTHN_CONTEXT_CLASSES); if (isNotNull(authnContextClasses)) { RequestedAuthnContextType requestAuthnContext = new RequestedAuthnContextType(); for (String classFqn : authnContextClasses.split(",")) { SAMLAuthenticationContextClass standardClass = SAMLAuthenticationContextClass.forAlias(classFqn); if (standardClass != null) { classFqn = standardClass.getFqn(); } requestAuthnContext.addAuthnContextClassRef(classFqn); } if (!requestAuthnContext.getAuthnContextClassRef().isEmpty()) { String comparison = (String) handlerConfig.getParameter(GeneralConstants.REQUESTED_AUTHN_CONTEXT_COMPARISON); if (isNotNull(comparison)) { requestAuthnContext.setComparison(AuthnContextComparisonType.fromValue(comparison)); } authn.setRequestedAuthnContext(requestAuthnContext); } else { logger.debug("RequestedAuthnContext not set for AuthnRequest. No class was provided."); } } }
public static AuthnContextComparisonType fromValue(String v) { for (AuthnContextComparisonType c: AuthnContextComparisonType.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
ract.setComparison(AuthnContextComparisonType.fromValue(comparison.getValue()));
private void createRequestedAuthnContext(final AuthnRequestType authn) { String authnContextClasses = (String) handlerConfig.getParameter(GeneralConstants.AUTHN_CONTEXT_CLASSES); if (isNotNull(authnContextClasses)) { RequestedAuthnContextType requestAuthnContext = new RequestedAuthnContextType(); for (String classFqn : authnContextClasses.split(",")) { SAMLAuthenticationContextClass standardClass = SAMLAuthenticationContextClass.forAlias(classFqn); if (standardClass != null) { classFqn = standardClass.getFqn(); } requestAuthnContext.addAuthnContextClassRef(classFqn); } if (!requestAuthnContext.getAuthnContextClassRef().isEmpty()) { String comparison = (String) handlerConfig.getParameter(GeneralConstants.REQUESTED_AUTHN_CONTEXT_COMPARISON); if (isNotNull(comparison)) { requestAuthnContext.setComparison(AuthnContextComparisonType.fromValue(comparison)); } authn.setRequestedAuthnContext(requestAuthnContext); } else { logger.debug("RequestedAuthnContext not set for AuthnRequest. No class was provided."); } } }