[ 
https://issues.apache.org/jira/browse/HADOOP-15687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16588682#comment-16588682
 ] 

Lars Francke commented on HADOOP-15687:
---------------------------------------

Sure, sorry.

Use case: Oozie runs a job for me and retrieves all the necessary Delegation 
Tokens. Those are put in a Hadoop Token File. Now I need to get the Delegation 
token in Python to access HDFS via WebHDFS. For this I need to parse the Hadoop 
Token File and get the proper token.

I found the `org.apache.hadoop.security.Credentials` class that allows me to 
access this data. I've just pushed a small project to Github to demonstrate: 
[https://github.com/opencore/hadoop-token-file-utils/blob/master/src/main/java/com/opencore/DelegationTokenReader.java]

Here I can iterate over all tokens and get one by Kind as well. I can also get 
one by Alias 
([https://hadoop.apache.org/docs/r3.1.0/api/org/apache/hadoop/security/Credentials.html#getToken-org.apache.hadoop.io.Text-)].
 If I don't know the alias though the Credentials class does not have an API to 
list all aliases or to get the full map of alias -> token. And that's what I'd 
like to add.

Hope that makes more sense?

As far as I know (but I might be mistaken) there is no other easy way to parse 
the Token File.

 

> Credentials class should allow access to aliases
> ------------------------------------------------
>
>                 Key: HADOOP-15687
>                 URL: https://issues.apache.org/jira/browse/HADOOP-15687
>             Project: Hadoop Common
>          Issue Type: Improvement
>    Affects Versions: 3.1.0
>            Reporter: Lars Francke
>            Priority: Trivial
>
> The credentials class can read token files from disk which are keyed by an 
> alias. It also allows to retrieve tokens by alias and it also allows to list 
> all tokens.
> It does not - however - allow to get the full map of all tokens including the 
> aliases (or at least a list of all aliases).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to