Example usage for java.security URIParameter URIParameter

List of usage examples for java.security URIParameter URIParameter

Introduction

In this page you can find the example usage for java.security URIParameter URIParameter.

Prototype

public URIParameter(java.net.URI uri) 

Source Link

Document

Constructs a URIParameter with the URI pointing to data intended for an SPI implementation.

Usage

From source file:org.apache.storm.security.auth.AuthUtils.java

/**
 * Construct a JAAS configuration object per storm configuration file
 * @param topoConf Storm configuration/*  w  w  w  . j a  va 2  s.c o m*/
 * @return JAAS configuration object
 */
public static Configuration GetConfiguration(Map<String, Object> topoConf) {
    Configuration login_conf = null;

    //find login file configuration from Storm configuration
    String loginConfigurationFile = (String) topoConf.get("java.security.auth.login.config");
    if ((loginConfigurationFile != null) && (loginConfigurationFile.length() > 0)) {
        File config_file = new File(loginConfigurationFile);
        if (!config_file.canRead()) {
            throw new RuntimeException("File " + loginConfigurationFile + " cannot be read.");
        }
        try {
            URI config_uri = config_file.toURI();
            login_conf = Configuration.getInstance("JavaLoginConfig", new URIParameter(config_uri));
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }

    return login_conf;
}

From source file:org.apache.storm.security.auth.ClientAuthUtils.java

/**
 * Construct a JAAS configuration object per storm configuration file
 *
 * @param topoConf Storm configuration/*from  w w w.jav a2s . c  om*/
 * @return JAAS configuration object
 */
public static Configuration getConfiguration(Map<String, Object> topoConf) {
    Configuration login_conf = null;

    //find login file configuration from Storm configuration
    String loginConfigurationFile = (String) topoConf.get("java.security.auth.login.config");
    if ((loginConfigurationFile != null) && (loginConfigurationFile.length() > 0)) {
        File config_file = new File(loginConfigurationFile);
        if (!config_file.canRead()) {
            throw new RuntimeException("File " + loginConfigurationFile + " cannot be read.");
        }
        try {
            URI config_uri = config_file.toURI();
            login_conf = Configuration.getInstance("JavaLoginConfig", new URIParameter(config_uri));
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }

    return login_conf;
}