001/*
002 *   Licensed to the Apache Software Foundation (ASF) under one
003 *   or more contributor license agreements.  See the NOTICE file
004 *   distributed with this work for additional information
005 *   regarding copyright ownership.  The ASF licenses this file
006 *   to you under the Apache License, Version 2.0 (the
007 *   "License"); you may not use this file except in compliance
008 *   with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *   Unless required by applicable law or agreed to in writing,
013 *   software distributed under the License is distributed on an
014 *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *   KIND, either express or implied.  See the License for the
016 *   specific language governing permissions and limitations
017 *   under the License.
018 *
019 */
020
021package org.apache.directory.ldap.client.api;
022
023
024import javax.security.auth.login.Configuration;
025
026import org.apache.directory.api.ldap.model.constants.SupportedSaslMechanisms;
027
028
029/**
030 * Holds the data required to complete the GSS-API SASL operation
031 *  
032 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
033 */
034public class SaslGssApiRequest extends SaslRequest
035{
036    /** The KDC host*/
037    protected String kdcHost;
038
039    /** The KDC port */
040    protected int kdcPort = 0;
041
042    /** The krb5.conf file absolute path */
043    protected String krb5ConfFilePath;
044
045    /** The name for the {@link javax.security.auth.login.LoginContext} object */
046    protected String loginContextName = "ldapnetworkconnection";
047
048    /** The {@link javax.security.auth.login.Configuration} object for LoginModule */
049    protected Configuration loginModuleConfiguration;
050
051
052    /**
053     * Creates a new instance of SaslGssApiRequest.
054     */
055    public SaslGssApiRequest()
056    {
057        super( SupportedSaslMechanisms.GSSAPI );
058    }
059
060
061    /**
062     * Gets the KDC host.
063     *
064     * @return the KDC host
065     */
066    public String getKdcHost()
067    {
068        return kdcHost;
069    }
070
071
072    /**
073     * Gets the KDC port.
074     *
075     * @return the KDC port
076     */
077    public int getKdcPort()
078    {
079        return kdcPort;
080    }
081
082
083    /**
084     * Gets the (absolute) path to the 'krb5.conf' file.
085     *
086     * @return the (absolute) path to the 'krb5.conf' file
087     */
088    public String getKrb5ConfFilePath()
089    {
090        return krb5ConfFilePath;
091    }
092
093
094    /**
095     * Gets the name for the {@link javax.security.auth.login.LoginContext} object. 
096     * 
097     * @return the name for the {@link javax.security.auth.login.LoginContext} object
098     */
099    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}