MCPcopy Create free account
hub / github.com/bytebase/bytebase / authenticateLogin

Method authenticateLogin

backend/api/v1/auth_service.go:938–954  ·  view source on GitHub ↗

authenticateLogin handles all authentication paths: password, IDP, or MFA completion. Returns the authenticated user and whether password reset is required.

(ctx context.Context, request *v1pb.LoginRequest)

Source from the content-addressed store, hash-verified

936// authenticateLogin handles all authentication paths: password, IDP, or MFA completion.
937// Returns the authenticated user and whether password reset is required.
938func (s *AuthService) authenticateLogin(ctx context.Context, request *v1pb.LoginRequest) (*store.UserMessage, error) {
939 mfaSecondLogin := request.GetMfaTempToken() != ""
940
941 if mfaSecondLogin {
942 return s.completeMFALogin(ctx, request)
943 }
944
945 if request.GetIdpName() != "" {
946 return s.getOrCreateUserWithIDP(ctx, request)
947 }
948
949 if request.EmailCode != nil && *request.EmailCode != "" {
950 return s.authenticateEmailCodeLogin(ctx, request)
951 }
952
953 return s.getAndVerifyUser(ctx, request)
954}
955
956// completeMFALogin validates MFA temp token and verifies OTP or recovery code.
957func (s *AuthService) completeMFALogin(ctx context.Context, request *v1pb.LoginRequest) (*store.UserMessage, error) {

Callers 1

LoginMethod · 0.95

Calls 6

completeMFALoginMethod · 0.95
getAndVerifyUserMethod · 0.95
GetIdpNameMethod · 0.80
GetMfaTempTokenMethod · 0.45

Tested by

no test coverage detected