View Javadoc
1   /*
2    *   Licensed to the Apache Software Foundation (ASF) under one
3    *   or more contributor license agreements.  See the NOTICE file
4    *   distributed with this work for additional information
5    *   regarding copyright ownership.  The ASF licenses this file
6    *   to you under the Apache License, Version 2.0 (the
7    *   "License"); you may not use this file except in compliance
8    *   with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *   Unless required by applicable law or agreed to in writing,
13   *   software distributed under the License is distributed on an
14   *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *   KIND, either express or implied.  See the License for the
16   *   specific language governing permissions and limitations
17   *   under the License.
18   *
19   */
20  
21  package org.apache.directory.ldap.client.api;
22  
23  
24  import javax.security.auth.login.Configuration;
25  
26  import org.apache.directory.api.ldap.model.constants.SupportedSaslMechanisms;
27  
28  
29  /**
30   * Holds the data required to complete the GSS-API SASL operation
31   *  
32   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
33   */
34  public class SaslGssApiRequest extends SaslRequest
35  {
36      /** The KDC host*/
37      protected String kdcHost;
38  
39      /** The KDC port */
40      protected int kdcPort = 0;
41  
42      /** The krb5.conf file absolute path */
43      protected String krb5ConfFilePath;
44  
45      /** The name for the {@link javax.security.auth.login.LoginContext} object */
46      protected String loginContextName = "ldapnetworkconnection";
47  
48      /** The {@link javax.security.auth.login.Configuration} object for LoginModule */
49      protected Configuration loginModuleConfiguration;
50  
51  
52      /**
53       * Creates a new instance of SaslGssApiRequest.
54       */
55      public SaslGssApiRequest()
56      {
57          super( SupportedSaslMechanisms.GSSAPI );
58      }
59  
60  
61      /**
62       * Gets the KDC host.
63       *
64       * @return the KDC host
65       */
66      public String getKdcHost()
67      {
68          return kdcHost;
69      }
70  
71  
72      /**
73       * Gets the KDC port.
74       *
75       * @return the KDC port
76       */
77      public int getKdcPort()
78      {
79          return kdcPort;
80      }
81  
82  
83      /**
84       * Gets the (absolute) path to the 'krb5.conf' file.
85       *
86       * @return the (absolute) path to the 'krb5.conf' file
87       */
88      public String getKrb5ConfFilePath()
89      {
90          return krb5ConfFilePath;
91      }
92  
93  
94      /**
95       * Gets the name for the {@link javax.security.auth.login.LoginContext} object. 
96       * 
97       * @return the name for the {@link javax.security.auth.login.LoginContext} object
98       */
99      public String getLoginContextName()
100     {
101         return loginContextName;
102     }
103 
104 
105     /**
106      * Gets the {@link javax.security.auth.login.Configuration} object for Login Module.
107      *
108      * @return the {@link javax.security.auth.login.Configuration} object for Login Module
109      */
110     public Configuration getLoginModuleConfiguration()
111     {
112         return loginModuleConfiguration;
113     }
114 
115 
116     /**
117      * Sets the KDC host.
118      *
119      * @param kdcHost the KDC host
120      */
121     public void setKdcHost( String kdcHost )
122     {
123         this.kdcHost = kdcHost;
124     }
125 
126 
127     /**
128      * Sets the KDC port.
129      *
130      * @param kdcPort the KDC port
131      */
132     public void setKdcPort( int kdcPort )
133     {
134         this.kdcPort = kdcPort;
135     }
136 
137 
138     /**
139      * Sets the (absolute) path to the 'krb5.conf' file.
140      *
141      * @param krb5ConfFilePath the (absolute) path to the 'krb5.conf' file
142      */
143     public void setKrb5ConfFilePath( String krb5ConfFilePath )
144     {
145         this.krb5ConfFilePath = krb5ConfFilePath;
146     }
147 
148 
149     /**
150      * Sets the name for the {@link javax.security.auth.login.LoginContext} object.
151      * 
152      * @param loginContextName the name for the {@link javax.security.auth.login.LoginContext} object
153      */
154     public void setLoginContextName( String loginContextName )
155     {
156         this.loginContextName = loginContextName;
157     }
158 
159 
160     /**
161      * Sets the {@link javax.security.auth.login.Configuration} object for Login Module.
162      *
163      * @param loginModuleConfiguration the {@link javax.security.auth.login.Configuration} object for Login Module
164      */
165     public void setLoginModuleConfiguration( Configuration loginModuleConfiguration )
166     {
167         this.loginModuleConfiguration = loginModuleConfiguration;
168     }
169 
170 
171     /**
172      * {@inheritDoc}
173      */
174     // Overriding the visibility of the method to public
175     public void setRealmName( String realmName )
176     {
177         super.setRealmName( realmName );
178     }
179 }