src/java.security.sasl/share/classes/javax/security/sasl/SaslClient.java
author coleenp
Tue, 03 Jul 2018 13:41:18 -0400
changeset 50929 ef57cfcd22ff
parent 47216 71c04702a3d5
permissions -rw-r--r--
8205534: Remove SymbolTable dependency from serviceability agent Reviewed-by: gziemski, poonam, jgeorge, hseigel
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
     2
 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.security.sasl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * Performs SASL authentication as a client.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * A protocol library such as one for LDAP gets an instance of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * class in order to perform authentication defined by a specific SASL
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
    33
 * mechanism. Invoking methods on the {@code SaslClient} instance
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * process challenges and create responses according to the SASL
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
    35
 * mechanism implemented by the {@code SaslClient}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * As the authentication proceeds, the instance
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * encapsulates the state of a SASL client's authentication exchange.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *<p>
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
    39
 * Here's an example of how an LDAP library might use a {@code SaslClient}.
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
    40
 * It first gets an instance of a {@code SaslClient}:
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 5506
diff changeset
    41
 *<blockquote><pre>{@code
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * SaslClient sc = Sasl.createSaslClient(mechanisms,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *     authorizationId, protocol, serverName, props, callbackHandler);
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 5506
diff changeset
    44
 *}</pre></blockquote>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * It can then proceed to use the client for authentication.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * For example, an LDAP library might use the client as follows:
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 5506
diff changeset
    47
 *<blockquote><pre>{@code
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * // Get initial response and send to server
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * byte[] response = (sc.hasInitialResponse() ? sc.evaluateChallenge(new byte[0]) :
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *     null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * LdapResult res = ldap.sendBindRequest(dn, sc.getName(), response);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * while (!sc.isComplete() &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 *     (res.status == SASL_BIND_IN_PROGRESS || res.status == SUCCESS)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *     response = sc.evaluateChallenge(res.getBytes());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *     if (res.status == SUCCESS) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *         // we're done; don't expect to send another BIND
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *         if (response != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *             throw new SaslException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *                 "Protocol error: attempting to send response after completion");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *         break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 *     res = ldap.sendBindRequest(dn, sc.getName(), response);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * if (sc.isComplete() && res.status == SUCCESS) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 *    String qop = (String) sc.getNegotiatedProperty(Sasl.QOP);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 *    if (qop != null
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 *        && (qop.equalsIgnoreCase("auth-int")
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *            || qop.equalsIgnoreCase("auth-conf"))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 *      // Use SaslClient.wrap() and SaslClient.unwrap() for future
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 *      // communication with server
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 *      ldap.in = new SecureInputStream(sc, ldap.in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *      ldap.out = new SecureOutputStream(sc, ldap.out);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 *    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * }
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 5506
diff changeset
    77
 *}</pre></blockquote>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * If the mechanism has an initial response, the library invokes
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
    80
 * {@code evaluateChallenge()} with an empty
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * challenge and to get initial response.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * Protocols such as IMAP4, which do not include an initial response with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * their first authentication command to the server, initiates the
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
    84
 * authentication without first calling {@code hasInitialResponse()}
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
    85
 * or {@code evaluateChallenge()}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * When the server responds to the command, it sends an initial challenge.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * For a SASL mechanism in which the client sends data first, the server should
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * have issued a challenge with no data. This will then result in a call
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
    89
 * (on the client) to {@code evaluateChallenge()} with an empty challenge.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * @see Sasl
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * @see SaslClientFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * @author Rosanna Lee
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * @author Rob Weltman
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
public abstract interface SaslClient {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * Returns the IANA-registered mechanism name of this SASL client.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * (e.g. "CRAM-MD5", "GSSAPI").
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * @return A non-null string representing the IANA-registered mechanism name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    public abstract String getMechanismName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * Determines whether this mechanism has an optional initial response.
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
   110
     * If true, caller should call {@code evaluateChallenge()} with an
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * empty array to get the initial response.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * @return true if this mechanism has an initial response.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    public abstract boolean hasInitialResponse();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * Evaluates the challenge data and generates a response.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * If a challenge is received from the server during the authentication
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * process, this method is called to prepare an appropriate next
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * response to submit to the server.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * @param challenge The non-null challenge sent from the server.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * The challenge array may have zero length.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     *
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 18830
diff changeset
   126
     * @return The possibly null response to send to the server.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * It is null if the challenge accompanied a "SUCCESS" status and the challenge
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * only contains data for the client to update its state and no response
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * needs to be sent to the server. The response is a zero-length byte
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * array if the client is to send a response with no data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * @exception SaslException If an error occurred while processing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * the challenge or generating a response.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    public abstract byte[] evaluateChallenge(byte[] challenge)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        throws SaslException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
      * Determines whether the authentication exchange has completed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
      * This method may be called at any time, but typically, it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
      * will not be called until the caller has received indication
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
      * from the server
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
      * (in a protocol-specific manner) that the exchange has completed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
      * @return true if the authentication exchange has completed; false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    public abstract boolean isComplete();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * Unwraps a byte array received from the server.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * This method can be called only after the authentication exchange has
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
   151
     * completed (i.e., when {@code isComplete()} returns true) and only if
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * the authentication exchange has negotiated integrity and/or privacy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * as the quality of protection; otherwise, an
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
   154
     * {@code IllegalStateException} is thrown.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     *<p>
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
   156
     * {@code incoming} is the contents of the SASL buffer as defined in RFC 2222
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * without the leading four octet field that represents the length.
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
   158
     * {@code offset} and {@code len} specify the portion of {@code incoming}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * to use.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * @param incoming A non-null byte array containing the encoded bytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     *                from the server.
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
   163
     * @param offset The starting position at {@code incoming} of the bytes to use.
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
   164
     * @param len The number of bytes from {@code incoming} to use.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * @return A non-null byte array containing the decoded bytes.
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
   166
     * @exception SaslException if {@code incoming} cannot be successfully
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * unwrapped.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * @exception IllegalStateException if the authentication exchange has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * not completed, or  if the negotiated quality of protection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * has neither integrity nor privacy.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    public abstract byte[] unwrap(byte[] incoming, int offset, int len)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        throws SaslException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * Wraps a byte array to be sent to the server.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * This method can be called only after the authentication exchange has
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
   178
     * completed (i.e., when {@code isComplete()} returns true) and only if
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * the authentication exchange has negotiated integrity and/or privacy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * as the quality of protection; otherwise, an
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
   181
     * {@code IllegalStateException} is thrown.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * The result of this method will make up the contents of the SASL buffer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * as defined in RFC 2222 without the leading four octet field that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * represents the length.
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
   186
     * {@code offset} and {@code len} specify the portion of {@code outgoing}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * to use.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * @param outgoing A non-null byte array containing the bytes to encode.
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
   190
     * @param offset The starting position at {@code outgoing} of the bytes to use.
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
   191
     * @param len The number of bytes from {@code outgoing} to use.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * @return A non-null byte array containing the encoded bytes.
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
   193
     * @exception SaslException if {@code outgoing} cannot be successfully
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * wrapped.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * @exception IllegalStateException if the authentication exchange has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * not completed, or if the negotiated quality of protection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * has neither integrity nor privacy.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    public abstract byte[] wrap(byte[] outgoing, int offset, int len)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        throws SaslException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * Retrieves the negotiated property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * This method can be called only after the authentication exchange has
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
   205
     * completed (i.e., when {@code isComplete()} returns true); otherwise, an
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18156
diff changeset
   206
     * {@code IllegalStateException} is thrown.
25403
e982fe3e83a4 8044085: Access ExtendedGSSContext.inquireSecContext() result through SASL
weijun
parents: 21278
diff changeset
   207
     * <p>
e982fe3e83a4 8044085: Access ExtendedGSSContext.inquireSecContext() result through SASL
weijun
parents: 21278
diff changeset
   208
     * The {@link Sasl} class includes several well-known property names
e982fe3e83a4 8044085: Access ExtendedGSSContext.inquireSecContext() result through SASL
weijun
parents: 21278
diff changeset
   209
     * (For example, {@link Sasl#QOP}). A SASL provider can support other
e982fe3e83a4 8044085: Access ExtendedGSSContext.inquireSecContext() result through SASL
weijun
parents: 21278
diff changeset
   210
     * properties which are specific to the vendor and/or a mechanism.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * @param propName The non-null property name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * @return The value of the negotiated property. If null, the property was
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * not negotiated or is not applicable to this mechanism.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * @exception IllegalStateException if this authentication exchange
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * has not completed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    public abstract Object getNegotiatedProperty(String propName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
      * Disposes of any system resources or security-sensitive information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
      * the SaslClient might be using. Invoking this method invalidates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
      * the SaslClient instance. This method is idempotent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
      * @throws SaslException If a problem was encountered while disposing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
      * the resources.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    public abstract void dispose() throws SaslException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
}