1 /* 2 * Copyright 2008 University Corporation for Advanced Internet Development, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.opensaml.common.binding.artifact; 18 19 import org.joda.time.DateTime; 20 import org.opensaml.common.SAMLObject; 21 import org.opensaml.common.binding.artifact.SAMLArtifactMap.SAMLArtifactMapEntry; 22 import org.opensaml.util.storage.AbstractExpiringObject; 23 24 /** Basic implementation of {@link SAMLArtifactMapEntry}. */ 25 public class BasicSAMLArtifactMapEntry extends AbstractExpiringObject implements SAMLArtifactMapEntry { 26 27 /** Serial version UID. */ 28 private static final long serialVersionUID = 4872905727625023964L; 29 30 /** SAML artifact being mapped. */ 31 private String artifact; 32 33 /** Entity ID of the issuer of the artifact. */ 34 private String issuer; 35 36 /** Entity ID of the receiver of the artifact. */ 37 private String relyingParty; 38 39 /** SAML message mapped to the artifact. */ 40 private transient SAMLObject message; 41 42 /** Serialized SAML object mapped to the artifact. */ 43 private String serializedMessage; 44 45 /** 46 * Constructor. 47 * 48 * @param artifact artifact associated with the message 49 * @param issuer issuer of the artifact 50 * @param relyingParty receiver of the artifact 51 * @param saml serialized SAML message mapped to the artifact 52 * @param lifetime lifetime of the artifact 53 */ 54 public BasicSAMLArtifactMapEntry(String artifact, String issuer, String relyingParty, String saml, long lifetime) { 55 super(new DateTime().plus(lifetime)); 56 this.artifact = artifact; 57 this.issuer = issuer; 58 this.relyingParty = relyingParty; 59 serializedMessage = saml; 60 } 61 62 /** {@inheritDoc} */ 63 public String getArtifact() { 64 return artifact; 65 } 66 67 /** {@inheritDoc} */ 68 public String getIssuerId() { 69 return issuer; 70 } 71 72 /** {@inheritDoc} */ 73 public String getRelyingPartyId() { 74 return relyingParty; 75 } 76 77 /** {@inheritDoc} */ 78 public SAMLObject getSamlMessage() { 79 return message; 80 } 81 82 /** 83 * Sets the SAML message mapped to the artifact. 84 * 85 * @param saml SAML message mapped to the artifact 86 */ 87 void setSAMLMessage(SAMLObject saml) { 88 message = saml; 89 } 90 91 /** 92 * Gets the serialized form of the SAML message. 93 * 94 * @return serialized form of the SAML message 95 */ 96 String getSeralizedMessage() { 97 return serializedMessage; 98 } 99 }