001/* 002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 003 * 004 * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved 005 * 006 * The contents of this file are subject to the terms 007 * of the Common Development and Distribution License 008 * (the License). You may not use this file except in 009 * compliance with the License. 010 * 011 * You can obtain a copy of the License at 012 * https://opensso.dev.java.net/public/CDDLv1.0.html or 013 * opensso/legal/CDDLv1.0.txt 014 * See the License for the specific language governing 015 * permission and limitations under the License. 016 * 017 * When distributing Covered Code, include this CDDL 018 * Header Notice in each file and include the License file 019 * at opensso/legal/CDDLv1.0.txt. 020 * If applicable, add the following below the CDDL Header, 021 * with the fields enclosed by brackets [] replaced by 022 * your own identifying information: 023 * "Portions Copyrighted [year] [name of copyright owner]" 024 * 025 * $Id: AuthnContext.java,v 1.2 2008/06/25 05:47:40 qcheng Exp $ 026 * 027 * Portions Copyrighted 2015 ForgeRock AS. 028 */ 029 030 031 032package com.sun.identity.saml2.assertion; 033 034import java.util.List; 035import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 036import com.sun.identity.saml2.assertion.impl.AuthnContextImpl; 037import com.sun.identity.saml2.common.SAML2Exception; 038 039/** 040 * The <code>AuthnContext</code> element specifies the context of an 041 * authentication event. The element can contain an authentication context 042 * class reference, an authentication declaration or declaration reference, 043 * or both. Its type is <code>AuthnContextType</code>. 044 * <p> 045 * <pre> 046 * <complexType name="AuthnContextType"> 047 * <complexContent> 048 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> 049 * <sequence> 050 * <choice> 051 * <sequence> 052 * <element ref="{urn:oasis:names:tc:SAML:2.0:assertion} 053 * AuthnContextClassRef"/> 054 * <choice minOccurs="0"> 055 * <element ref="{urn:oasis:names:tc:SAML:2.0:assertion} 056 * AuthnContextDecl"/> 057 * <element ref="{urn:oasis:names:tc:SAML:2.0:assertion} 058 * AuthnContextDeclRef"/> 059 * </choice> 060 * </sequence> 061 * <choice> 062 * <element ref="{urn:oasis:names:tc:SAML:2.0:assertion} 063 * AuthnContextDecl"/> 064 * <element ref="{urn:oasis:names:tc:SAML:2.0:assertion} 065 * AuthnContextDeclRef"/> 066 * </choice> 067 * </choice> 068 * <element ref="{urn:oasis:names:tc:SAML:2.0:assertion} 069 * AuthenticatingAuthority" maxOccurs="unbounded" minOccurs="0"/> 070 * </sequence> 071 * </restriction> 072 * </complexContent> 073 * </complexType> 074 * </pre> 075 * @supported.all.api 076 */ 077@JsonDeserialize(as=AuthnContextImpl.class) 078public interface AuthnContext { 079 080 /** 081 * Makes the object immutable. 082 */ 083 public void makeImmutable(); 084 085 /** 086 * Returns the mutability of the object. 087 * 088 * @return <code>true</code> if the object is mutable; 089 * <code>false</code> otherwise. 090 */ 091 public boolean isMutable(); 092 093 /** 094 * Returns the value of the <code>AuthnContextClassRef</code> property. 095 * 096 * @return the value of the <code>AuthnContextClassRef</code>. 097 * @see #setAuthnContextClassRef(String) 098 */ 099 public String getAuthnContextClassRef(); 100 101 /** 102 * Sets the value of the <code>AuthnContextClassRef</code> property. 103 * 104 * @param value new <code>AuthenticationContextClassRef</code>. 105 * @throws SAML2Exception if the object is immutable. 106 * @see #getAuthnContextClassRef() 107 */ 108 public void setAuthnContextClassRef(String value) 109 throws SAML2Exception; 110 111 /** 112 * Returns the value of the <code>AuthnContextDeclRef</code> property. 113 * 114 * @return A String representing authentication context 115 * declaration reference. 116 * @see #setAuthnContextDeclRef(String) 117 */ 118 public String getAuthnContextDeclRef(); 119 120 /** 121 * Sets the value of the <code>AuthnContextDeclRef</code> property. 122 * 123 * @param value A String representation of authentication context 124 * declaration reference. 125 * @throws SAML2Exception if the object is immutable. 126 * @see #getAuthnContextDeclRef() 127 */ 128 public void setAuthnContextDeclRef(String value) 129 throws SAML2Exception; 130 131 /** 132 * Returns the value of the <code>AuthnContextDecl</code> property. 133 * 134 * @return An XML String representing authentication context declaration. 135 * @see #setAuthnContextDecl(String) 136 */ 137 public String getAuthnContextDecl(); 138 139 /** 140 * Sets the value of the <code>AuthnContextDecl</code> property. 141 * 142 * @param value An xml String representing authentication context 143 * declaration. 144 * @throws SAML2Exception if the object is immutable. 145 * @see #getAuthnContextDecl() 146 */ 147 public void setAuthnContextDecl(String value) 148 throws SAML2Exception; 149 150 /** 151 * Sets the value of the <code>AuthenticatingAuthority</code> property. 152 * 153 * @param value List of Strings representing authenticating authority 154 * @throws SAML2Exception if the object is immutable. 155 * @see #getAuthenticatingAuthority() 156 */ 157 public void setAuthenticatingAuthority(List<String> value) 158 throws SAML2Exception; 159 160 /** 161 * Returns the value of the <code>AuthenticatingAuthority</code> property. 162 * 163 * @return List of Strings representing 164 * <code>AuthenticatingAuthority</code>. 165 * @see #setAuthenticatingAuthority(List) 166 */ 167 public List<String> getAuthenticatingAuthority(); 168 169 /** 170 * Returns a String representation of the element. 171 * 172 * @return A string containing the valid XML for this element. 173 * By default name space name is prepended to the element name. 174 * @throws SAML2Exception if the object does not conform to the schema. 175 */ 176 public String toXMLString() 177 throws SAML2Exception; 178 179 /** 180 * Returns a String representation of the element. 181 * 182 * @param includeNS Determines whether or not the namespace qualifier is 183 * prepended to the Element when converted 184 * @param declareNS Determines whether or not the namespace is declared 185 * within the Element. 186 * @return A string containing the valid XML for this element 187 * @throws SAML2Exception if the object does not conform to the schema. 188 */ 189 public String toXMLString(boolean includeNS, boolean declareNS) 190 throws SAML2Exception; 191 192}