Skip to content
Snippets Groups Projects
Commit 0454787b authored by Gabriel Zachmann's avatar Gabriel Zachmann
Browse files

fix mytoken name not set in JWT

parent 03e51f57
Branches
Tags
No related merge requests found
......@@ -269,10 +269,12 @@ func createMytokenEntry(tx *sqlx.Tx, authFlowInfo *authcodeinforepo.AuthFlowInfo
mytoken.NewMytoken(
oidcSub,
authFlowInfo.Issuer,
authFlowInfo.Name,
authFlowInfo.Restrictions,
authFlowInfo.Capabilities,
authFlowInfo.SubtokenCapabilities,
authFlowInfo.Rotation),
authFlowInfo.Rotation,
),
authFlowInfo.Name, networkData)
if err := ste.InitRefreshToken(token.RefreshToken); err != nil {
return nil, err
......
......@@ -241,8 +241,9 @@ func createMytokenEntry(parent *mytoken.Mytoken, req *response.MytokenFromMytoke
sc = api.TightenCapabilities(capsFromParent, req.SubtokenCapabilities)
}
ste := mytokenrepo.NewMytokenEntry(
mytoken.NewMytoken(parent.OIDCSubject, parent.OIDCIssuer, r, c, sc, req.Rotation),
req.Name, networkData)
mytoken.NewMytoken(parent.OIDCSubject, parent.OIDCIssuer, req.Name, r, c, sc, req.Rotation),
req.Name, networkData,
)
encryptionKey, _, err := encryptionkeyrepo.GetEncryptionKey(nil, parent.ID, req.Mytoken.JWT)
if err != nil {
log.WithError(err).Error()
......
......@@ -87,13 +87,16 @@ func (mt *Mytoken) VerifyCapabilities(required ...api.Capability) bool {
}
// NewMytoken creates a new Mytoken
func NewMytoken(oidcSub, oidcIss string, r restrictions.Restrictions, c, sc api.Capabilities, rot *api.Rotation) *Mytoken {
func NewMytoken(
oidcSub, oidcIss, name string, r restrictions.Restrictions, c, sc api.Capabilities, rot *api.Rotation,
) *Mytoken {
now := unixtime.Now()
mt := &Mytoken{
Version: api.TokenVer,
TokenType: api.TokenType,
ID: mtid.New(),
SeqNo: 1,
Name: name,
IssuedAt: now,
NotBefore: now,
Issuer: config.Get().IssuerURL,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment