MakeJWT 시그니처 수정

This commit is contained in:
2025-08-07 15:01:03 +09:00
parent 38a3da271a
commit 54cb3e818f

View File

@ -135,13 +135,13 @@ func init() {
jwtHeader = string(dst[:enclen])
}
func (c *Client) MakeJWT(subject string, ttl time.Duration) string {
func (c *Client) MakeJWT(subject string, role string, ttl time.Duration) string {
if len(c.signingKey) == 0 {
return ""
}
now := time.Now().UTC().Add(ttl).Add(time.Hour).Unix()
src := []byte(fmt.Sprintf(`{"exp":%d,"sub":"%s","roles":"ds_client_full_access"}`, now, subject))
src := []byte(fmt.Sprintf(`{"exp":%d,"sub":"%s","roles":"%s"}`, now, subject, role))
payload := make([]byte, encoding.EncodedLen(len(src)))
encoding.Encode(payload, src)