/** * Set the keytab to use. keytab and password are mutually exclusive. * * @param newKeytab keytab to use */ public void setKeytab(@Nullable final String newKeytab) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); keytab = StringSupport.trim(newKeytab); }
/** * Constructor. * * @param throwable the handled type of {@link Throwable} * @param code the fault code * @param message the fault string * @param actor the fault actor * @param addressingActionURI the WS-Addressing action URI */ public SOAP11FaultContextDecoratingErrorHandler(@Nonnull final Class<? extends Throwable> throwable, @Nonnull final QName code, @Nonnull final String message, @Nullable final String actor, @Nullable final String addressingActionURI) { super(); handledThrowable = Constraint.isNotNull(throwable, "Handled Throwable type cannot be null"); faultCode = Constraint.isNotNull(code, "Fault code cannot be null"); faultString = Constraint.isNotNull(StringSupport.trim(message), "Fault string cannot be null or empty"); faultActor = StringSupport.trimOrNull(actor); wsAddressingActionURI = StringSupport.trimOrNull(addressingActionURI); }
/** {@inheritDoc} */ @Override protected void doParse(final Element element, final ParserContext parserContext, final BeanDefinitionBuilder builder) { super.doParse(element, parserContext, builder); final List<Element> childEngines = ElementSupport.getChildElements(element, AbstractMetadataProviderParser.TRUST_ENGINE_ELEMENT_NAME); final List<Element> childEngineRefs = ElementSupport.getChildElements(element, SecurityNamespaceHandler.TRUST_ENGINE_REF); final List<BeanMetadataElement> allChildren = new ManagedList<>(childEngines.size()+ childEngineRefs.size()); allChildren.addAll(SpringSupport.parseCustomElements(childEngines, parserContext)); for (final Element ref:childEngineRefs) { final String reference = StringSupport.trimOrNull(ref.getAttributeNS(null, "ref")); if (null != reference) { allChildren.add(new RuntimeBeanReference(StringSupport.trim(reference))); } } builder.addConstructorArgValue(allChildren); } }
/** * Decodes the TARGET parameter and adds it to the message context. * * @param messageContext current message context * @param request current servlet request * * @throws MessageDecodingException thrown if there is a problem decoding the TARGET parameter. */ protected void decodeTarget(MessageContext messageContext, HttpServletRequest request) throws MessageDecodingException { String target = StringSupport.trim(request.getParameter("TARGET")); if (target == null) { log.error("URL TARGET parameter was missing or did not contain a value."); throw new MessageDecodingException("URL TARGET parameter was missing or did not contain a value."); } SAMLBindingSupport.setRelayState(messageContext, target); }
/** * Parses the error message and appends the appropriate status info to the Item. * * @param e the error to parse * * @throws TransformerException thrown if the error does not contain the appropriate message prefix */ private void parseAndAppendStatusInfo(@Nonnull final TransformerException e) throws TransformerException { String errorMessage = StringSupport.trimOrNull(e.getMessage()); if (errorMessage == null) { throw e; } String statusMessage; if (errorMessage.startsWith(ERROR_PREFIX)) { statusMessage = StringSupport.trim(errorMessage.substring(ERROR_PREFIX.length())); item.getItemMetadata().put(new ErrorStatus(getId(), statusMessage)); } else if (errorMessage.startsWith(WARN_PREFIX)) { statusMessage = StringSupport.trim(errorMessage.substring(WARN_PREFIX.length())); item.getItemMetadata().put(new WarningStatus(getId(), statusMessage)); } else if (errorMessage.startsWith(INFO_PREFIX)) { statusMessage = StringSupport.trim(errorMessage.substring(INFO_PREFIX.length())); item.getItemMetadata().put(new InfoStatus(getId(), statusMessage)); } else { throw e; } } }
/** * Set the service principal name. Required. * * @param principal service principal */ public void setServicePrincipal(@Nonnull @NotEmpty final String principal) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); servicePrincipal = Constraint.isNotEmpty(StringSupport.trim(principal), "Principal cannot be null or empty"); }
/** * Gets the reference of the URI to use for the signature. If a reference attribute name is given, is present on the * document root element, and contains a value, that value is used. Otherwise an empty string is used. * * @param cli command line arguments * @param rootElement document root element * * @return the signature reference URI, never null */ protected static String getSignatureReferenceUri(final CommandLineArguments cli, final Element rootElement) { String reference = ""; if (cli.getReferenceIdAttributeName() != null) { final Attr referenceAttribute = (Attr) rootElement.getAttributes().getNamedItem(cli.getReferenceIdAttributeName()); if (referenceAttribute != null) { // Mark the reference attribute as a valid ID attribute rootElement.setIdAttributeNode(referenceAttribute, true); reference = StringSupport.trim(referenceAttribute.getValue()); if (reference.length() > 0) { reference = "#" + reference; } } } return reference; }
/** {@inheritDoc} */ protected void doDecode() throws MessageDecodingException { MessageContext<SAMLObject> messageContext = new MessageContext<>(); HttpServletRequest request = getHttpServletRequest(); String relayState = StringSupport.trim(request.getParameter("RelayState")); log.debug("Decoded SAML relay state of: {}", relayState); SAMLBindingSupport.setRelayState(messageContext, relayState); processArtifact(messageContext, request); populateBindingContext(messageContext); setMessageContext(messageContext); }