All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.evasion.sam.Config Maven / Gradle / Ivy

There is a newer version: 2.0.0.2
Show newest version
/*
 * 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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy