org.jclouds.openstack.keystone.v2_0.domain.Token.getTenant()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(205)

本文整理了Java中org.jclouds.openstack.keystone.v2_0.domain.Token.getTenant()方法的一些代码示例,展示了Token.getTenant()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Token.getTenant()方法的具体详情如下:
包路径:org.jclouds.openstack.keystone.v2_0.domain.Token
类名称:Token
方法名:getTenant

Token.getTenant介绍

暂无

代码示例

代码示例来源:origin: com.amysta.jclouds.api/openstack-trove

public Optional<Tenant> apply(Access in){
   return in.getToken().getTenant();
 }
}

代码示例来源:origin: com.amysta.jclouds.labs/rackspace-autoscale

public Optional<Tenant> apply(Access in){
   return in.getToken().getTenant();
 }
}

代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-trove

public Optional<Tenant> apply(Access in){
   return in.getToken().getTenant();
 }
}

代码示例来源:origin: org.apache.jclouds.labs/rackspace-cloudbigdata

public Optional<String> apply(AuthInfo in) {
   if (in instanceof Access) {
    return Access.class.cast(in).getToken().getTenant().transform(new Function<Tenant, String>() {
      @Override
      public String apply(Tenant input) {
       return input.getId();
      }
    });
   } else if (in instanceof Token) {
    // FIXME: What if user authenticated scoped to another project?
    return Optional.of(Token.class.cast(in).user().defaultProjectId());
   }
   return Optional.absent();
 }
}

代码示例来源:origin: apache/jclouds

public Optional<String> apply(AuthInfo in) {
   if (in instanceof Access) {
    return Access.class.cast(in).getToken().getTenant().transform(new Function<Tenant, String>() {
      @Override
      public String apply(Tenant input) {
       return input.getId();
      }
    });
   } else if (in instanceof Token) {
    // FIXME: What if user authenticated scoped to another project?
    return Optional.of(Token.class.cast(in).user().defaultProjectId());
   }
   return Optional.absent();
 }
}

代码示例来源:origin: org.apache.jclouds.labs/rackspace-autoscale

public Optional<String> apply(AuthInfo in){
   if (in instanceof Access) {
    return Access.class.cast(in).getToken().getTenant().transform(new Function<Tenant, String>() {
      @Override
      public String apply(Tenant input) {
       return input.getId();
      }
    });
   } else if (in instanceof Token) {
    // FIXME: What if user authenticated scoped to another project?
    return Optional.of(Token.class.cast(in).user().defaultProjectId());
   }
   return Optional.absent();
 }
}

代码示例来源:origin: org.apache.jclouds.api/openstack-trove

public Optional<String> apply(AuthInfo in) {
   if (in instanceof Access) {
    return Access.class.cast(in).getToken().getTenant().transform(new Function<Tenant, String>() {
      @Override
      public String apply(Tenant input) {
       return input.getId();
      }
    });
   } else if (in instanceof Token) {
    // FIXME: What if user authenticated scoped to another project?
    return Optional.of(Token.class.cast(in).user().defaultProjectId());
   }
   return Optional.absent();
 }
}

代码示例来源:origin: jclouds/legacy-jclouds

private HttpRequest signForTemporaryAccess(HttpRequest request, long timeInSeconds) {
 Credentials currentCreds = checkNotNull(creds.get(), "credential supplier returned null");
 // accessKey is of the form tenantName:accessKeyId (not tenantId)
 String accessKeyId = currentCreds.identity.substring(currentCreds.identity.indexOf(':') + 1);
 String secretKey = currentCreds.credential;
 String tenantId = access.get().getToken().getTenant().get().getId();
 
 HttpRequest.Builder<?> builder = request.toBuilder();
 // HP Cloud does not use X-Auth-Token for temporary signed URLs and
 // leaking this allows clients arbitrary privileges until token timeout.
 builder.filters(filter(request.getFilters(), not(instanceOf(AuthenticateRequest.class))));
 long expiresInSeconds = unixEpochTimestampProvider.get() + timeInSeconds;
 String signature = createSignature(secretKey,
    createStringToSign(request.getMethod().toUpperCase(), request, expiresInSeconds));
 builder.addQueryParam("temp_url_sig", String.format("%s:%s:%s", tenantId, accessKeyId, signature));
 builder.addQueryParam("temp_url_expires", "" + expiresInSeconds);
 return builder.build();
}

代码示例来源:origin: jclouds/legacy-jclouds

public T fromToken(Token in) {
   return this
      .id(in.getId())
      .expires(in.getExpires())
      .tenant(in.getTenant().orNull());
 }
}

代码示例来源:origin: org.apache.jclouds.api/openstack-keystone

public T fromToken(Token in) {
   return this
      .id(in.getId())
      .expires(in.getExpires())
      .tenant(in.getTenant().orNull());
 }
}

代码示例来源:origin: com.amysta.jclouds.api/openstack-keystone

public T fromToken(Token in) {
   return this
      .id(in.getId())
      .expires(in.getExpires())
      .tenant(in.getTenant().orNull());
 }
}

代码示例来源:origin: io.cloudsoft.jclouds.api/openstack-keystone

public T fromToken(Token in) {
   return this
      .id(in.getId())
      .expires(in.getExpires())
      .tenant(in.getTenant().orNull());
 }
}

代码示例来源:origin: org.jclouds.api/openstack-keystone

public T fromToken(Token in) {
   return this
      .id(in.getId())
      .expires(in.getExpires())
      .tenant(in.getTenant().orNull());
 }
}

代码示例来源:origin: Nextdoor/bender

public T fromToken(Token in) {
   return this
      .id(in.getId())
      .expires(in.getExpires())
      .tenant(in.getTenant().orNull());
 }
}

代码示例来源:origin: apache/jclouds

public T fromToken(Token in) {
   return this
      .id(in.getId())
      .expires(in.getExpires())
      .tenant(in.getTenant().orNull());
 }
}

代码示例来源:origin: jclouds/legacy-jclouds

public void testToken() {
 TokenApi tokenApi = api.getTokenApi().get();
 assertTrue(tokenApi.isValid(token));
 Token result = tokenApi.get(token);
 assertNotNull(result);
 assertEquals(result.getId(), token);
 assertNotNull(result.getTenant());
 User user = tokenApi.getUserOfToken(token);
 assertNotNull(user);
 assertNotNull(user.getId());
 assertNotNull(user.getName());
}

代码示例来源:origin: apache/jclouds

public void testToken() {
 TokenApi tokenApi = api.getTokenApi().get();
 assertTrue(tokenApi.isValid(token));
 Token result = tokenApi.get(token);
 assertNotNull(result);
 assertEquals(result.getId(), token);
 assertNotNull(result.getTenant());
 User user = tokenApi.getUserOfToken(token);
 assertNotNull(user);
 assertNotNull(user.getId());
 assertNotNull(user.getName());
}

相关文章