jdk/src/share/classes/javax/security/sasl/AuthorizeCallback.java
changeset 18830 90956ead732f
parent 5506 202f599c92aa
equal deleted inserted replaced
18829:ec84f0c313b0 18830:90956ead732f
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    26 package javax.security.sasl;
    26 package javax.security.sasl;
    27 
    27 
    28 import javax.security.auth.callback.Callback;
    28 import javax.security.auth.callback.Callback;
    29 
    29 
    30 /**
    30 /**
    31   * This callback is used by <tt>SaslServer</tt> to determine whether
    31   * This callback is used by {@code SaslServer} to determine whether
    32   * one entity (identified by an authenticated authentication id)
    32   * one entity (identified by an authenticated authentication id)
    33   * can act on
    33   * can act on
    34   * behalf of another entity (identified by an authorization id).
    34   * behalf of another entity (identified by an authorization id).
    35   *
    35   *
    36   * @since 1.5
    36   * @since 1.5
    64      * @serial
    64      * @serial
    65      */
    65      */
    66     private boolean authorized;
    66     private boolean authorized;
    67 
    67 
    68     /**
    68     /**
    69      * Constructs an instance of <tt>AuthorizeCallback</tt>.
    69      * Constructs an instance of {@code AuthorizeCallback}.
    70      *
    70      *
    71      * @param authnID   The (authenticated) authentication id.
    71      * @param authnID   The (authenticated) authentication id.
    72      * @param authzID   The authorization id.
    72      * @param authzID   The authorization id.
    73      */
    73      */
    74     public AuthorizeCallback(String authnID, String authzID) {
    74     public AuthorizeCallback(String authnID, String authzID) {
    94 
    94 
    95     /**
    95     /**
    96      * Determines whether the authentication id is allowed to
    96      * Determines whether the authentication id is allowed to
    97      * act on behalf of the authorization id.
    97      * act on behalf of the authorization id.
    98      *
    98      *
    99      * @return <tt>true</tt> if authorization is allowed; <tt>false</tt> otherwise
    99      * @return {@code true} if authorization is allowed; {@code false} otherwise
   100      * @see #setAuthorized(boolean)
   100      * @see #setAuthorized(boolean)
   101      * @see #getAuthorizedID()
   101      * @see #getAuthorizedID()
   102      */
   102      */
   103     public boolean isAuthorized() {
   103     public boolean isAuthorized() {
   104         return authorized;
   104         return authorized;
   105     }
   105     }
   106 
   106 
   107     /**
   107     /**
   108      * Sets whether the authorization is allowed.
   108      * Sets whether the authorization is allowed.
   109      * @param ok <tt>true</tt> if authorization is allowed; <tt>false</tt> otherwise
   109      * @param ok {@code true} if authorization is allowed; {@code false} otherwise
   110      * @see #isAuthorized
   110      * @see #isAuthorized
   111      * @see #setAuthorizedID(java.lang.String)
   111      * @see #setAuthorizedID(java.lang.String)
   112      */
   112      */
   113     public void setAuthorized(boolean ok) {
   113     public void setAuthorized(boolean ok) {
   114         authorized = ok;
   114         authorized = ok;
   115     }
   115     }
   116 
   116 
   117     /**
   117     /**
   118      * Returns the id of the authorized user.
   118      * Returns the id of the authorized user.
   119      * @return The id of the authorized user. <tt>null</tt> means the
   119      * @return The id of the authorized user. {@code null} means the
   120      * authorization failed.
   120      * authorization failed.
   121      * @see #setAuthorized(boolean)
   121      * @see #setAuthorized(boolean)
   122      * @see #setAuthorizedID(java.lang.String)
   122      * @see #setAuthorizedID(java.lang.String)
   123      */
   123      */
   124     public String getAuthorizedID() {
   124     public String getAuthorizedID() {