mirror of
https://github.com/zitadel/zitadel.git
synced 2025-03-04 06:35:12 +00:00
fix: handle possible nil pointer (#1491)
This commit is contained in:
parent
51a76150ca
commit
2d65b94df3
@ -83,13 +83,14 @@ func (o *OPStorage) DeleteAuthRequest(ctx context.Context, id string) (err error
|
|||||||
func (o *OPStorage) CreateToken(ctx context.Context, req op.TokenRequest) (_ string, _ time.Time, err error) {
|
func (o *OPStorage) CreateToken(ctx context.Context, req op.TokenRequest) (_ string, _ time.Time, err error) {
|
||||||
ctx, span := tracing.NewSpan(ctx)
|
ctx, span := tracing.NewSpan(ctx)
|
||||||
defer func() { span.EndWithError(err) }()
|
defer func() { span.EndWithError(err) }()
|
||||||
var userAgentID, applicationID string
|
var userAgentID, applicationID, userOrgID string
|
||||||
authReq, ok := req.(*AuthRequest)
|
authReq, ok := req.(*AuthRequest)
|
||||||
if ok {
|
if ok {
|
||||||
userAgentID = authReq.AgentID
|
userAgentID = authReq.AgentID
|
||||||
applicationID = authReq.ApplicationID
|
applicationID = authReq.ApplicationID
|
||||||
|
userOrgID = authReq.UserOrgID
|
||||||
}
|
}
|
||||||
resp, err := o.command.AddUserToken(ctx, authReq.UserOrgID, userAgentID, applicationID, req.GetSubject(), req.GetAudience(), req.GetScopes(), o.defaultAccessTokenLifetime) //PLANNED: lifetime from client
|
resp, err := o.command.AddUserToken(ctx, userOrgID, userAgentID, applicationID, req.GetSubject(), req.GetAudience(), req.GetScopes(), o.defaultAccessTokenLifetime) //PLANNED: lifetime from client
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", time.Time{}, err
|
return "", time.Time{}, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user