Skip to content
This repository has been archived by the owner on Oct 29, 2019. It is now read-only.

Commit

Permalink
SAK-16654 DavRealm logging & code cleanup
Browse files Browse the repository at this point in the history
No functional impact - change system.out.println logging to commons logging, code cleanup.

git-svn-id: https://source.sakaiproject.org/svn/dav/trunk@64253 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
stephen.marquard@uct.ac.za committed Jun 27, 2009
1 parent 4bad988 commit 1cfe3e7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
5 changes: 5 additions & 0 deletions dav-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
<artifactId>jmx</artifactId>
<version>${sakai.tomcat.version}</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
</dependency>
</dependencies>
<build>
<resources>
Expand Down
27 changes: 15 additions & 12 deletions dav-server/src/java/org/sakaiproject/dav/DavRealm.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

import org.apache.catalina.LifecycleException;
import org.apache.catalina.realm.RealmBase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
* Simple implementation of <b>Realm</b> that consults the Sakai user directory service to provide container security equivalent to then application security in CHEF.
Expand All @@ -33,8 +35,11 @@
*/
public final class DavRealm extends RealmBase
{

private static Log M_log = LogFactory.getLog(DavRealm.class);

/** Descriptive information about this Realm implementation. */
protected final String info = "org.sakaiproject.realm.DavRealm/1.0";
protected static final String info = "org.sakaiproject.realm.DavRealm/1.0";

/** Descriptive information about this Realm implementation. */
protected static final String name = "DavRealm";
Expand All @@ -57,12 +62,10 @@ public String getInfo()
*/
public Principal authenticate(String username, String credentials)
{
if (username == null || credentials == null) return (null);
if (username.length() <= 0 || credentials.length() <= 0) return (null);

DavPrincipal prin = new DavPrincipal(username, credentials);
if (username == null || credentials == null) return null;
if (username.length() <= 0 || credentials.length() <= 0) return null;

return prin;
return new DavPrincipal(username, credentials);
}

/**
Expand All @@ -75,9 +78,9 @@ protected String getName()

protected Principal getPrincipal(String username)
{
System.out.println("DavRealm.getPrincipal(" + username + ") -- why is this being called?");
M_log.debug("DavRealm.getPrincipal(" + username + ") -- why is this being called?");

if (username == null) return (null);
if (username == null) return null;

return new DavPrincipal(username, " ");
}
Expand All @@ -87,8 +90,8 @@ protected Principal getPrincipal(String username)
*/
protected String getPassword(String username)
{
System.out.println("DavRealm.getPassword(" + username + ")");
return (null);
M_log.debug("DavRealm.getPassword(" + username + ")");
return null;
}

/**
Expand All @@ -101,7 +104,7 @@ protected String getPassword(String username)
*/
public synchronized void start() throws LifecycleException
{
System.out.println("DavRealm.start()");
M_log.info("start()");

// Perform normal superclass initialization
super.start();
Expand All @@ -125,6 +128,6 @@ public synchronized void stop() throws LifecycleException

public boolean hasRole(Principal principal, String role)
{
return (true);
return true;
}
}

0 comments on commit 1cfe3e7

Please sign in to comment.