124 lines
4.4 KiB
Java
124 lines
4.4 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package javax.baja.security;
|
|
|
|
import java.lang.reflect.Constructor;
|
|
import java.util.HashMap;
|
|
import javax.baja.agent.AgentFilter;
|
|
import javax.baja.agent.AgentList;
|
|
import javax.baja.agent.BIAgent;
|
|
import javax.baja.log.Log;
|
|
import javax.baja.registry.TypeInfo;
|
|
import javax.baja.sys.BObject;
|
|
import javax.baja.sys.Sys;
|
|
import javax.baja.sys.Type;
|
|
import javax.baja.util.Lexicon;
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
public abstract class BAbstractPasswordEncoder
|
|
extends BObject
|
|
implements BIAgent {
|
|
public static final Type TYPE;
|
|
private static Log log;
|
|
private static HashMap encodingTypes;
|
|
static /* synthetic */ Class class$javax$baja$security$BAbstractPasswordEncoder;
|
|
|
|
public Type getType() {
|
|
return TYPE;
|
|
}
|
|
|
|
public abstract void encode(String var1) throws Exception;
|
|
|
|
public abstract void parse(String var1) throws Exception;
|
|
|
|
public abstract String getValue() throws Exception;
|
|
|
|
public abstract String getEncodingType();
|
|
|
|
public abstract boolean isReversible();
|
|
|
|
public abstract boolean validate(String var1) throws Exception;
|
|
|
|
public abstract String getEncodedValue();
|
|
|
|
public String getPortableEncoding() throws Exception {
|
|
throw new UnsupportedOperationException("Encoding [" + this.getEncodingType() + "] does not support portable encoding.");
|
|
}
|
|
|
|
protected static BAbstractPasswordEncoder make(String string) throws Exception {
|
|
string = BAbstractPasswordEncoder.stripBrackets(string);
|
|
String string2 = (String)encodingTypes.get(string);
|
|
Object var2_2 = null;
|
|
if (string2 == null) {
|
|
throw new IllegalArgumentException("unrecognized encoding type: " + string);
|
|
}
|
|
Class<?> clazz = Class.forName(string2);
|
|
Constructor<?> constructor = clazz.getConstructor(null);
|
|
var2_2 = constructor.newInstance(null);
|
|
return var2_2;
|
|
}
|
|
|
|
private static final String stripBrackets(String string) {
|
|
if (string.startsWith("[")) {
|
|
return string.substring(1, string.length() - 1);
|
|
}
|
|
return string;
|
|
}
|
|
|
|
private static final HashMap createEncodingMap() {
|
|
HashMap<String, String> hashMap = new HashMap<String, String>();
|
|
Class clazz = class$javax$baja$security$BAbstractPasswordEncoder;
|
|
if (clazz == null) {
|
|
clazz = class$javax$baja$security$BAbstractPasswordEncoder = BAbstractPasswordEncoder.class("[Ljavax.baja.security.BAbstractPasswordEncoder;", false);
|
|
}
|
|
Lexicon lexicon = Lexicon.make(clazz);
|
|
TypeInfo typeInfo = null;
|
|
AgentList agentList = Sys.getRegistry().getAgents(Sys.getRegistry().getType("baja:Password"));
|
|
agentList = agentList.filter(AgentFilter.is(TYPE));
|
|
int n = 0;
|
|
while (n < agentList.size()) {
|
|
try {
|
|
typeInfo = agentList.get(n).getAgentType();
|
|
Class<?> clazz2 = Class.forName(typeInfo.getTypeClassName());
|
|
String string = (String)clazz2.getField("ENCODING_TYPE").get(null);
|
|
hashMap.put(string, typeInfo.getTypeClassName());
|
|
}
|
|
catch (NoSuchFieldException noSuchFieldException) {
|
|
log.error(lexicon.getText("password.encoder.noTypeField", new Object[]{typeInfo.getTypeName()}));
|
|
}
|
|
catch (Exception exception) {
|
|
log.error(lexicon.getText("password.encoder.genericFailure", new Object[]{typeInfo.getTypeName(), exception}));
|
|
}
|
|
++n;
|
|
}
|
|
return hashMap;
|
|
}
|
|
|
|
static /* synthetic */ Class class(String string, boolean bl) {
|
|
try {
|
|
Class<?> clazz = Class.forName(string);
|
|
if (!bl) {
|
|
clazz = clazz.getComponentType();
|
|
}
|
|
return clazz;
|
|
}
|
|
catch (ClassNotFoundException classNotFoundException) {
|
|
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
|
}
|
|
}
|
|
|
|
static {
|
|
Class clazz = class$javax$baja$security$BAbstractPasswordEncoder;
|
|
if (clazz == null) {
|
|
clazz = class$javax$baja$security$BAbstractPasswordEncoder = BAbstractPasswordEncoder.class("[Ljavax.baja.security.BAbstractPasswordEncoder;", false);
|
|
}
|
|
TYPE = Sys.loadType(clazz);
|
|
log = Log.getLog("baja");
|
|
encodingTypes = BAbstractPasswordEncoder.createEncodingMap();
|
|
}
|
|
}
|
|
|