mirror of https://github.com/apache/cloudstack.git
Cleanup DefaultUserAuthenticator and removed masking _name variable
DefaultUserAuthenticator maskes the _name varible in ComponentLifecycleBase making the setName() method not work as expected. This patch cleans up the code such that getName() will be getClass().getSimpleName() unless overridden in the Spring configuration.
This commit is contained in:
parent
766a0a2229
commit
692535f928
|
|
@ -19,7 +19,6 @@ package org.apache.cloudstack.ldap;
|
|||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -47,15 +46,6 @@ public class LdapAuthenticator extends DefaultUserAuthenticator {
|
|||
_userAccountDao = userAccountDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
if (name == null) {
|
||||
name = "LDAP";
|
||||
}
|
||||
super.configure(name, params);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean authenticate(final String username, final String password,
|
||||
final Long domainId, final Map<String, Object[]> requestParameters) {
|
||||
|
|
|
|||
|
|
@ -22,12 +22,11 @@ import java.util.Map;
|
|||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.user.UserAccount;
|
||||
import com.cloud.user.dao.UserAccountDao;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
/**
|
||||
|
|
@ -59,17 +58,6 @@ public class MD5UserAuthenticator extends DefaultUserAuthenticator {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
if(name == null) {
|
||||
name = "MD5";
|
||||
}
|
||||
super.configure(name, params);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String encode(String password) {
|
||||
MessageDigest md5 = null;
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -15,20 +15,15 @@
|
|||
|
||||
package com.cloud.server.auth;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.user.UserAccount;
|
||||
import com.cloud.user.dao.UserAccountDao;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
|
||||
@Local(value={UserAuthenticator.class})
|
||||
|
|
@ -56,16 +51,6 @@ public class PlainTextUserAuthenticator extends DefaultUserAuthenticator {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
if (name == null) {
|
||||
name = "PLAINTEXT";
|
||||
}
|
||||
super.configure(name, params);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String encode(String password) {
|
||||
// Plaintext so no encoding at all
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import java.util.Map;
|
|||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bouncycastle.util.encoders.Base64;
|
||||
|
|
@ -42,16 +41,6 @@ public class SHA256SaltedUserAuthenticator extends DefaultUserAuthenticator {
|
|||
private UserAccountDao _userAccountDao;
|
||||
private static final int s_saltlen = 32;
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
if (name == null) {
|
||||
name = "SHA256SALT";
|
||||
}
|
||||
super.configure(name, params);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.cloud.server.auth.UserAuthenticator#authenticate(java.lang.String, java.lang.String, java.lang.Long, java.util.Map)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -16,10 +16,7 @@
|
|||
// under the License.
|
||||
package com.cloud.server.auth;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.utils.component.AdapterBase;
|
||||
|
||||
|
|
@ -29,28 +26,4 @@ import com.cloud.utils.component.AdapterBase;
|
|||
*/
|
||||
@Local(value={UserAuthenticator.class})
|
||||
public abstract class DefaultUserAuthenticator extends AdapterBase implements UserAuthenticator {
|
||||
private String _name = null;
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
_name = name;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean start() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stop() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue