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

x33g5p2x  于2022-01-16 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(267)

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

Access介绍

[英]TODO
[中]待办事项

代码示例

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

  1. public T fromAccess(Access in) {
  2. return this.token(in.getToken()).user(in.getUser()).services(in);
  3. }
  4. }

代码示例来源:origin: stackoverflow.com

  1. myAccess = new Access();
  2. myAccess.registerErrorHandler(xyz);
  3. myAccess.authenticate(.....);

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

  1. @Override
  2. public String toString() {
  3. return string().toString();
  4. }

代码示例来源:origin: stackoverflow.com

  1. @ManagedBean(name="accessBacking")
  2. @SessionScoped
  3. public class AccessBacking {
  4. private String username;
  5. private String password;
  6. public boolean checkViewAccess() {
  7. Access access = new Access();
  8. if(access.authenticate(username, password)) {
  9. // user is logged in
  10. }
  11. }
  12. }

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

  1. @Override
  2. public String get() {
  3. return supplier.get().getToken().getId();
  4. }
  5. };

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

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

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

  1. public String get() {
  2. return supplier.get().getToken().getId();
  3. }
  4. };

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

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

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

  1. public T fromAccess(Access in) {
  2. return this.token(in.getToken()).user(in.getUser()).services(in);
  3. }
  4. }

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

  1. public String get() {
  2. return supplier.get().getToken().getId();
  3. }
  4. };

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

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

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

  1. public Access build() {
  2. return new Access(token, user, serviceCatalog.build());
  3. }

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

  1. @Override
  2. public String toString() {
  3. return string().toString();
  4. }

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

  1. public T fromAccess(Access in) {
  2. return this.token(in.getToken()).user(in.getUser()).services(in);
  3. }
  4. }

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

  1. @Override
  2. public String get() {
  3. return supplier.get().getToken().getId();
  4. }
  5. };

代码示例来源:origin: org.apache.brooklyn/brooklyn-locations-jclouds

  1. /**
  2. * Injects into the guts of jclouds' openstack-keystone a token that was requested, which
  3. * should last for only 5 seconds. By sleeping for 10 seconds in the test, it should mean
  4. * the token subsequently used by jclouds will expire by the time the second half of the
  5. * test executes.
  6. */
  7. private void injectShortLivedTokenForSwiftAuth() throws Exception {
  8. URL endpointUrl = new URL(endpoint);
  9. Credentials creds = new Credentials(identity, credential);
  10. Set<Service> services = getServices(creds);
  11. HttpToolResponse tokenHttpResponse1 = requestTokenWithExplicitLifetime(endpointUrl,
  12. identity, credential, Duration.FIVE_SECONDS);
  13. Access access = Access.builder()
  14. .user(User.builder()
  15. .id(identity)
  16. .name(identity)
  17. .build())
  18. .token(Token.builder()
  19. .id(tokenHttpResponse1.getHeaderLists().get(AuthHeaders.AUTH_TOKEN).get(0))
  20. .expires(new Date(System.currentTimeMillis() + 5000))
  21. .build())
  22. .services(services)
  23. .build();
  24. getAuthCache(context).put(creds, access);
  25. }

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

  1. public Access build() {
  2. return new Access(token, user, serviceCatalog.build());
  3. }

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

  1. @Override
  2. public String toString() {
  3. return string().toString();
  4. }

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

  1. public T fromAccess(Access in) {
  2. return this.token(in.getToken()).user(in.getUser()).services(in);
  3. }
  4. }

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

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

相关文章