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


Java OSFactory.clientFromToken方法代码示例

本文整理汇总了Java中org.openstack4j.openstack.OSFactory.clientFromToken方法的典型用法代码示例。如果您正苦于以下问题:Java OSFactory.clientFromToken方法的具体用法?Java OSFactory.clientFromToken怎么用?Java OSFactory.clientFromToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openstack4j.openstack.OSFactory的用法示例。


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

示例1: getAvailableSession

import org.openstack4j.openstack.OSFactory; //导入方法依赖的package包/类
OSClient.OSClientV3 getAvailableSession(Endpoint endpoint) {

        OSClient.OSClientV3 localOs;
        Config config = Config.newConfig().withSSLContext(endpoint.getSslContext()).withHostnameVerifier((hostname, session) -> true);
        if (connectionsMap.containsKey(endpoint)) {
            localOs = OSFactory.clientFromToken(connectionsMap.get(endpoint), Facing.PUBLIC, config);
        } else {
            String endpointURL;
            try {
                endpointURL = prepareEndpointURL(endpoint);
            } catch (URISyntaxException | MalformedURLException e) {
                throw new RuntimeException(e.getMessage(), e);
            }

            // LOGGER
            OSFactory.enableHttpLoggingFilter(log.isDebugEnabled() || log.isInfoEnabled());

            Identifier domainIdentifier = Identifier.byId(endpoint.getDomainId());

            IOSClientBuilder.V3 keystoneV3Builder = OSFactory.builderV3().perspective(Facing.PUBLIC)
                    .endpoint(endpointURL)
                    .credentials(endpoint.getUser(), endpoint.getPassword(), domainIdentifier)
                    .scopeToProject(Identifier.byName(endpoint.getProject()), domainIdentifier)
                    .withConfig(config);

            localOs = keystoneV3Builder.authenticate();
            connectionsMap.put(endpoint, localOs.getToken());
        }

        return localOs;
    }
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:32,代码来源:KeystoneProvider.java

示例2: reauth

import org.openstack4j.openstack.OSFactory; //导入方法依赖的package包/类
public void reauth()
    throws AuthenticationException {
    // Re auth if token expired
  if (this.token.getExpires().getTime() > new Date().getTime()) {
    this.authenticate(); 
  }
  this.os = OSFactory.clientFromToken(this.token);
}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:9,代码来源:NovaV3Context.java

示例3: createOSClient

import org.openstack4j.openstack.OSFactory; //导入方法依赖的package包/类
public OSClient createOSClient(AuthenticatedContext authenticatedContext) {
    String facing = authenticatedContext.getCloudCredential().getStringParameter(FACING);

    if (isV2Keystone(authenticatedContext)) {
        Access access = authenticatedContext.getParameter(Access.class);
        return OSFactory.clientFromAccess(access, Facing.value(facing));
    } else {
        Token token = authenticatedContext.getParameter(Token.class);
        return OSFactory.clientFromToken(token, Facing.value(facing));
    }
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:12,代码来源:OpenStackClient.java

示例4: authFromToken

import org.openstack4j.openstack.OSFactory; //导入方法依赖的package包/类
private OSClient authFromToken() {
  return OSFactory.clientFromToken(token);
}
 
开发者ID:cloudiator,项目名称:sword,代码行数:4,代码来源:OsClientV3Factory.java


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