org.apache.hadoop.fs.swift.auth.entities.AccessToken Java Examples

The following examples show how to use org.apache.hadoop.fs.swift.auth.entities.AccessToken. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SwiftRestClient.java    From sahara-extra with Apache License 2.0 6 votes vote down vote up
@Override
public AccessToken extractResult(AuthPostMethod method) throws IOException {

  //initial check for failure codes leading to authentication failures
  if (method.getStatusCode() == SC_BAD_REQUEST) {
    throw new SwiftAuthenticationFailedException(
      authenticationRequest.toString(), "POST", authUri, method);
  }

  if (authenticationRequest instanceof AuthenticationRequestV2) {
    return extractResultV2(method);
  } else {
    return extractResultV3(method);
  }

}
 
Example #2
Source File: SwiftRestClient.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Setter of authentication and endpoint details.
 * Being synchronized guarantees that all three fields are set up together.
 * It is up to the reader to read all three fields in their own
 * synchronized block to be sure that they are all consistent.
 *
 * @param endpoint endpoint URI
 * @param objectLocation object location URI
 * @param authToken auth token
 */
private void setAuthDetails(URI endpoint,
                            URI objectLocation,
                            AccessToken authToken) {
  if (LOG.isDebugEnabled()) {
    LOG.debug(String.format("setAuth: endpoint=%s; objectURI=%s; token=%s",
            endpoint, objectLocation, authToken));
  }
  synchronized (this) {
    endpointURI = endpoint;
    objectLocationURI = objectLocation;
    token = authToken;
  }
}
 
Example #3
Source File: SwiftRestClient.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Authenticate to Openstack Keystone
 * As well as returning the access token, the member fields {@link #token},
 * {@link #endpointURI} and {@link #objectLocationURI} are set up for re-use.
 * <p>
 * This method is re-entrant -if more than one thread attempts to authenticate
 * neither will block -but the field values with have those of the last caller.
 *
 * @return authenticated access token
 */
public AccessToken authenticate() throws IOException {
  final AuthenticationRequest authenticationRequest;
  if (useKeystoneAuthentication) {
    authenticationRequest = keystoneAuthRequest;
  } else {
    authenticationRequest = authRequest;
  }

  LOG.debug("started authentication");
  return perform("authentication",
                 authUri,
                 new AuthenticationPost(authenticationRequest));
}
 
Example #4
Source File: SwiftRestClient.java    From sahara-extra with Apache License 2.0 5 votes vote down vote up
/**
 * Authenticate to Openstack Keystone
 * As well as returning the access token, the member fields {@link #token},
 * {@link #endpointURI} and {@link #objectLocationURI} are set up for re-use.
 * <p/>
 * This method is re-entrant -if more than one thread attempts to authenticate
 * neither will block -but the field values with have those of the last caller.
 * <p/>
 *
 * @return authenticated access token
 */
public AccessToken authenticate() throws IOException {
  final AuthenticationRequest authenticationRequest;
  if (useKeystoneAuthentication) {
    authenticationRequest = keystoneAuthRequest;
  } else {
    authenticationRequest = authRequest;
  }

  LOG.debug("started authentication");
  return perform("authentication",
                 authUri,
                 new AuthenticationPost(authenticationRequest));
}
 
Example #5
Source File: SwiftRestClient.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Setter of authentication and endpoint details.
 * Being synchronized guarantees that all three fields are set up together.
 * It is up to the reader to read all three fields in their own
 * synchronized block to be sure that they are all consistent.
 *
 * @param endpoint endpoint URI
 * @param objectLocation object location URI
 * @param authToken auth token
 */
private void setAuthDetails(URI endpoint,
                            URI objectLocation,
                            AccessToken authToken) {
  if (LOG.isDebugEnabled()) {
    LOG.debug(String.format("setAuth: endpoint=%s; objectURI=%s; token=%s",
            endpoint, objectLocation, authToken));
  }
  synchronized (this) {
    endpointURI = endpoint;
    objectLocationURI = objectLocation;
    token = authToken;
  }
}
 
Example #6
Source File: SwiftRestClient.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Authenticate to Openstack Keystone
 * As well as returning the access token, the member fields {@link #token},
 * {@link #endpointURI} and {@link #objectLocationURI} are set up for re-use.
 * <p>
 * This method is re-entrant -if more than one thread attempts to authenticate
 * neither will block -but the field values with have those of the last caller.
 *
 * @return authenticated access token
 */
public AccessToken authenticate() throws IOException {
  final AuthenticationRequest authenticationRequest;
  if (useKeystoneAuthentication) {
    authenticationRequest = keystoneAuthRequest;
  } else {
    authenticationRequest = authRequest;
  }

  LOG.debug("started authentication");
  return perform("authentication",
                 authUri,
                 new AuthenticationPost(authenticationRequest));
}
 
Example #7
Source File: SwiftRestClient.java    From sahara-extra with Apache License 2.0 5 votes vote down vote up
/**
 * Setter of authentication and endpoint details.
 * Being synchronized guarantees that all three fields are set up together.
 * It is up to the reader to read all three fields in their own
 * synchronized block to be sure that they are all consistent.
 *
 * @param endpoint endpoint URI
 * @param objectLocation object location URI
 * @param authToken auth token
 */
private void setAuthDetails(URI endpoint,
                            URI objectLocation,
                            AccessToken authToken) {
  if (LOG.isDebugEnabled()) {
    LOG.debug(String.format("setAuth: endpoint=%s; objectURI=%s; token=%s",
            endpoint, objectLocation, authToken));
  }
  synchronized (this) {
    endpointURI = endpoint;
    objectLocationURI = objectLocation;
    token = authToken;
  }
}
 
Example #8
Source File: AuthenticationResponse.java    From sahara-extra with Apache License 2.0 4 votes vote down vote up
public void setToken(AccessToken token) {
  this.token = token;
}
 
Example #9
Source File: SwiftRestClient.java    From hadoop with Apache License 2.0 4 votes vote down vote up
/**
 * token for Swift communication
 */
private synchronized AccessToken getToken() {
  return token;
}
 
Example #10
Source File: AuthenticationResponse.java    From sahara-extra with Apache License 2.0 4 votes vote down vote up
public AccessToken getToken() {
  return token;
}
 
Example #11
Source File: SwiftRestClient.java    From sahara-extra with Apache License 2.0 4 votes vote down vote up
/**
 * token for Swift communication
 */
private synchronized AccessToken getToken() {
  return token;
}
 
Example #12
Source File: AuthenticationResponse.java    From big-c with Apache License 2.0 4 votes vote down vote up
public void setToken(AccessToken token) {
  this.token = token;
}
 
Example #13
Source File: AuthenticationResponse.java    From big-c with Apache License 2.0 4 votes vote down vote up
public AccessToken getToken() {
  return token;
}
 
Example #14
Source File: SwiftRestClient.java    From big-c with Apache License 2.0 4 votes vote down vote up
/**
 * token for Swift communication
 */
private synchronized AccessToken getToken() {
  return token;
}
 
Example #15
Source File: AuthenticationResponse.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public void setToken(AccessToken token) {
  this.token = token;
}
 
Example #16
Source File: AuthenticationResponse.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public AccessToken getToken() {
  return token;
}
 
Example #17
Source File: SwiftRestClient.java    From big-c with Apache License 2.0 2 votes vote down vote up
/**
 * Set the auth key header of the method to the token ID supplied
 *
 * @param method method
 * @param accessToken access token
 * @throws SwiftInternalStateException if the client is not yet authenticated
 */
private void setAuthToken(HttpMethodBase method, AccessToken accessToken)
    throws SwiftInternalStateException {
  checkNotNull(accessToken,"Not authenticated");
  method.addRequestHeader(HEADER_AUTH_KEY, accessToken.getId());
}
 
Example #18
Source File: SwiftRestClient.java    From sahara-extra with Apache License 2.0 2 votes vote down vote up
/**
 * Set the auth key header of the method to the token ID supplied
 *
 * @param method method
 * @param accessToken access token
 * @throws SwiftInternalStateException if the client is not yet authenticated
 */
private void setAuthToken(HttpMethod method, AccessToken accessToken)
    throws SwiftInternalStateException {
  checkNotNull(accessToken,"Not authenticated");
  method.setRequestHeader(HEADER_AUTH_KEY, accessToken.getId());
}
 
Example #19
Source File: SwiftRestClient.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/**
 * Set the auth key header of the method to the token ID supplied
 *
 * @param method method
 * @param accessToken access token
 * @throws SwiftInternalStateException if the client is not yet authenticated
 */
private void setAuthToken(HttpMethodBase method, AccessToken accessToken)
    throws SwiftInternalStateException {
  checkNotNull(accessToken,"Not authenticated");
  method.addRequestHeader(HEADER_AUTH_KEY, accessToken.getId());
}