New returns a new unsigned One-Time-Token for authorizing a single request from a newly provisioned end-entity. The current implementation uses jwt.Token and is generated using sane defaults for the claims. See token/options.go for default claim definitions.
(subject string, opts ...token.Options)
| 21 | // for the claims. |
| 22 | // See token/options.go for default claim definitions. |
| 23 | func New(subject string, opts ...token.Options) (*Token, error) { |
| 24 | o := append([]token.Options{token.WithSubject(subject)}, opts...) |
| 25 | c, err := token.NewClaims(o...) |
| 26 | if err != nil { |
| 27 | return nil, err |
| 28 | } |
| 29 | return &Token{claims: c}, nil |
| 30 | } |
| 31 | |
| 32 | // SignedString implementation of the Token interface. It returns a JWT using |
| 33 | // the compact serialization. |