/** {@inheritDoc} */ @Override public boolean apply(@Nullable final ProfileRequestContext input) { final SAMLObject target = objectLookupStrategy.apply(input); if (target == null) { log.debug("No object to operate on, returning true"); return true; } if (target instanceof NameIdentifier) { return doApply(input, (NameIdentifier) target); } else if (target instanceof NameID) { return doApply(input, (NameID) target); } else if (target instanceof NameIDPolicy) { return doApply(input, (NameIDPolicy) target); } else { log.error("Lookup function returned an object of an unsupported type: {}", target.getElementQName()); return false; } }
/** * Constructor. * * @param samlArtifact artifact associated with the message * @param issuerId issuer of the artifact * @param relyingPartyId intended recipient of the artifact * @param samlMessage SAML message mapped to the artifact * @throws MarshallingException if an error occurs isolating a message from its parent * @throws UnmarshallingException if an error occurs isolating a message from its parent */ public BasicSAMLArtifactMapEntry(@Nonnull @NotEmpty final String samlArtifact, @Nonnull @NotEmpty final String issuerId, @Nonnull @NotEmpty final String relyingPartyId, @Nonnull final SAMLObject samlMessage) throws MarshallingException, UnmarshallingException { artifact = samlArtifact; issuer = issuerId; relyingParty = relyingPartyId; if (!samlMessage.hasParent()) { message = samlMessage; } else { message = XMLObjectSupport.cloneXMLObject(samlMessage, CloneOutputOption.RootDOMInNewDocument); } }
/** {@inheritDoc} */ @Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) { if (response instanceof ResponseAbstractType) { ((ResponseAbstractType) response).setInResponseTo(requestId); } else if (response instanceof StatusResponseType) { ((StatusResponseType) response).setInResponseTo(requestId); } else { log.debug("{} Message type {} is not supported", getLogPrefix(), response.getElementQName()); ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX); } }
/** {@inheritDoc} */ protected void doDecode() throws MessageDecodingException { super.doDecode(); populateBindingContext(getMessageContext()); SAMLObject samlMessage = getMessageContext().getMessage(); log.debug("Decoded SOAP messaged which included SAML message of type {}", samlMessage.getElementQName()); }
/** {@inheritDoc} */ protected void doDecode() throws MessageDecodingException { super.doDecode(); populateBindingContext(getMessageContext()); SAMLObject samlMessage = getMessageContext().getMessage(); log.debug("Decoded SOAP messaged which included SAML message of type {}", samlMessage.getElementQName()); }
/** {@inheritDoc} */ protected void doDecode() throws MessageDecodingException { super.doDecode(); populateBindingContext(getMessageContext()); SAMLObject samlMessage = getMessageContext().getMessage(); log.debug("Decoded SOAP messaged which included SAML message of type {}", samlMessage.getElementQName()); }
/** {@inheritDoc} */ protected void doDecode() throws MessageDecodingException { super.doDecode(); populateBindingContext(getMessageContext()); SAMLObject samlMessage = getMessageContext().getMessage(); log.debug("Decoded SOAP messaged which included SAML message of type {}", samlMessage.getElementQName()); }
/** * Decrypt an {@link EncryptedID} and return the result. * * @param profileRequestContext current profile request context * @param encID the encrypted object * * @return the decrypted name, or null if the object did not need decryption * @throws DecryptionException if an error occurs during decryption */ @Nullable private NameID processEncryptedID(@Nonnull final ProfileRequestContext profileRequestContext, @Nonnull final EncryptedID encID) throws DecryptionException { if (!getDecryptionPredicate().apply( new Pair<ProfileRequestContext,EncryptedElementType>(profileRequestContext, encID))) { return null; } if (getDecrypter() == null) { throw new DecryptionException("No decryption parameters, unable to decrypt EncryptedID"); } final SAMLObject object = getDecrypter().decrypt(encID); if (object instanceof NameID) { return (NameID) object; } throw new DecryptionException("Decrypted EncryptedID was not a NameID, was a " + object.getElementQName().toString()); }
LOG.error("Unknown SAML message type encountered: {}", samlMessage.getElementQName().toString()); throw new MessageException("Invalid SAML message type encountered");
log.debug("Decoded SOAP message which included SAML message of type {}", samlMessage.getElementQName());