[jboss-cvs] JBossAS SVN: r70485 - in projects/security/security-negotiation/trunk: NegotiationToolkit and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 6 10:33:08 EST 2008


Author: darran.lofthouse at jboss.com
Date: 2008-03-06 10:33:08 -0500 (Thu, 06 Mar 2008)
New Revision: 70485

Added:
   projects/security/security-negotiation/trunk/NegotiationToolkit/descriptors/jaas_authentication.conf
   projects/security/security-negotiation/trunk/NegotiationToolkit/src/main/org/jboss/security/negotiation/toolkit/UsernamePasswordLogon.java
Modified:
   projects/security/security-negotiation/trunk/NegotiationToolkit/build.xml
   projects/security/security-negotiation/trunk/ant.properties.example
   projects/security/security-negotiation/trunk/spnego-configuration/descriptors/testserver.keytab
Log:
[SECURITY-148] Simple command line class to authenticate using the username and password.

Modified: projects/security/security-negotiation/trunk/NegotiationToolkit/build.xml
===================================================================
--- projects/security/security-negotiation/trunk/NegotiationToolkit/build.xml	2008-03-06 15:24:43 UTC (rev 70484)
+++ projects/security/security-negotiation/trunk/NegotiationToolkit/build.xml	2008-03-06 15:33:08 UTC (rev 70485)
@@ -62,4 +62,16 @@
   <target name="deploy" depends="package">
     <copy file="${build.deliverables.dir}/${ant.project.name}.war" todir="${jboss.server.dir}/deploy" />
   </target>
+
+  <target name="RunUsernamePasswordLogon" depends="compile">
+    <java fork="true" classname="org.jboss.security.negotiation.toolkit.UsernamePasswordLogon">
+      <classpath>
+        <pathelement location="${build.classes.dir}" />
+      </classpath>
+
+      <jvmarg value="-Djava.security.auth.login.config=${descriptors.dir}/jaas_authentication.conf" />
+      <jvmarg value="-Djava.security.krb5.kdc=${java.security.krb5.kdc}" />
+      <jvmarg value="-Djava.security.krb5.realm=${java.security.krb5.realm}" />
+    </java>
+  </target>
 </project>
\ No newline at end of file

Added: projects/security/security-negotiation/trunk/NegotiationToolkit/descriptors/jaas_authentication.conf
===================================================================
--- projects/security/security-negotiation/trunk/NegotiationToolkit/descriptors/jaas_authentication.conf	                        (rev 0)
+++ projects/security/security-negotiation/trunk/NegotiationToolkit/descriptors/jaas_authentication.conf	2008-03-06 15:33:08 UTC (rev 70485)
@@ -0,0 +1,6 @@
+// Login configurations for the command line utilities.
+
+UsernamePasswordSample {
+  com.sun.security.auth.module.Krb5LoginModule required
+    debug=true;
+};
\ No newline at end of file

Added: projects/security/security-negotiation/trunk/NegotiationToolkit/src/main/org/jboss/security/negotiation/toolkit/UsernamePasswordLogon.java
===================================================================
--- projects/security/security-negotiation/trunk/NegotiationToolkit/src/main/org/jboss/security/negotiation/toolkit/UsernamePasswordLogon.java	                        (rev 0)
+++ projects/security/security-negotiation/trunk/NegotiationToolkit/src/main/org/jboss/security/negotiation/toolkit/UsernamePasswordLogon.java	2008-03-06 15:33:08 UTC (rev 70485)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * 
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.security.negotiation.toolkit;
+
+import javax.security.auth.Subject;
+import javax.security.auth.login.LoginContext;
+
+import com.sun.security.auth.callback.TextCallbackHandler;
+
+/**
+ * Utility to be called from the command line to verify that it is possible
+ * to authenticate against the KDC when providing the username and password.
+ * 
+ * @author darran.lofthouse at jboss.com
+ * @version $Revision$
+ */
+public class UsernamePasswordLogon
+{
+
+   /**
+    * Utility entry point.
+    */
+   public static void main(String[] args) throws Exception
+   {      
+      System.out.println(" * * UserNamePasswordLogin * *");
+      LoginContext login = new LoginContext("UsernamePasswordSample", new TextCallbackHandler());
+      login.login();
+
+      System.out.println("Authenticated");
+
+      Subject subject = login.getSubject();
+
+      System.out.println("Subject - " + String.valueOf(subject));
+   }
+}


Property changes on: projects/security/security-negotiation/trunk/NegotiationToolkit/src/main/org/jboss/security/negotiation/toolkit/UsernamePasswordLogon.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/security/security-negotiation/trunk/ant.properties.example
===================================================================
--- projects/security/security-negotiation/trunk/ant.properties.example	2008-03-06 15:24:43 UTC (rev 70484)
+++ projects/security/security-negotiation/trunk/ant.properties.example	2008-03-06 15:33:08 UTC (rev 70485)
@@ -1,6 +1,9 @@
 
 # Copy this file to ant.properties and set the values below as
-# is required on your workstation.
+# required on your workstation.
 
 jboss.home=/home/user/jboss-4.2.2.GA
-#jboss.configuration=default
\ No newline at end of file
+#jboss.configuration=default
+
+java.security.krb5.kdc=kdc.jboss.org
+java.security.krb5.realm=JBOSS.ORG
\ No newline at end of file

Modified: projects/security/security-negotiation/trunk/spnego-configuration/descriptors/testserver.keytab
===================================================================
(Binary files differ)




More information about the jboss-cvs-commits mailing list