summaryrefslogtreecommitdiff
path: root/gnu/javax/crypto/sasl/crammd5/CramMD5AuthInfoProvider.java
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/javax/crypto/sasl/crammd5/CramMD5AuthInfoProvider.java')
-rw-r--r--gnu/javax/crypto/sasl/crammd5/CramMD5AuthInfoProvider.java62
1 files changed, 14 insertions, 48 deletions
diff --git a/gnu/javax/crypto/sasl/crammd5/CramMD5AuthInfoProvider.java b/gnu/javax/crypto/sasl/crammd5/CramMD5AuthInfoProvider.java
index cf73b6f98..dec0366c0 100644
--- a/gnu/javax/crypto/sasl/crammd5/CramMD5AuthInfoProvider.java
+++ b/gnu/javax/crypto/sasl/crammd5/CramMD5AuthInfoProvider.java
@@ -51,44 +51,26 @@ import javax.security.sasl.AuthenticationException;
/**
* The CRAM-MD5 mechanism authentication information provider implementation.
*/
-public class CramMD5AuthInfoProvider implements IAuthInfoProvider
+public class CramMD5AuthInfoProvider
+ implements IAuthInfoProvider
{
-
- // Constants and variables
- // -------------------------------------------------------------------------
-
private PasswordFile passwordFile = null;
- // Constructor(s)
- // -------------------------------------------------------------------------
-
// implicit 0-args constrcutor
- // Class methods
- // -------------------------------------------------------------------------
-
- // IAuthInfoProvider interface implementation
- // -------------------------------------------------------------------------
-
public void activate(Map context) throws AuthenticationException
{
try
{
if (context == null)
- {
- passwordFile = new PasswordFile();
- }
+ passwordFile = new PasswordFile();
else
{
String pfn = (String) context.get(CramMD5Registry.PASSWORD_FILE);
if (pfn == null)
- {
- passwordFile = new PasswordFile();
- }
+ passwordFile = new PasswordFile();
else
- {
- passwordFile = new PasswordFile(pfn);
- }
+ passwordFile = new PasswordFile(pfn);
}
}
catch (IOException x)
@@ -105,10 +87,8 @@ public class CramMD5AuthInfoProvider implements IAuthInfoProvider
public boolean contains(String userName) throws AuthenticationException
{
if (passwordFile == null)
- {
- throw new AuthenticationException("contains()",
- new IllegalStateException());
- }
+ throw new AuthenticationException("contains()",
+ new IllegalStateException());
boolean result = false;
try
{
@@ -124,18 +104,13 @@ public class CramMD5AuthInfoProvider implements IAuthInfoProvider
public Map lookup(Map userID) throws AuthenticationException
{
if (passwordFile == null)
- {
- throw new AuthenticationException("lookup()",
- new IllegalStateException());
- }
+ throw new AuthenticationException("lookup()", new IllegalStateException());
Map result = new HashMap();
try
{
String userName = (String) userID.get(Registry.SASL_USERNAME);
if (userName == null)
- {
- throw new NoSuchUserException("");
- }
+ throw new NoSuchUserException("");
String[] data = passwordFile.lookup(userName);
result.put(Registry.SASL_USERNAME, data[0]);
result.put(Registry.SASL_PASSWORD, data[1]);
@@ -148,9 +123,7 @@ public class CramMD5AuthInfoProvider implements IAuthInfoProvider
catch (Exception x)
{
if (x instanceof AuthenticationException)
- {
- throw (AuthenticationException) x;
- }
+ throw (AuthenticationException) x;
throw new AuthenticationException("lookup()", x);
}
return result;
@@ -159,10 +132,7 @@ public class CramMD5AuthInfoProvider implements IAuthInfoProvider
public void update(Map userCredentials) throws AuthenticationException
{
if (passwordFile == null)
- {
- throw new AuthenticationException("update()",
- new IllegalStateException());
- }
+ throw new AuthenticationException("update()", new IllegalStateException());
try
{
String userName = (String) userCredentials.get(Registry.SASL_USERNAME);
@@ -174,9 +144,7 @@ public class CramMD5AuthInfoProvider implements IAuthInfoProvider
String shell = (String) userCredentials.get(CramMD5Registry.SHELL_FIELD);
if (uid == null || gid == null || gecos == null || dir == null
|| shell == null)
- {
- passwordFile.changePasswd(userName, password);
- }
+ passwordFile.changePasswd(userName, password);
else
{
String[] attributes = new String[] { uid, gid, gecos, dir, shell };
@@ -186,9 +154,7 @@ public class CramMD5AuthInfoProvider implements IAuthInfoProvider
catch (Exception x)
{
if (x instanceof AuthenticationException)
- {
- throw (AuthenticationException) x;
- }
+ throw (AuthenticationException) x;
throw new AuthenticationException("update()", x);
}
}
@@ -197,4 +163,4 @@ public class CramMD5AuthInfoProvider implements IAuthInfoProvider
{
throw new AuthenticationException("", new UnsupportedOperationException());
}
-} \ No newline at end of file
+}