com.evasion.sam.Config Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of evasion-sam-modul Show documentation
Show all versions of evasion-sam-modul Show documentation
API de l'application modulaire evasion-en-ligne
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.evasion.sam;
import com.evasion.sam.jaas.EvasionEJBLoginModule;
import java.util.HashMap;
import java.util.Map;
import javax.security.auth.login.AppConfigurationEntry;
import javax.security.auth.login.Configuration;
/**
*
* @author sglon
*/
public class Config extends Configuration {
public static final String PARAM_EJB_JNDI = "EJB-jndi";
public static final String PARAM_PROVIDER_URL = "provider-url";
public static final String PARAM_DIGEST_ALGORITHM = "digest-algorithm";
public static final String DEFAULT_DIGEST_ALGORITHM = "sha+salt";
String jndi = null;
String digestAlgorithm = null;
String providerUrl = null;
@Override
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
AppConfigurationEntry[] entries = {null};
if ("com.evasion.sam.SAM".equals(name)) {
Map options = new HashMap();
options.put(PARAM_PROVIDER_URL, providerUrl);
options.put(PARAM_EJB_JNDI, jndi);
entries[0] =
new AppConfigurationEntry(
EvasionEJBLoginModule.class.getName(),
AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,
options);
}
return entries;
}
public String getDigestAlgorithm() {
if (digestAlgorithm==null || digestAlgorithm.isEmpty()) {
digestAlgorithm = DEFAULT_DIGEST_ALGORITHM;
}
return digestAlgorithm;
}
public void setDigestAlgorithm(String digestAlgorithm) {
this.digestAlgorithm = digestAlgorithm;
}
public String getJndi() {
return jndi;
}
public void setJndi(String jndi) {
this.jndi = jndi;
}
public String getProviderUrl() {
return providerUrl;
}
public void setProviderUrl(String providerUrl) {
this.providerUrl = providerUrl;
}
}