Skip to content

Commit

Permalink
Fix userState forwarding in CreateSessionCert (#42135)
Browse files Browse the repository at this point in the history
  • Loading branch information
smallinsky authored May 30, 2024
1 parent 646bd5f commit 7c7c12b
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions lib/auth/sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,18 +473,13 @@ func (a *Server) generateAppToken(ctx context.Context, username string, roles []
return token, nil
}

func (a *Server) CreateSessionCert(user services.UserState, sessionTTL time.Duration, publicKey []byte, compatibility, routeToCluster, kubernetesCluster, loginIP string, attestationReq *keys.AttestationStatement) ([]byte, []byte, error) {
func (a *Server) CreateSessionCert(userState services.UserState, sessionTTL time.Duration, publicKey []byte, compatibility, routeToCluster, kubernetesCluster, loginIP string, attestationReq *keys.AttestationStatement) ([]byte, []byte, error) {
// It's safe to extract the access info directly from services.User because
// this occurs during the initial login before the first certs have been
// generated, so there's no possibility of any active access requests.
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()

userState, err := a.GetUserOrLoginState(ctx, user.GetName())
if err != nil {
return nil, nil, trace.Wrap(err)
}

accessInfo := services.AccessInfoFromUserState(userState)
clusterName, err := a.GetClusterName()
if err != nil {
Expand Down

0 comments on commit 7c7c12b

Please sign in to comment.