You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by er...@apache.org on 2005/03/15 08:44:54 UTC
svn commit: r157529 - in
directory/protocols/kerberos/trunk/common/src/java/org/apache/kerberos/jaas:
CallbackHandlerBean.java Krb5LoginConfiguration.java
Author: erodriguez
Date: Mon Mar 14 23:44:50 2005
New Revision: 157529
URL: http://svn.apache.org/viewcvs?view=rev&rev=157529
Log:
Moved a couple kerberos util classes to kerberos-common component.
Added:
directory/protocols/kerberos/trunk/common/src/java/org/apache/kerberos/jaas/CallbackHandlerBean.java (with props)
Modified:
directory/protocols/kerberos/trunk/common/src/java/org/apache/kerberos/jaas/Krb5LoginConfiguration.java
Added: directory/protocols/kerberos/trunk/common/src/java/org/apache/kerberos/jaas/CallbackHandlerBean.java
URL: http://svn.apache.org/viewcvs/directory/protocols/kerberos/trunk/common/src/java/org/apache/kerberos/jaas/CallbackHandlerBean.java?view=auto&rev=157529
==============================================================================
--- directory/protocols/kerberos/trunk/common/src/java/org/apache/kerberos/jaas/CallbackHandlerBean.java (added)
+++ directory/protocols/kerberos/trunk/common/src/java/org/apache/kerberos/jaas/CallbackHandlerBean.java Mon Mar 14 23:44:50 2005
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.kerberos.jaas;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+
+public class CallbackHandlerBean implements CallbackHandler
+{
+ private String name;
+ private String password;
+
+ public CallbackHandlerBean( String name, String password )
+ {
+ this.name = name;
+ this.password = password;
+ }
+
+ public void handle( Callback[] callbacks )
+ throws UnsupportedCallbackException, IOException
+ {
+ for ( int ii = 0; ii < callbacks.length; ii++ )
+ {
+ Callback callBack = callbacks[ii];
+
+ // Handles username callback.
+ if ( callBack instanceof NameCallback )
+ {
+ NameCallback nameCallback = (NameCallback) callBack;
+ nameCallback.setName(name);
+ // Handles password callback.
+ }
+ else if ( callBack instanceof PasswordCallback )
+ {
+ PasswordCallback passwordCallback = (PasswordCallback) callBack;
+ passwordCallback.setPassword( password.toCharArray() );
+ }
+ else
+ {
+ throw new UnsupportedCallbackException( callBack, "Callback not supported" );
+ }
+ }
+ }
+}
+
Propchange: directory/protocols/kerberos/trunk/common/src/java/org/apache/kerberos/jaas/CallbackHandlerBean.java
------------------------------------------------------------------------------
svn:executable = *
Modified: directory/protocols/kerberos/trunk/common/src/java/org/apache/kerberos/jaas/Krb5LoginConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/protocols/kerberos/trunk/common/src/java/org/apache/kerberos/jaas/Krb5LoginConfiguration.java?view=diff&r1=157528&r2=157529
==============================================================================
--- directory/protocols/kerberos/trunk/common/src/java/org/apache/kerberos/jaas/Krb5LoginConfiguration.java (original)
+++ directory/protocols/kerberos/trunk/common/src/java/org/apache/kerberos/jaas/Krb5LoginConfiguration.java Mon Mar 14 23:44:50 2005
@@ -14,6 +14,7 @@
* limitations under the License.
*
*/
+
package org.apache.kerberos.jaas;
import java.util.HashMap;
@@ -22,21 +23,22 @@
import javax.security.auth.login.Configuration;
import javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag;
-public class Krb5LoginConfiguration extends Configuration {
+public class Krb5LoginConfiguration extends Configuration
+{
private static AppConfigurationEntry[] configList = new AppConfigurationEntry[1];
public Krb5LoginConfiguration()
{
String loginModule = "com.sun.security.auth.module.Krb5LoginModule";
LoginModuleControlFlag flag = LoginModuleControlFlag.REQUIRED;
- configList[0] = new AppConfigurationEntry(loginModule, flag, new HashMap());
+ configList[0] = new AppConfigurationEntry( loginModule, flag, new HashMap() );
}
/**
* Interface method requiring us to return all the LoginModules we know about.
*/
- public AppConfigurationEntry[] getAppConfigurationEntry(String applicationName)
+ public AppConfigurationEntry[] getAppConfigurationEntry( String applicationName )
{
// We will ignore the applicationName, since we want all apps to use Kerberos V5
return configList;