BuildTokenString returns a string typed JSON web token with the specified expiration time
(expiration time.Time)
| 12 | |
| 13 | // BuildTokenString returns a string typed JSON web token with the specified expiration time |
| 14 | func BuildTokenString(expiration time.Time) string { |
| 15 | c := jws.Claims{} |
| 16 | c.SetExpiration(expiration) |
| 17 | c.Set("user_name", "some-user") |
| 18 | c.Set("user_id", "some-guid") |
| 19 | c.Set("origin", "uaa") |
| 20 | token := jws.NewJWT(c, crypto.Unsecured) |
| 21 | tokenBytes, err := token.Serialize(nil) |
| 22 | Expect(err).NotTo(HaveOccurred()) |
| 23 | return string(tokenBytes) |
| 24 | } |
| 25 | |
| 26 | // ParseTokenString takes a string typed token and returns a jwt.JWT struct representation of that token |
| 27 | func ParseTokenString(token string) jwt.JWT { |
no test coverage detected