openshift / openshift-restclient-java

Other
78 stars 112 forks source link

Get ServiceAccount Token ala oc sa get-token #441

Closed ridvan70 closed 4 years ago

ridvan70 commented 4 years ago

Hi,

How can a service account token be retrieved by the rest-client?

The tokens retrieved by ocand the rest-client are different. I've analyzed the oc sa get-token ... --loglevel=10 and did the same calls (get ServiceAccount, get Secret) to OCP with rest-client but the token which is returned by oc can not be seen in the response payload of the rest-client call for the SECRET.

Is there an additional step to obtain the service account token, after retrieving the SECRET of the service account?

Regards, Ridvan

adietish commented 4 years ago

Hi @ridvan70

I'm unfortunately completely unaware of this. @jeffmaury, @jcantrill Do you have any idea about this? Alternatively I'd ask in the openshift dev forums/chats about the mechanics required to achieve what you're looking for. Once we know what's needed we could go ahead and implement this in the library. Can you please point me to the places in oc that you looked into and what request you have sent over the wire?

Cheers André

jeffmaury commented 4 years ago

Yes from the secret that is retrieved, the token field is used and base64 decoded

openshift-bot commented 4 years ago

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

openshift-bot commented 4 years ago

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten /remove-lifecycle stale

openshift-bot commented 4 years ago

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen. Mark the issue as fresh by commenting /remove-lifecycle rotten. Exclude this issue from closing again by commenting /lifecycle frozen.

/close

openshift-ci-robot commented 4 years ago

@openshift-bot: Closing this issue.

In response to [this](https://github.com/openshift/openshift-restclient-java/issues/441#issuecomment-739153790): >Rotten issues close after 30d of inactivity. > >Reopen the issue by commenting `/reopen`. >Mark the issue as fresh by commenting `/remove-lifecycle rotten`. >Exclude this issue from closing again by commenting `/lifecycle frozen`. > >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.