001: /*
002: * The contents of this file are subject to the terms
003: * of the Common Development and Distribution License
004: * (the "License"). You may not use this file except
005: * in compliance with the License.
006: *
007: * You can obtain a copy of the license at
008: * https://jwsdp.dev.java.net/CDDLv1.0.html
009: * See the License for the specific language governing
010: * permissions and limitations under the License.
011: *
012: * When distributing Covered Code, include this CDDL
013: * HEADER in each file and include the License file at
014: * https://jwsdp.dev.java.net/CDDLv1.0.html If applicable,
015: * add the following below this CDDL HEADER, with the
016: * fields enclosed by brackets "[]" replaced with your
017: * own identifying information: Portions Copyright [yyyy]
018: * [name of copyright owner]
019: */
020: /*
021: * $Id: AuthorizationDecisionStatement.java,v 1.5 2007/01/08 16:05:57 shyam_rao Exp $
022: */
023:
024: /*
025: * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
026: * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
027: */
028:
029: package com.sun.xml.wss.saml.assertion.saml11.jaxb10;
030:
031: import com.sun.xml.wss.saml.SAMLException;
032: import com.sun.xml.bind.util.ListImpl;
033:
034: import com.sun.xml.wss.logging.LogDomainConstants;
035: import com.sun.xml.wss.saml.internal.saml11.jaxb10.impl.AuthorizationDecisionStatementTypeImpl;
036: import com.sun.xml.wss.saml.util.SAMLJAXBUtil;
037: import org.w3c.dom.Element;
038:
039: import java.util.List;
040: import java.util.logging.Logger;
041:
042: import javax.xml.bind.JAXBContext;
043:
044: /**
045: *The <code>AuthorizationDecisionStatement</code> element supplies a statement
046: *by the issuer that the request for access by the specified subject to the
047: *specified resource has resulted in the specified decision on the basis of
048: * some optionally specified evidence.
049: */
050: public class AuthorizationDecisionStatement
051: extends
052: com.sun.xml.wss.saml.internal.saml11.jaxb10.impl.AuthorizationDecisionStatementImpl
053: implements com.sun.xml.wss.saml.AuthorizationDecisionStatement {
054:
055: protected static final Logger log = Logger.getLogger(
056: LogDomainConstants.WSS_API_DOMAIN,
057: LogDomainConstants.WSS_API_DOMAIN_BUNDLE);
058:
059: /**
060: *Default constructor
061: */
062: protected AuthorizationDecisionStatement() {
063: super ();
064: }
065:
066: /**
067: * Constructs an <code>AuthorizationStatement</code> element from an
068: * existing XML block.
069: *
070: * @param element representing a DOM tree element
071: * @exception SAMLException if there is an error in the sender or in
072: * the element definition.
073: */
074: public static AuthorizationDecisionStatementTypeImpl fromElement(
075: Element element) throws SAMLException {
076: try {
077: JAXBContext jc = SAMLJAXBUtil.getJAXBContext();
078: javax.xml.bind.Unmarshaller u = jc.createUnmarshaller();
079: return (AuthorizationDecisionStatementTypeImpl) u
080: .unmarshal(element);
081: } catch (Exception ex) {
082: throw new SAMLException(ex.getMessage());
083: }
084: }
085:
086: private void setAction(List action) {
087: _Action = new ListImpl(action);
088: }
089:
090: /**
091: * Constructs an instance of <code>AuthorizationDecisionStatement</code>.
092: *
093: * @param subject (required) A Subject object
094: * @param resource (required) A String identifying the resource to which
095: * access authorization is sought.
096: * @param decision (required) The decision rendered by the issuer with
097: * respect to the specified resource. The value is of the
098: * <code>DecisionType</code> simple type.
099: * @param action (required) A List of Action objects specifying the set of
100: * actions authorized to be performed on the specified resource.
101: * @param evidence (optional) An Evidence object representing a set of
102: * assertions that the issuer replied on in making decisions.
103: * @exception SAMLException if there is an error in the sender.
104: */
105: public AuthorizationDecisionStatement(Subject subject,
106: String resource, String decision, List action,
107: Evidence evidence) {
108: setSubject(subject);
109: setResource(resource);
110: setDecision(decision);
111: setAction(action);
112: setEvidence(evidence);
113: }
114: }
|