package token
import "google.golang.org/grpc/examples/features/authz/token"
Package token implements an example of authorization token encoding/decoding that can be used in RPC headers.
Index ¶
Types ¶
type Token ¶
type Token struct { // Secret is used by the server to authenticate the user Secret string `json:"secret"` // Username is used by the server to assign roles in the metadata for authorization Username string `json:"username"` }
Token is a mock authorization token sent by the client as part of the RPC headers, and used by the server for authorization against a predefined policy.
func (*Token) Decode ¶
Decode updates the internals of Token using the passed in base64 encoded version of the JSON representation of token.
func (*Token) Encode ¶
Encode returns a base64 encoded version of the JSON representation of token.
Source Files ¶
token.go
- Version
- v0.0.0-20250418172310-54e7e26a1f32 (latest)
- Published
- Apr 18, 2025
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 1 minute ago –
Tools for package owners.