GetTokenFromContext returns the token, if it is stored in the context, and true if the token is present.
(ctx context.Context)
| 44 | |
| 45 | // GetTokenFromContext returns the token, if it is stored in the context, and true if the token is present. |
| 46 | func GetTokenFromContext(ctx context.Context) (Token, bool) { |
| 47 | val := ctx.Value(tokenKey) |
| 48 | if val == nil { |
| 49 | return nil, false |
| 50 | } |
| 51 | tok, ok := val.(Token) |
| 52 | return tok, ok |
| 53 | } |
| 54 | |
| 55 | // GetAuthHeader creates the valid value for the authentication header |
| 56 | func GetAuthHeader(tok Token) string { |
searching dependent graphs…