001: /*
002: * Assertion.java
003: *
004: * Created on August 18, 2005, 12:08 PM
005: */
006:
007: /*
008: * The contents of this file are subject to the terms
009: * of the Common Development and Distribution License
010: * (the License). You may not use this file except in
011: * compliance with the License.
012: *
013: * You can obtain a copy of the license at
014: * https://glassfish.dev.java.net/public/CDDLv1.0.html.
015: * See the License for the specific language governing
016: * permissions and limitations under the License.
017: *
018: * When distributing Covered Code, include this CDDL
019: * Header Notice in each file and include the License file
020: * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
021: * If applicable, add the following below the CDDL Header,
022: * with the fields enclosed by brackets [] replaced by
023: * you own identifying information:
024: * "Portions Copyrighted [year] [name of copyright owner]"
025: *
026: * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
027: */
028:
029: package com.sun.xml.wss.saml;
030:
031: import com.sun.xml.ws.security.Token;
032: import com.sun.xml.wss.XWSSecurityException;
033: import java.math.BigInteger;
034: import java.security.PrivateKey;
035: import java.security.PublicKey;
036: import java.security.cert.X509Certificate;
037: import javax.xml.crypto.dsig.DigestMethod;
038: import org.w3c.dom.Element;
039: import org.w3c.dom.Node;
040:
041: /**
042: *
043: * @author abhijit.das@sun.COM
044: */
045:
046: /**
047: * This interface stands for <code>Assertion</code> element. An Assertion is a package
048: * of information that supplies one or more <code>Statement</code> made by an
049: * issuer. There are three kinds of assertions Authentication, Authorization
050: * Decision and Attribute assertion.
051: * <pre>
052: *
053: * <Assertion AssertionID="1124370015917" IssueInstant="2005-08-18T18:30:15.917+05:30"
054: * Issuer="CN=Assertion Issuer,OU=AI,O=Assertion Issuer,L=Waltham,ST=MA,C=US"
055: * MajorVersion="1" MinorVersion="1"
056: * xmlns="urn:oasis:names:tc:SAML:1.0:assertion">
057: * <Conditions NotBefore="2005-08-16T13:21:50.503+05:30"
058: * NotOnOrAfter="2005-08-16T15:21:50.504+05:30"/>
059: * <Subject xmlns="urn:oasis:names:tc:SAML:1.0:assertion">
060: * <NameIdentifier Format="urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName">
061: * CN=SAML User,OU=SU,O=SAML User,L=Los Angeles,ST=CA,C=US
062: * </NameIdentifier>
063: *
064: * <SubjectConfirmation>
065: * <ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:sender-vouches</ConfirmationMethod>
066: * </SubjectConfirmation>
067: * </Subject>
068: * <Attribute AttributeName="attribute1" AttributeNamespace="urn:com:sun:xml:wss:attribute">
069: * <AttributeValue>ATTRIBUTE1</AttributeValue>
070: * </Attribute>
071: * <Assertion>
072: * </pre>
073: */
074: public interface Assertion extends Token {
075:
076: /**
077: * Sign the SAML Assertion - Enveloped Signature
078: *
079: * @param pubKey A <code>java.security.PublicKey</code> representing the public key used for Signature verification
080: * @param privKey A <code>java.security.PrivateKey</code> representing the private key used for Signature calculation.
081: *
082: * By Default DigestMethod.SHA1 and SignatureMethod.RSA_SHA1 will be used.
083: * @return An <code>org.w3c.dom.Element</code> representation of Signed SAML Assertion
084: */
085: public Element sign(PublicKey pubKey, PrivateKey privKey)
086: throws SAMLException;
087:
088: public Element sign(X509Certificate cert, PrivateKey privKey)
089: throws SAMLException;
090:
091: /**
092: * sign the saml assertion (Enveloped Signature)
093: * @param digestMethod DigestMethod to be used
094: * @param signatureMethod SignatureMethod to be used.
095: * @param pubKey PublicKey to be used for Signature verification
096: * @param privKey PrivateKey to be used for Signature calculation
097: *
098: * @return An <code>org.w3c.dom.Element</code> representation of Signed SAML Assertion
099: */
100:
101: public Element sign(DigestMethod digestMethod,
102: String signatureMethod, PublicKey pubKey, PrivateKey privKey)
103: throws SAMLException;
104:
105: public Element sign(DigestMethod digestMethod,
106: String signatureMethod, X509Certificate cert,
107: PrivateKey privKey) throws SAMLException;
108:
109: /**
110: * Set the saml major version
111: * @param value A <code>java.math.BigInteger</code> representing
112: * saml major version
113: */
114: public void setMajorVersion(java.math.BigInteger value);
115:
116: /**
117: * Set the saml minor version
118: * @param value A <code>java.math.BigInteger</code> representing
119: * saml minor version
120: */
121:
122: public void setMinorVersion(java.math.BigInteger value);
123:
124: public void setVersion(String version);
125:
126: /**
127: * Convert SAML Assertion to <code>org.w3c.dom.Element</code>
128: * @param doc the context <code>org.w3c.dom.Node</code> for the creation of the
129: * resulting <code>Element</code>.
130: * @return org.w3c.dom.Element element representation of SAML Assertion
131: */
132: public Element toElement(Node doc) throws XWSSecurityException;
133:
134: public String getSamlIssuer();
135:
136: public String getAssertionID();
137:
138: public String getID();
139:
140: public String getVersion();
141:
142: public BigInteger getMajorVersion();
143:
144: public BigInteger getMinorVersion();
145: }
|