当前位置: 首页>>代码示例>>Java>>正文


Java AuthUtils.LOGIN_CONTEXT_SERVER属性代码示例

本文整理汇总了Java中backtype.storm.security.auth.AuthUtils.LOGIN_CONTEXT_SERVER属性的典型用法代码示例。如果您正苦于以下问题:Java AuthUtils.LOGIN_CONTEXT_SERVER属性的具体用法?Java AuthUtils.LOGIN_CONTEXT_SERVER怎么用?Java AuthUtils.LOGIN_CONTEXT_SERVER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在backtype.storm.security.auth.AuthUtils的用法示例。


在下文中一共展示了AuthUtils.LOGIN_CONTEXT_SERVER属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ServerCallbackHandler

public ServerCallbackHandler(Configuration configuration) throws IOException {
    if (configuration == null)
        return;

    AppConfigurationEntry configurationEntries[] = configuration.getAppConfigurationEntry(AuthUtils.LOGIN_CONTEXT_SERVER);
    if (configurationEntries == null) {
        String errorMessage = "Could not find a '" + AuthUtils.LOGIN_CONTEXT_SERVER + "' entry in this configuration: Server cannot start.";
        throw new IOException(errorMessage);
    }
    credentials.clear();
    for (AppConfigurationEntry entry : configurationEntries) {
        Map<String, ?> options = entry.getOptions();
        // Populate DIGEST-MD5 user -> password map with JAAS configuration entries from the "Server" section.
        // Usernames are distinguished from other options by prefixing the username with a "user_" prefix.
        for (Map.Entry<String, ?> pair : options.entrySet()) {
            String key = pair.getKey();
            if (key.startsWith(USER_PREFIX)) {
                String userName = key.substring(USER_PREFIX.length());
                credentials.put(userName, (String) pair.getValue());
            }
        }
    }
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:23,代码来源:ServerCallbackHandler.java

示例2: ServerCallbackHandler

public ServerCallbackHandler(Configuration configuration) throws IOException {
    if (configuration==null) return;

    AppConfigurationEntry configurationEntries[] = configuration.getAppConfigurationEntry(AuthUtils.LOGIN_CONTEXT_SERVER);
    if (configurationEntries == null) {
        String errorMessage = "Could not find a '"+AuthUtils.LOGIN_CONTEXT_SERVER+"' entry in this configuration: Server cannot start.";
        throw new IOException(errorMessage);
    }
    credentials.clear();
    for(AppConfigurationEntry entry: configurationEntries) {
        Map<String,?> options = entry.getOptions();
        // Populate DIGEST-MD5 user -> password map with JAAS configuration entries from the "Server" section.
        // Usernames are distinguished from other options by prefixing the username with a "user_" prefix.
        for(Map.Entry<String, ?> pair : options.entrySet()) {
            String key = pair.getKey();
            if (key.startsWith(USER_PREFIX)) {
                String userName = key.substring(USER_PREFIX.length());
                credentials.put(userName,(String)pair.getValue());
            }
        }
    }
}
 
开发者ID:metamx,项目名称:incubator-storm,代码行数:22,代码来源:ServerCallbackHandler.java

示例3: ServerCallbackHandler

public ServerCallbackHandler(Configuration configuration)
		throws IOException {
	if (configuration == null)
		return;

	AppConfigurationEntry configurationEntries[] = configuration
			.getAppConfigurationEntry(AuthUtils.LOGIN_CONTEXT_SERVER);
	if (configurationEntries == null) {
		String errorMessage = "Could not find a '"
				+ AuthUtils.LOGIN_CONTEXT_SERVER
				+ "' entry in this configuration: Server cannot start.";
		throw new IOException(errorMessage);
	}
	credentials.clear();
	for (AppConfigurationEntry entry : configurationEntries) {
		Map<String, ?> options = entry.getOptions();
		// Populate DIGEST-MD5 user -> password map with JAAS configuration
		// entries from the "Server" section.
		// Usernames are distinguished from other options by prefixing the
		// username with a "user_" prefix.
		for (Map.Entry<String, ?> pair : options.entrySet()) {
			String key = pair.getKey();
			if (key.startsWith(USER_PREFIX)) {
				String userName = key.substring(USER_PREFIX.length());
				credentials.put(userName, (String) pair.getValue());
			}
		}
	}
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:29,代码来源:ServerCallbackHandler.java

示例4: ServerCallbackHandler

public ServerCallbackHandler(Configuration configuration, Map stormConf) throws IOException {
    if (configuration == null)
        return;

    AppConfigurationEntry configurationEntries[] = configuration.getAppConfigurationEntry(AuthUtils.LOGIN_CONTEXT_SERVER);
    if (configurationEntries == null) {
        String errorMessage = "Could not find a '" + AuthUtils.LOGIN_CONTEXT_SERVER + "' entry in this configuration: Server cannot start.";
        LOG.error(errorMessage);
        throw new IOException(errorMessage);
    }

}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:12,代码来源:ServerCallbackHandler.java

示例5: getServerTransportFactory

public TTransportFactory getServerTransportFactory() throws IOException {
    // create an authentication callback handler
    CallbackHandler server_callback_handler = new ServerCallbackHandler(login_conf, storm_conf);

    // login our principal
    Subject subject = null;
    try {
        // specify a configuration object to be used
        Configuration.setConfiguration(login_conf);
        // now login
        Login login = new Login(AuthUtils.LOGIN_CONTEXT_SERVER, server_callback_handler);
        subject = login.getSubject();
    } catch (LoginException ex) {
        LOG.error("Server failed to login in principal:" + ex, ex);
        throw new RuntimeException(ex);
    }

    // check the credential of our principal
    if (subject.getPrivateCredentials(KerberosTicket.class).isEmpty()) {
        throw new RuntimeException("Fail to verify user principal with section \"" + AuthUtils.LOGIN_CONTEXT_SERVER + "\" in login configuration file "
                + login_conf);
    }

    String principal = AuthUtils.get(login_conf, AuthUtils.LOGIN_CONTEXT_SERVER, "principal");
    LOG.debug("principal:" + principal);
    KerberosName serviceKerberosName = new KerberosName(principal);
    String serviceName = serviceKerberosName.getServiceName();
    String hostName = serviceKerberosName.getHostName();
    Map<String, String> props = new TreeMap<String, String>();
    props.put(Sasl.QOP, "auth");
    props.put(Sasl.SERVER_AUTH, "false");

    // create a transport factory that will invoke our auth callback for digest
    TSaslServerTransport.Factory factory = new TSaslServerTransport.Factory();
    factory.addServerDefinition(KERBEROS, serviceName, hostName, props, server_callback_handler);

    // create a wrap transport factory so that we could apply user credential during connections
    TUGIAssumingTransportFactory wrapFactory = new TUGIAssumingTransportFactory(factory, subject);

    LOG.info("SASL GSSAPI transport factory will be used");
    return wrapFactory;
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:42,代码来源:KerberosSaslTransportPlugin.java


注:本文中的backtype.storm.security.auth.AuthUtils.LOGIN_CONTEXT_SERVER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。