MCPcopy Create free account
hub / github.com/cloudfoundry/cli / isTokenRevocable

Method isTokenRevocable

actor/v7action/auth.go:87–112  ·  view source on GitHub ↗
(token string)

Source from the content-addressed store, hash-verified

85}
86
87func (actor Actor) isTokenRevocable(token string) bool {
88 segments := strings.Split(token, ".")
89
90 if len(segments) < 2 {
91 return false
92 }
93
94 jsonPayload, err := base64.RawURLEncoding.DecodeString(segments[1])
95 if err != nil {
96 return false
97 }
98
99 payload := make(map[string]interface{})
100 err = json.Unmarshal(jsonPayload, &payload)
101 if err != nil {
102 return false
103 }
104
105 revocable, ok := payload["revocable"].(bool)
106
107 if !ok {
108 return false
109 }
110
111 return revocable
112}
113
114var knownAuthPromptTypes = map[string]coreconfig.AuthPromptType{
115 "text": coreconfig.AuthPromptTypeText,

Callers 1

Implementers 1

FakeActorcommand/v7/v7fakes/fake_actor.go

Calls

no outgoing calls

Tested by

no test coverage detected