You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by de...@apache.org on 2013/06/20 16:01:05 UTC

svn commit: r1495003 - in /uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/authentication: AuthenticationManager.java IAuthenticationManager.java

Author: degenaro
Date: Thu Jun 20 14:01:05 2013
New Revision: 1495003

URL: http://svn.apache.org/r1495003
Log:
UIMA-3006 DUCC webserver (WS) how to configure authentication - javadoc & example/default

Modified:
    uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/authentication/AuthenticationManager.java
    uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/authentication/IAuthenticationManager.java

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/authentication/AuthenticationManager.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/authentication/AuthenticationManager.java?rev=1495003&r1=1495002&r2=1495003&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/authentication/AuthenticationManager.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/authentication/AuthenticationManager.java Thu Jun 20 14:01:05 2013
@@ -18,102 +18,46 @@
 */
 package org.apache.uima.ducc.common.authentication;
 
-import org.apache.log4j.Logger;
-import org.apache.uima.ducc.common.utils.DuccPropertiesResolver;
-
-
 public class AuthenticationManager implements IAuthenticationManager {
 	
-	private static final IAuthenticationResult default_authenticationResult = new AuthenticationResult();
-	
 	private static IAuthenticationManager instance = new AuthenticationManager();
 	
-	private final String version = "common 1.0";
+	private final String version = "ducc common 1.0 (default)";
 	
 	public static IAuthenticationManager getInstance() {
 		return instance;
 	}
 	
-
+	/**
+	 * Indicate version is default
+	 */
 	public String getVersion() {
 		return version;
 	}
 	
-	
+	/**
+	 * Indicate that password is not checked: false
+	 */
 	public boolean isPasswordChecked() {
 		return false;
 	}
 	
-	
+	/**
+	 * Indicate that authentication is successful
+	 */
 	public IAuthenticationResult isAuthenticate(String userid, String domain, String password) {
-		IAuthenticationResult authenticationResult = default_authenticationResult;
-		String ducc_pw = DuccPropertiesResolver.getInstance().getFileProperty(DuccPropertiesResolver.ducc_ws_authentication_pw);
-		if(ducc_pw != null) {
-			ducc_pw = ducc_pw.trim();
-			if(ducc_pw.equals(password)) {
-				authenticationResult = new AuthenticationResult();
-				authenticationResult.setSuccess();
-			}
-		}
+		AuthenticationResult authenticationResult = new AuthenticationResult();
+		authenticationResult.setSuccess();
 		return authenticationResult;
 	}
 
-
+	/**
+	 * Indicate that role is permitted
+	 */
 	public IAuthenticationResult isGroupMember(String userid, String domain, Role role) {
 		AuthenticationResult authenticationResult = new AuthenticationResult();
 		authenticationResult.setSuccess();
 		return authenticationResult;
 	}
 
-	/*
-	 * <test cases>
-	 */
-	
-	public static final String user = System.getProperty("user.name");
-	
-	private static void testUser(Logger logt, String userid, String password)
-	{
-		testUser(logt,userid,null,password);
-	}
-	
-	private static void testUser(Logger logt, String userid, String domain, String password)
-	{
-		IAuthenticationResult ar = AuthenticationManager.getInstance().isAuthenticate(userid, domain, password);
-		logt.info(userid+" "+ar.isSuccess());
-	}
-	
-	private static void testGroup(Logger logt, String userid, String domain, Role role)
-	{
-		IAuthenticationResult ar = AuthenticationManager.getInstance().isGroupMember(userid,domain,role);
-		logt.info(userid+" "+" "+role+" "+ar.isSuccess());
-	}
-	
-	private static void test(String[] args) 
-	{
-		Logger logt = Logger.getLogger("Test");
-		logt.info("test.enter");
-		testUser(logt,user,"xxxxxxxx");
-		testUser(logt,user,"foobar");
-		testUser(logt,user,"acme.com","xxxxxxxx");
-		testUser(logt,user,"acme.com","foobar");
-		testGroup(logt,user,"",Role.User);
-		testGroup(logt,user,"",Role.Admin);
-		testGroup(logt,"foobar","",Role.User);
-		logt.info("test.exit");
-	}
-	
-	public static void main(String[] args) 
-	{
-		try {
-			test(args);
-			System.out.println("Successs!");
-		}
-		catch(Exception e) {
-			e.printStackTrace();
-		}
-	}
-	
-	/*
-	 * </test cases>
-	 */
 }

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/authentication/IAuthenticationManager.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/authentication/IAuthenticationManager.java?rev=1495003&r1=1495002&r2=1495003&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/authentication/IAuthenticationManager.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/authentication/IAuthenticationManager.java Thu Jun 20 14:01:05 2013
@@ -19,11 +19,50 @@
 package org.apache.uima.ducc.common.authentication;
 
 public interface IAuthenticationManager {
+	
+	/**
+	 * This method is expected to return AuthenticationManager implementation version information.  
+	 * It is nominally displayed by the DUCC webserver on the Login/Logout pages.
+	 * 
+	 * Example return value: Acme Authenticator 1.0
+	 * 
+	 * @return The version of the AuthenticationManager implementation.
+	 */
 	public String getVersion();
+	
+	/**
+	 * This method is expected to return password checking information.  
+	 * It is nominally employed by the DUCC webserver to enable/disable password input area on the Login/Logout pages.
+	 * 
+	 * @return True if the AuthenticationManager implementation checks passwords; false otherwise.
+	 */
 	public boolean isPasswordChecked();
+	
+	/**
+	 * This method is expected to perform authentication.
+	 * It is nominally employed by the DUCC webserver for submitted Login pages.
+	 * 
+	 * @param userid
+	 * @param domain
+	 * @param password
+	 * @return True if authentic userid+domain+password; false otherwise.
+	 */
 	public IAuthenticationResult isAuthenticate(String userid, String domain, String password);
+	
+	/**
+	 * This method is expected to perform role validation.
+	 * It is nominally employed by the DUCC webserver for submitted Login pages.
+	 * 
+	 * @param userid
+	 * @param domain
+	 * @param role
+	 * @return True if authentic userid+domain+role; false otherwise.
+	 */
 	public IAuthenticationResult isGroupMember(String userid, String domain, Role role);
 	
+	/**
+	 * The supported Roles
+	 */
 	public enum Role {
 		User,
 		Admin