Debian Codegraph @

java-sdk/ietfldap/org/ietf/ldap/LDAPAuthProvider.java

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is mozilla.org code.
17 *
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 2001
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Contributor(s):
24 *
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
36 *
37 * ***** END LICENSE BLOCK ***** */
38 package org.ietf.ldap;
39
40 import java.io.Serializable;
41
42 /**
43 * Represents information used to authenticate the client in cases where
44 * the client follows referrals automatically. If you are defining a class
45 * that implements the <CODE>LDAPRebind</CODE> interface, your implementation
46 * of the <CODE>LDAPRebind.getRebindAuthentication</CODE> method needs to
47 * construct and return an object of this class.
48 * <P>
49 *
50 * For example, the following method sets up authentication information based
51 * on the LDAP server identified in the referral. Ideally, this method would be
52 * defined as part of a class implementing the <CODE>LDAPRebind</CODE> interface.
53 *
54 * <PRE>
55 * private String myDN = "cn=Directory Manager,o=Ace Industry,c=US";
56 * private String myPW = "alway4444";
57 * private LDAPAuthProvider myRebindInfo;
58 * ...
59 * public LDAPAuthProvider getRebindAuthentication( String host, int port ) {
60 * if ( host.equalsIgnoreCase( "alway.mcom.com" ) && ( port == 389 ) ) {
61 * myRebindInfo = new LDAPAuthProvider( myDN, myPW );
62 * } else {
63 * myRebindInfo = new LDAPAuthProvider( "", "" );
64 * }
65 * return myRebindInfo;
66 * } </PRE>
67 *
68 * @version 1.0
69 * @see org.ietf.ldap.LDAPAuthHandler
70 */
71 public class LDAPAuthProvider implements Serializable {
72
73 static final long serialVersionUID = 7161655313564756294L;
74 private String _dn;
75 private byte[] _password;
76
77 /**
78 * Constructs information that is used by the client
79 * for authentication when following referrals automatically.
80 * @param dn distinguished name to use for authenticating to
81 * the LDAP server during an automatic referral (if the client
82 * is set up to follow referrals automatically)
83 * @param password password to use for authenticating to
84 * the LDAP server during an automatic referral (if the client
85 * is set up to follow referrals automatically)
86 */
87 public LDAPAuthProvider( String dn, byte[] password ) {
88 _dn = dn;
89 _password = password;
90 }
91
92 /**
93 * Returns the distinguished name to be used for reauthentication,
94 * if the client is set up to follow referrals automatically.
95 * @return distinguished name to use when authenticating to
96 * other LDAP servers during referrals.
97 */
98 public String getDN() {
99 return _dn;
100 }
101
102 /**
103 * Returns the password to be used for reauthentication,
104 * if the client is set up to follow referrals automatically.
105 * @return password to use when authenticating to other
106 * LDAP servers during referrals.
107 */
108 public byte[] getPassword() {
109 return _password;
110 }
111 }