Example usage for org.apache.hadoop.security.token Token readFields

List of usage examples for org.apache.hadoop.security.token Token readFields

Introduction

In this page you can find the example usage for org.apache.hadoop.security.token Token readFields.

Prototype

@Override
    public void readFields(DataInput in) throws IOException 

Source Link

Usage

From source file:org.apache.sqoop.connector.hdfs.security.SecurityUtils.java

License:Apache License

/**
 * Deserialize token from given String./*from www.j  a  v a2 s . co  m*/
 *
 * See serializeToken for details how the token is expected to be serialized.
 */
static public Token deserializeToken(String stringToken) throws IOException {
    Token token = new Token();
    byte[] tokenBytes = Base64.decodeBase64(stringToken);

    ByteArrayInputStream bais = new ByteArrayInputStream(tokenBytes);
    DataInputStream dis = new DataInputStream(bais);
    token.readFields(dis);

    return token;
}

From source file:org.apache.tez.auxservices.ShuffleHandler.java

License:Apache License

static Token<JobTokenIdentifier> deserializeServiceData(ByteBuffer secret) throws IOException {
    DataInputByteBuffer in = new DataInputByteBuffer();
    in.reset(secret);//from  www  .  ja  v a 2  s. c o  m
    Token<JobTokenIdentifier> jt = new Token<JobTokenIdentifier>();
    jt.readFields(in);
    return jt;
}

From source file:org.apache.tez.runtime.library.common.shuffle.ShuffleUtils.java

License:Apache License

public static SecretKey getJobTokenSecretFromTokenBytes(ByteBuffer meta) throws IOException {
    DataInputByteBuffer in = new DataInputByteBuffer();
    in.reset(meta);/*  www. j  av a 2 s .  c  o  m*/
    Token<JobTokenIdentifier> jt = new Token<JobTokenIdentifier>();
    jt.readFields(in);
    SecretKey sk = JobTokenSecretManager.createSecretKey(jt.getPassword());
    return sk;
}