MCPcopy Create free account
hub / github.com/crewjam/saml / Encode

Method Encode

samlsp/session_jwt.go:77–87  ·  view source on GitHub ↗

Encode returns a serialized version of the Session. The provided session must be a JWTSessionClaims, otherwise this function will panic.

(s Session)

Source from the content-addressed store, hash-verified

75// The provided session must be a JWTSessionClaims, otherwise this
76// function will panic.
77func (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.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected