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

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

本文整理了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

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

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

myAccess = new Access();
myAccess.registerErrorHandler(xyz);
myAccess.authenticate(.....);

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

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

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

@ManagedBean(name="accessBacking")
@SessionScoped
public class AccessBacking {
  private String username;
  private String password;

  public boolean checkViewAccess() {
    Access access = new Access();
    if(access.authenticate(username, password)) {
     // user is logged in  
    }
  }
}

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

@Override
  public String get() {
   return supplier.get().getToken().getId();
  }
};

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

public String get() {
   return supplier.get().getToken().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

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

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

public String get() {
   return supplier.get().getToken().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: jclouds/legacy-jclouds

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

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

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

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

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

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

@Override
  public String get() {
   return supplier.get().getToken().getId();
  }
};

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

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

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

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

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

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

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

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

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

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

相关文章