Encode returns a serialized version of the Session. The provided session must be a JWTSessionClaims, otherwise this function will panic.
(s Session)
| 75 | // The provided session must be a JWTSessionClaims, otherwise this |
| 76 | // function will panic. |
| 77 | func (c JWTSessionCodec) Encode(s Session) (string, error) { |
| 78 | claims := s.(JWTSessionClaims) // this will panic if you pass the wrong kind of session |
| 79 | |
| 80 | token := jwt.NewWithClaims(c.SigningMethod, claims) |
| 81 | signedString, err := token.SignedString(c.Key) |
| 82 | if err != nil { |
| 83 | return "", err |
| 84 | } |
| 85 | |
| 86 | return signedString, nil |
| 87 | } |
| 88 | |
| 89 | // Decode parses the serialized session that may have been returned by Encode |
| 90 | // and returns a Session. |
nothing calls this directly
no outgoing calls
no test coverage detected