mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Revert "Cleanup DefaultUserAuthenticator and removed masking _name variable"
This reverts commit 4d01ce8fc766423d795955bd5784b56969ce11a8.
This commit is contained in:
parent
4d01ce8fc7
commit
c7cc79181b
@ -19,6 +19,7 @@ package org.apache.cloudstack.ldap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@ -46,6 +47,15 @@ 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,11 +22,12 @@ 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;
|
||||
|
||||
/**
|
||||
@ -58,6 +59,17 @@ 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,15 +15,20 @@
|
||||
|
||||
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})
|
||||
@ -51,6 +56,16 @@ 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,6 +24,7 @@ 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;
|
||||
@ -41,6 +42,16 @@ 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,7 +16,10 @@
|
||||
// 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;
|
||||
|
||||
@ -26,4 +29,28 @@ 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…
x
Reference in New Issue
Block a user