org.jclouds.openstack.keystone.v2_0.domain.Token类的使用及代码示例

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

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

Token介绍

[英]A token is an arbitrary bit of text that is used to access resources. Each token has a scope which describes which resources are accessible with it. A token may be revoked at anytime and is valid for a finite duration.

While Keystone supports token-based authentication in this release, the intention is for it to support additional protocols in the future. The intent is for it to be an integration service foremost, and not a aspire to be a full-fledged identity store and management solution.
[中]令牌是用于访问资源的任意文本位。每个令牌都有一个作用域,用于描述可以使用它访问哪些资源。代币可以随时撤销,并在有限的期限内有效。
虽然Keystone在此版本中支持基于令牌的身份验证,但其目的是在将来支持其他协议。我们的目的是让它成为一个最重要的集成服务,而不是一个全面的身份存储和管理解决方案。

代码示例

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

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

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

public Token build() {
  return new Token(id, expires, tenant);
}

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

@Override
public int compareTo(Access that) {
 if (that == null)
   return 1;
 if (this == that)
   return 0;
 return this.token.compareTo(that.token);
}

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

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

代码示例来源: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: stackoverflow.com

public void onSuccess(Token token) {
  com.stripe.model.Token stripeToken = com.stripe.model.Token.retrieve(token.getId(), publishableKey);
  com.stripe.model.Card stripeCard = stripeToken.getCard();
  if (stripeCard.getFunding().equals("prepaid") {
    // Reject card
  }
}

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

@Override public Access apply(HttpResponse from) {
  releasePayload(from);
  URI storageUrl = null;
  String authToken = null;
  for (Map.Entry<String, String> entry : from.getHeaders().entries()) {
   String header = entry.getKey();
   if (header.equalsIgnoreCase(STORAGE_URL)) {
     storageUrl = getURI(entry.getValue());
   } else if (header.equalsIgnoreCase(AUTH_TOKEN)) {
     authToken = entry.getValue();
   }
  }
  if (storageUrl == null || authToken == null) {
   throw new AuthorizationException("Invalid headers in TempAuth response " + from);
  }
  // For portability with keystone, based on common knowledge that these tokens tend to expire in 24 hours
  // http://docs.openstack.org/api/openstack-object-storage/1.0/content/authentication-object-dev-guide.html
  Date expires = new Date(System.currentTimeMillis() + TimeUnit.HOURS.toMillis(24));
  return Access.builder()
     .user(User.builder().id(username).name(username).build())
     .token(Token.builder().id(authToken).expires(expires).build())
     .service(Service.builder().name("Object Storage").type(OBJECT_STORE)
     .endpoint(Endpoint.builder().publicURL(storageUrl).id(apiVersion).region(storageUrl.getHost()).build())
     .build()).build();
}

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

@Override
public String toString() {
 return string().toString();
}

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

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

代码示例来源: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());
}

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

@Override
public String getAuthToken() {
 return token.getId();
}

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

@Override public Access apply(HttpResponse from) {
  releasePayload(from);
  URI storageUrl = null;
  String authToken = null;
  for (Map.Entry<String, String> entry : from.getHeaders().entries()) {
   String header = entry.getKey();
   if (header.equalsIgnoreCase(STORAGE_URL)) {
     storageUrl = getURI(entry.getValue());
   } else if (header.equalsIgnoreCase(AUTH_TOKEN)) {
     authToken = entry.getValue();
   }
  }
  if (storageUrl == null || authToken == null) {
   throw new AuthorizationException("Invalid headers in TempAuth response " + from);
  }
  // For portability with keystone, based on common knowledge that these tokens tend to expire in 24 hours
  // http://docs.openstack.org/api/openstack-object-storage/1.0/content/authentication-object-dev-guide.html
  Date expires = new Date(System.currentTimeMillis() + TimeUnit.HOURS.toMillis(24));
  return Access.builder()
     .user(User.builder().id(username).name(username).build())
     .token(Token.builder().id(authToken).expires(expires).build())
     .service(Service.builder().name("Object Storage").type(OBJECT_STORE)
     .endpoint(Endpoint.builder().publicURL(storageUrl).id(apiVersion).region(storageUrl.getHost()).build())
     .build()).build();
}

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

@Override
public String toString() {
 return string().toString();
}

代码示例来源: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: io.cloudsoft.jclouds.api/openstack-trove

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

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

@Override
public String getAuthToken() {
 return token.getId();
}

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

@Override public Access apply(HttpResponse from) {
  releasePayload(from);
  URI storageUrl = null;
  String authToken = null;
  for (Map.Entry<String, String> entry : from.getHeaders().entries()) {
   String header = entry.getKey();
   if (header.equalsIgnoreCase(STORAGE_URL)) {
     storageUrl = getURI(entry.getValue());
   } else if (header.equalsIgnoreCase(AUTH_TOKEN)) {
     authToken = entry.getValue();
   }
  }
  if (storageUrl == null || authToken == null) {
   throw new AuthorizationException("Invalid headers in TempAuth response " + from);
  }
  // For portability with keystone, based on common knowledge that these tokens tend to expire in 24 hours
  // http://docs.openstack.org/api/openstack-object-storage/1.0/content/authentication-object-dev-guide.html
  Date expires = new Date(System.currentTimeMillis() + TimeUnit.HOURS.toMillis(24));
  return Access.builder()
     .user(User.builder().id(username).name(username).build())
     .token(Token.builder().id(authToken).expires(expires).build())
     .service(Service.builder().name("Object Storage").type(OBJECT_STORE)
     .endpoint(Endpoint.builder().publicURL(storageUrl).id(apiVersion).region(storageUrl.getHost()).build())
     .build()).build();
}

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

@Override
public int compareTo(Access that) {
 if (that == null)
   return 1;
 if (this == that)
   return 0;
 return this.token.compareTo(that.token);
}

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

@Override
public String toString() {
 return string().toString();
}

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

public Token build() {
  return new Token(id, expires, tenant);
}

相关文章