Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(idp): add OAuth2 identity provider implementation (#4413)
boojack89a2e199df4a
diff --git a/backend/api/auth/config.go b/backend/api/auth/config.goindex 70c9b47363..976ce45ef9 100644--- a/backend/api/auth/config.go+++ b/backend/api/auth/config.go@@ -1,9 +1,10 @@package authvar authenticationAllowlistMethods = map[string]bool{- "/bytebase.v1.AuthService/Login": true,- "/bytebase.v1.AuthService/Logout": true,- "/bytebase.v1.AuthService/CreateUser": true,+ "/bytebase.v1.AuthService/Login": true,+ "/bytebase.v1.AuthService/Logout": true,+ "/bytebase.v1.AuthService/CreateUser": true,+ "/bytebase.v1.IdentityProviderService/ListIdentityProviders": true,}// IsAuthenticationAllowed returns whether the method is exempted from authentication.diff --git a/backend/api/v1/auth_service.go b/backend/api/v1/auth_service.goindex 6c46e4858e..1ba06a08b0 100644--- a/backend/api/v1/auth_service.go+++ b/backend/api/v1/auth_service.go@@ -18,9 +18,11 @@ import ("github.com/bytebase/bytebase/backend/component/config"api "github.com/bytebase/bytebase/backend/legacyapi"metricAPI "github.com/bytebase/bytebase/backend/metric"+ "github.com/bytebase/bytebase/backend/plugin/idp/oauth2""github.com/bytebase/bytebase/backend/plugin/metric""github.com/bytebase/bytebase/backend/runner/metricreport""github.com/bytebase/bytebase/backend/store"+ storepb "github.com/bytebase/bytebase/proto/generated-go/store"v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")@@ -311,32 +313,30 @@ func convertUserRole(userRole v1pb.UserRole) api.Role {return api.UnknownRole}-// Login is the auth login method.+// Login is the auth login method including SSO.func (s *AuthService) Login(ctx context.Context, request *v1pb.LoginRequest) (*v1pb.LoginResponse, error) {- user, err := s.store.GetUserByEmail(ctx, request.Email)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to get principal by email %q", request.Email)- }- if user == nil {- return nil, status.Errorf(codes.Unauthenticated, "user %q not found", request.Email)+ var loginUser *store.UserMessage+ var err error+ if request.IdpName == "" {+ loginUser, err = s.getUserWithLoginRequestOfBytebase(ctx, request)+ } else {+ loginUser, err = s.getUserWithLoginRequestOfIdentityProvider(ctx, request)}- if user.MemberDeleted {- return nil, status.Errorf(codes.Unauthenticated, "user %q has been deactivated by administrators", request.Email)+ if err != nil {+ return nil, err}- // Compare the stored hashed password, with the hashed version of the password that was received.- if err := bcrypt.CompareHashAndPassword([]byte(user.PasswordHash), []byte(request.Password)); err != nil {- // If the two passwords don't match, return a 401 status.- return nil, status.Errorf(codes.InvalidArgument, "incorrect password")+ if loginUser == nil {+ return nil, status.Errorf(codes.Unauthenticated, "login user not found")}var accessToken stringif request.Web {- token, err := auth.GenerateAccessToken(user.Name, user.ID, s.profile.Mode, s.secret)+ token, err := auth.GenerateAccessToken(loginUser.Name, loginUser.ID, s.profile.Mode, s.secret)if err != nil {return nil, status.Errorf(codes.Internal, "failed to generate API access token")}accessToken = token- refreshToken, err := auth.GenerateRefreshToken(user.Name, user.ID, s.profile.Mode, s.secret)+ refreshToken, err := auth.GenerateRefreshToken(loginUser.Name, loginUser.ID, s.profile.Mode, s.secret)if err != nil {return nil, status.Errorf(codes.Internal, "failed to generate API access token")}@@ -344,12 +344,12 @@ func (s *AuthService) Login(ctx context.Context, request *v1pb.LoginRequest) (*vif err := grpc.SetHeader(ctx, metadata.New(map[string]string{auth.GatewayMetadataAccessTokenKey: accessToken,auth.GatewayMetadataRefreshTokenKey: refreshToken,- auth.GatewayMetadataUserIDKey: fmt.Sprintf("%d", user.ID),+ auth.GatewayMetadataUserIDKey: fmt.Sprintf("%d", loginUser.ID),})); err != nil {return nil, status.Errorf(codes.Internal, "failed to set grpc header, error: %v", err)}} else {- token, err := auth.GenerateAPIToken(user.Name, user.ID, s.profile.Mode, s.secret)+ token, err := auth.GenerateAPIToken(loginUser.Name, loginUser.ID, s.profile.Mode, s.secret)if err != nil {return nil, status.Errorf(codes.Internal, "failed to generate API access token")}@@ -360,7 +360,7 @@ func (s *AuthService) Login(ctx context.Context, request *v1pb.LoginRequest) (*v}, nil}-// Logout is the auth logtou method.+// Logout is the auth logout method.func (*AuthService) Logout(ctx context.Context, _ *v1pb.LogoutRequest) (*emptypb.Empty, error) {if err := grpc.SetHeader(ctx, metadata.New(map[string]string{auth.GatewayMetadataAccessTokenKey: "",@@ -371,3 +371,104 @@ func (*AuthService) Logout(ctx context.Context, _ *v1pb.LogoutRequest) (*emptypb}return &emptypb.Empty{}, nil}++func (s *AuthService) getUserWithLoginRequestOfBytebase(ctx context.Context, request *v1pb.LoginRequest) (*store.UserMessage, error) {+ user, err := s.store.GetUserByEmail(ctx, request.Email)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to get principal by email %q", request.Email)+ }+ if user == nil {+ return nil, status.Errorf(codes.Unauthenticated, "user %q not found", request.Email)+ }+ if user.MemberDeleted {+ return nil, status.Errorf(codes.Unauthenticated, "user %q has been deactivated by administrators", request.Email)+ }+ // Disallow user from identity provider login without SSO.+ if user.IdentityProviderResourceID != nil {+ return nil, status.Errorf(codes.InvalidArgument, "user %q only can login by SSO", request.Email)+ }+ // Compare the stored hashed password, with the hashed version of the password that was received.+ if err := bcrypt.CompareHashAndPassword([]byte(user.PasswordHash), []byte(request.Password)); err != nil {+ // If the two passwords don't match, return a 401 status.+ return nil, status.Errorf(codes.InvalidArgument, "incorrect password")+ }+ return user, nil+}++func (s *AuthService) getUserWithLoginRequestOfIdentityProvider(ctx context.Context, request *v1pb.LoginRequest) (*store.UserMessage, error) {+ identityProviderID, err := getIdentityProviderID(request.IdpName)+ if err != nil {+ return nil, status.Errorf(codes.InvalidArgument, err.Error())+ }++ identityProvider, err := s.store.GetIdentityProvider(ctx, &store.FindIdentityProviderMessage{+ ResourceID: &identityProviderID,+ })+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to get identity provider")+ }+ if identityProvider == nil {+ return nil, status.Errorf(codes.NotFound, "identity provider not found")+ }++ var userInfo *storepb.IdentityProviderUserInfo+ if identityProvider.Type == storepb.IdentityProviderType_OAUTH2 {+ oauth2Context := request.Context.GetOauth2Context()+ if oauth2Context == nil {+ return nil, status.Errorf(codes.InvalidArgument, "missing OAuth2 context")+ }+ oauth2IdentityProvider, err := oauth2.NewIdentityProvider(identityProvider.Config.GetOauth2Config())+ if err != nil {+ return nil, status.Errorf(codes.NotFound, "failed to new oauth2 identity provider")+ }+ redirectURL := fmt.Sprintf("%s/oauth/callback", s.profile.ExternalURL)+ token, err := oauth2IdentityProvider.ExchangeToken(ctx, redirectURL, oauth2Context.Code)+ if err != nil {+ return nil, status.Errorf(codes.InvalidArgument, err.Error())+ }+ userInfo, err = oauth2IdentityProvider.UserInfo(token)+ if err != nil {+ return nil, status.Errorf(codes.InvalidArgument, err.Error())+ }+ } else {+ return nil, status.Errorf(codes.InvalidArgument, "identity provider type %s not supported", identityProvider.Type.String())+ }++ if userInfo == nil {+ return nil, status.Errorf(codes.NotFound, "identity provider user info not found")+ }+ user, err := s.store.GetUser(ctx, &store.FindUserMessage{+ IdentityProviderResourceID: &identityProvider.ResourceID,+ IdentityProviderUserIdentifier: userInfo.Identifier,+ ShowDeleted: true,+ })+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to get principal")+ }+ if user == nil {+ // Generate random password for new users from identity provider.+ password, err := common.RandomString(20)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to generate random password")+ }+ passwordHash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to generate password hash")+ }+ newUser, err := s.store.CreateUser(ctx, &store.UserMessage{+ Name: userInfo.DisplayName,+ Email: userInfo.Email,+ Type: api.EndUser,+ PasswordHash: string(passwordHash),+ IdentityProviderResourceID: &identityProvider.ResourceID,+ IdentityProviderUserInfo: userInfo,+ }, api.SystemBotID)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to create user, error: %v", err)+ }+ user = newUser+ } else if user.MemberDeleted {+ return nil, status.Errorf(codes.Unauthenticated, "user has been deactivated by administrators")+ }+ return user, nil+}diff --git a/backend/api/v1/idp_service.go b/backend/api/v1/idp_service.goindex 136f8c9d49..0367524d35 100644--- a/backend/api/v1/idp_service.go+++ b/backend/api/v1/idp_service.go@@ -105,11 +105,11 @@ func (s *IdentityProviderService) UpdateIdentityProvider(ctx context.Context, re}for _, path := range request.UpdateMask.Paths {switch path {- case "identityProvider.title":+ case "identity_provider.title":patch.Title = &request.IdentityProvider.Title- case "identityProvider.domain":+ case "identity_provider.domain":patch.Domain = &request.IdentityProvider.Domain- case "identityProvider.config":+ case "identity_provider.config":patch.Config = convertIdentityProviderConfigToStore(request.IdentityProvider.Config)}}diff --git a/backend/plugin/idp/oauth2/oauth2.go b/backend/plugin/idp/oauth2/oauth2.gonew file mode 100644index 0000000000..f47e00b5ce--- /dev/null+++ b/backend/plugin/idp/oauth2/oauth2.go@@ -0,0 +1,116 @@+// Package oauth2 is the plugin for OAuth2 Identity Provider.+package oauth2++import (+ "context"+ "encoding/json"+ "fmt"+ "io"+ "net/http"++ "github.com/pkg/errors"+ "golang.org/x/oauth2"++ storepb "github.com/bytebase/bytebase/proto/generated-go/store"+)++// IdentityProvider represents an OAuth2 Identity Provider.+type IdentityProvider struct {+ config *storepb.OAuth2IdentityProviderConfig+}++// NewIdentityProvider initializes a new OAuth2 Identity Provider with the given configuration.+func NewIdentityProvider(config *storepb.OAuth2IdentityProviderConfig) (*IdentityProvider, error) {+ for v, field := range map[string]string{+ config.ClientId: "clientId",+ config.ClientSecret: "clientSecret",+ config.TokenUrl: "tokenUrl",+ config.UserInfoUrl: "userInfoUrl",+ config.FieldMapping.Identifier: "fieldMapping.identifier",+ } {+ if v == "" {+ return nil, errors.Errorf(`the field "%s" is empty but required`, field)+ }+ }++ return &IdentityProvider{+ config: config,+ }, nil+}++// ExchangeToken returns the exchanged OAuth2 token using the given authorization code.+func (p *IdentityProvider) ExchangeToken(ctx context.Context, redirectURL, code string) (string, error) {+ conf := &oauth2.Config{+ ClientID: p.config.ClientId,+ ClientSecret: p.config.ClientSecret,+ RedirectURL: redirectURL,+ Scopes: p.config.Scopes,+ Endpoint: oauth2.Endpoint{+ AuthURL: p.config.AuthUrl,+ TokenURL: p.config.TokenUrl,+ AuthStyle: oauth2.AuthStyleInParams,+ },+ }++ token, err := conf.Exchange(ctx, code)+ if err != nil {+ return "", errors.Wrap(err, "failed to exchange OAuth token")+ }++ accessToken, ok := token.Extra("access_token").(string)+ if !ok {+ return "", errors.New(`missing "access_token" from authorization response`)+ }++ return accessToken, nil+}++// UserInfo returns the parsed user information using the given OAuth2 token.+func (p *IdentityProvider) UserInfo(token string) (*storepb.IdentityProviderUserInfo, error) {+ client := &http.Client{}+ req, err := http.NewRequest(http.MethodGet, p.config.UserInfoUrl, nil)+ if err != nil {+ return nil, errors.Wrap(err, "failed to new http request")+ }+ req.Header.Set("Content-Type", "application/json")+ req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token))+ resp, err := client.Do(req)+ if err != nil {+ return nil, errors.Wrap(err, "failed to get user info")+ }+ body, err := io.ReadAll(resp.Body)+ if err != nil {+ return nil, errors.Wrap(err, "failed to read response body")+ }++ rawClaims := string(body)+ var claims map[string]any+ err = json.Unmarshal([]byte(rawClaims), &claims)+ if err != nil {+ return nil, errors.Wrap(err, "failed to unmarshal raw response body")+ }++ userInfo := &storepb.IdentityProviderUserInfo{}+ if v, ok := claims[p.config.FieldMapping.Identifier].(string); ok {+ userInfo.Identifier = v+ }+ if userInfo.Identifier == "" {+ return nil, errors.Errorf("the field %q is not found in claims or has empty value", p.config.FieldMapping.Identifier)+ }++ // Best effort to map optional fields+ if p.config.FieldMapping.DisplayName != "" {+ if v, ok := claims[p.config.FieldMapping.DisplayName].(string); ok {+ userInfo.DisplayName = v+ }+ }+ if userInfo.DisplayName == "" {+ userInfo.DisplayName = userInfo.Identifier+ }+ if p.config.FieldMapping.Email != "" {+ if v, ok := claims[p.config.FieldMapping.Email].(string); ok {+ userInfo.Email = v+ }+ }+ return userInfo, nil+}diff --git a/backend/plugin/idp/oauth2/oauth2_test.go b/backend/plugin/idp/oauth2/oauth2_test.gonew file mode 100644index 0000000000..863159e046--- /dev/null+++ b/backend/plugin/idp/oauth2/oauth2_test.go@@ -0,0 +1,163 @@+package oauth2++import (+ "context"+ "encoding/json"+ "fmt"+ "io"+ "net/http"+ "net/http/httptest"+ "net/url"+ "testing"++ "github.com/stretchr/testify/assert"+ "github.com/stretchr/testify/require"++ storepb "github.com/bytebase/bytebase/proto/generated-go/store"+)++func TestNewIdentityProvider(t *testing.T) {+ tests := []struct {+ name string+ config *storepb.OAuth2IdentityProviderConfig+ containsErr string+ }{+ {+ name: "no tokenUrl",+ config: &storepb.OAuth2IdentityProviderConfig{+ ClientId: "test-client-id",+ ClientSecret: "test-client-secret",+ AuthUrl: "",+ TokenUrl: "",+ UserInfoUrl: "https://example.com/api/user",+ FieldMapping: &storepb.FieldMapping{+ Identifier: "login",+ },+ },+ containsErr: `the field "tokenUrl" is empty but required`,+ },+ {+ name: "no userInfoUrl",+ config: &storepb.OAuth2IdentityProviderConfig{+ ClientId: "test-client-id",+ ClientSecret: "test-client-secret",+ AuthUrl: "",+ TokenUrl: "https://example.com/token",+ UserInfoUrl: "",+ FieldMapping: &storepb.FieldMapping{+ Identifier: "login",+ },+ },+ containsErr: `the field "userInfoUrl" is empty but required`,+ },+ {+ name: "no field mapping identifier",+ config: &storepb.OAuth2IdentityProviderConfig{+ ClientId: "test-client-id",+ ClientSecret: "test-client-secret",+ AuthUrl: "",+ TokenUrl: "https://example.com/token",+ UserInfoUrl: "https://example.com/api/user",+ FieldMapping: &storepb.FieldMapping{+ Identifier: "",+ },+ },+ containsErr: `the field "fieldMapping.identifier" is empty but required`,+ },+ }+ for _, test := range tests {+ t.Run(test.name, func(t *testing.T) {+ _, err := NewIdentityProvider(test.config)+ assert.ErrorContains(t, err, test.containsErr)+ })+ }+}++func newMockServer(t *testing.T, code, accessToken string, userinfo []byte) *httptest.Server {+ mux := http.NewServeMux()++ var rawIDToken string+ mux.HandleFunc("/oauth2/token", func(w http.ResponseWriter, r *http.Request) {+ require.Equal(t, http.MethodPost, r.Method)++ body, err := io.ReadAll(r.Body)+ require.NoError(t, err)+ vals, err := url.ParseQuery(string(body))+ require.NoError(t, err)++ require.Equal(t, code, vals.Get("code"))+ require.Equal(t, "authorization_code", vals.Get("grant_type"))++ w.Header().Set("Content-Type", "application/json")+ err = json.NewEncoder(w).Encode(map[string]any{+ "access_token": accessToken,+ "token_type": "Bearer",+ "refresh_token": "test-refresh-token",+ "expires_in": 3600,+ "id_token": rawIDToken,+ })+ require.NoError(t, err)+ })+ mux.HandleFunc("/oauth2/userinfo", func(w http.ResponseWriter, r *http.Request) {+ w.Header().Set("Content-Type", "application/json")+ _, err := w.Write(userinfo)+ require.NoError(t, err)+ })++ s := httptest.NewServer(mux)++ return s+}++func TestIdentityProvider(t *testing.T) {+ ctx := context.Background()++ const (+ testClientID = "test-client-id"+ testCode = "test-code"+ testAccessToken = "test-access-token"+ testSubject = "123456789"+ testName = "John Doe"+ testEmail = "[email protected]"+ )+ userInfo, err := json.Marshal(+ map[string]any{+ "sub": testSubject,+ "name": testName,+ "email": testEmail,+ },+ )+ require.NoError(t, err)++ s := newMockServer(t, testCode, testAccessToken, userInfo)++ oauth2, err := NewIdentityProvider(+ &storepb.OAuth2IdentityProviderConfig{+ ClientId: testClientID,+ ClientSecret: "test-client-secret",+ TokenUrl: fmt.Sprintf("%s/oauth2/token", s.URL),+ UserInfoUrl: fmt.Sprintf("%s/oauth2/userinfo", s.URL),+ FieldMapping: &storepb.FieldMapping{+ Identifier: "sub",+ DisplayName: "name",+ Email: "email",+ },+ },+ )+ require.NoError(t, err)++ redirectURL := "https://example.com/oauth/callback"+ oauthToken, err := oauth2.ExchangeToken(ctx, redirectURL, testCode)+ require.NoError(t, err)+ require.Equal(t, testAccessToken, oauthToken)++ userInfoResult, err := oauth2.UserInfo(oauthToken)+ require.NoError(t, err)++ wantUserInfo := &storepb.IdentityProviderUserInfo{+ Identifier: testSubject,+ DisplayName: testName,+ Email: testEmail,+ }+ assert.Equal(t, wantUserInfo, userInfoResult)+}diff --git a/backend/store/idp.go b/backend/store/idp.goindex c898d6e894..f697bde92e 100644--- a/backend/store/idp.go+++ b/backend/store/idp.go@@ -263,7 +263,7 @@ func (*Store) listIdentityProvidersImpl(ctx context.Context, tx *Tx, find *FindIconfig,row_statusFROM idp- WHERE `+strings.Join(where, " AND "),+ WHERE `+strings.Join(where, " AND ")+` ORDER BY id ASC`,args...,)if err != nil {diff --git a/backend/store/principal.go b/backend/store/principal.goindex d3484dbcdd..4c26dc94cc 100644--- a/backend/store/principal.go+++ b/backend/store/principal.go@@ -3,13 +3,16 @@ package storeimport ("context""database/sql"+ "encoding/json""fmt""strings""github.com/pkg/errors"+ "google.golang.org/protobuf/encoding/protojson""github.com/bytebase/bytebase/backend/common"api "github.com/bytebase/bytebase/backend/legacyapi"+ storepb "github.com/bytebase/bytebase/proto/generated-go/store")// GetPrincipalList gets a list of Principal instances.@@ -69,10 +72,13 @@ func composePrincipal(user *UserMessage) (*api.Principal, error) {// FindUserMessage is the message for finding users.type FindUserMessage struct {- ID *int- Email *string- Role *api.Role- ShowDeleted bool+ ID *int+ Email *string+ Role *api.Role+ ShowDeleted bool+ IdentityProviderResourceID *string+ // Available only if the IdentityProviderResourceID is not nil.+ IdentityProviderUserIdentifier string}// UpdateUserMessage is the message to update a user.@@ -92,12 +98,34 @@ type UserMessage struct {Type api.PrincipalTypePasswordHash stringIdentityProviderResourceID *string- // IdentityProviderUserInfo is a raw json string from userinfo api response.- // e.g. for GitHub's authenticated user api, it looks like the following structure.- // https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user- IdentityProviderUserInfo string- Role api.Role- MemberDeleted bool+ IdentityProviderUserInfo *storepb.IdentityProviderUserInfo+ Role api.Role+ MemberDeleted bool+}++// GetUser gets an user.+func (s *Store) GetUser(ctx context.Context, find *FindUserMessage) (*UserMessage, error) {+ tx, err := s.db.BeginTx(ctx, nil)+ if err != nil {+ return nil, FormatError(err)+ }+ defer tx.Rollback()++ users, err := s.listUserImpl(ctx, tx, find)+ if err != nil {+ return nil, err+ }++ if err := tx.Commit(); err != nil {+ return nil, FormatError(err)+ }++ if len(users) == 0 {+ return nil, nil+ } else if len(users) > 1 {+ return nil, &common.Error{Code: common.Conflict, Err: errors.Errorf("found %d users with filter %+v, expect 1", len(users), find)}+ }+ return users[0], nil}// ListUsers list all users.@@ -192,7 +220,7 @@ func (s *Store) GetUserByEmail(ctx context.Context, email string) (*UserMessage,}// GetUserByEmailV2 gets an instance of Principal.-func (*Store) listUserImpl(ctx context.Context, tx *Tx, find *FindUserMessage) ([]*UserMessage, error) {+func (s *Store) listUserImpl(ctx context.Context, tx *Tx, find *FindUserMessage) ([]*UserMessage, error) {where, args := []string{"TRUE"}, []interface{}{}if v := find.ID; v != nil {where, args = append(where, fmt.Sprintf("principal.id = $%d", len(args)+1)), append(args, *v)@@ -209,6 +237,17 @@ func (*Store) listUserImpl(ctx context.Context, tx *Tx, find *FindUserMessage) (var userMessages []*UserMessageif common.FeatureFlag(common.FeatureFlagNoop) {+ if find.IdentityProviderResourceID != nil {+ // Get identity provider's UID with resource id.+ identityProvider, err := s.GetIdentityProvider(ctx, &FindIdentityProviderMessage{+ ResourceID: find.IdentityProviderResourceID,+ })+ if err != nil {+ return nil, err+ }+ where, args = append(where, fmt.Sprintf("principal.idp_id = $%d", len(args)+1)), append(args, identityProvider.UID)+ where = append(where, fmt.Sprintf("principal.idp_user_info->>'identifier' = '%s'", find.IdentityProviderUserIdentifier))+ }rows, err := tx.QueryContext(ctx, `SELECTprincipal.id AS user_id,@@ -233,13 +272,14 @@ func (*Store) listUserImpl(ctx context.Context, tx *Tx, find *FindUserMessage) (for rows.Next() {var userMessage UserMessagevar role, rowStatus, idpResourceID sql.NullString+ var idpUserInfo stringif err := rows.Scan(&userMessage.ID,&userMessage.Email,&userMessage.Name,&userMessage.Type,&userMessage.PasswordHash,- &userMessage.IdentityProviderUserInfo,+ &idpUserInfo,&role,&rowStatus,&idpResourceID,@@ -260,6 +300,11 @@ func (*Store) listUserImpl(ctx context.Context, tx *Tx, find *FindUserMessage) (}if idpResourceID.Valid {userMessage.IdentityProviderResourceID = &idpResourceID.String+ var identityProviderUserInfo storepb.IdentityProviderUserInfo+ if err := json.Unmarshal([]byte(idpUserInfo), &identityProviderUserInfo); err != nil {+ return nil, err+ }+ userMessage.IdentityProviderUserInfo = &identityProviderUserInfo}userMessages = append(userMessages, &userMessage)}@@ -350,7 +395,11 @@ func (s *Store) CreateUser(ctx context.Context, create *UserMessage, creatorID ireturn nil, errors.Wrapf(err, "failed to find identity provider with resource id %s", *create.IdentityProviderResourceID)}set, args = append(set, "idp_id"), append(args, identityProvider.UID)- set, args = append(set, "idp_user_info"), append(args, create.IdentityProviderUserInfo)+ userInfoBytes, err := protojson.Marshal(create.IdentityProviderUserInfo)+ if err != nil {+ return nil, err+ }+ set, args = append(set, "idp_user_info"), append(args, string(userInfoBytes))}}placeholder := []string{}diff --git a/frontend/src/types/proto/store/idp.ts b/frontend/src/types/proto/store/idp.tsindex 8aa0aa0d55..662e1a9e2a 100644--- a/frontend/src/types/proto/store/idp.ts+++ b/frontend/src/types/proto/store/idp.ts@@ -85,6 +85,15 @@ export interface FieldMapping {email: string;}+export interface IdentityProviderUserInfo {+ /** Identifier is the value of the unique identifier in 3rd-party idp user info. */+ identifier: string;+ /** DisplayName is the value of display name in 3rd-party idp user info. */+ displayName: string;+ /** Email is the value of primary email in 3rd-party idp user info. */+ email: string;+}+function createBaseIdentityProviderConfig(): IdentityProviderConfig {return { oauth2Config: undefined, oidcConfig: undefined };}@@ -413,6 +422,73 @@ export const FieldMapping = {},};+function createBaseIdentityProviderUserInfo(): IdentityProviderUserInfo {+ return { identifier: "", displayName: "", email: "" };+}++export const IdentityProviderUserInfo = {+ encode(message: IdentityProviderUserInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.identifier !== "") {+ writer.uint32(10).string(message.identifier);+ }+ if (message.displayName !== "") {+ writer.uint32(18).string(message.displayName);+ }+ if (message.email !== "") {+ writer.uint32(26).string(message.email);+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): IdentityProviderUserInfo {+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseIdentityProviderUserInfo();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ message.identifier = reader.string();+ break;+ case 2:+ message.displayName = reader.string();+ break;+ case 3:+ message.email = reader.string();+ break;+ default:+ reader.skipType(tag & 7);+ break;+ }+ }+ return message;+ },++ fromJSON(object: any): IdentityProviderUserInfo {+ return {+ identifier: isSet(object.identifier) ? String(object.identifier) : "",+ displayName: isSet(object.displayName) ? String(object.displayName) : "",+ email: isSet(object.email) ? String(object.email) : "",+ };+ },++ toJSON(message: IdentityProviderUserInfo): unknown {+ const obj: any = {};+ message.identifier !== undefined && (obj.identifier = message.identifier);+ message.displayName !== undefined && (obj.displayName = message.displayName);+ message.email !== undefined && (obj.email = message.email);+ return obj;+ },++ fromPartial(object: DeepPartial<IdentityProviderUserInfo>): IdentityProviderUserInfo {+ const message = createBaseIdentityProviderUserInfo();+ message.identifier = object.identifier ?? "";+ message.displayName = object.displayName ?? "";+ message.email = object.email ?? "";+ return message;+ },+};+type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;export type DeepPartial<T> = T extends Builtin ? Tdiff --git a/frontend/src/types/proto/v1/auth_service.ts b/frontend/src/types/proto/v1/auth_service.tsindex 24121082a3..1a05d79cd9 100644--- a/frontend/src/types/proto/v1/auth_service.ts+++ b/frontend/src/types/proto/v1/auth_service.ts@@ -173,6 +173,25 @@ export interface LoginRequest {password: string;/** If web is set, we will set access token, refresh token, and user to the cookie. */web: boolean;+ /**+ * The name of the identity provider.+ * Format: idps/{idp}+ */+ idpName: string;+ /** The context data is using to get the user information from identity provider. */+ context?: IdentityProviderContext;+}++export interface IdentityProviderContext {+ oauth2Context?: OAuth2IdentityProviderContext | undefined;+ oidcContext?: OIDCIdentityProviderContextx | undefined;+}++export interface OAuth2IdentityProviderContext {+ code: string;+}++export interface OIDCIdentityProviderContextx {}export interface LoginResponse {@@ -574,7 +593,7 @@ export const UndeleteUserRequest = {};function createBaseLoginRequest(): LoginRequest {- return { email: "", password: "", web: false };+ return { email: "", password: "", web: false, idpName: "", context: undefined };}export const LoginRequest = {@@ -588,6 +607,12 @@ export const LoginRequest = {if (message.web === true) {writer.uint32(24).bool(message.web);}+ if (message.idpName !== "") {+ writer.uint32(34).string(message.idpName);+ }+ if (message.context !== undefined) {+ IdentityProviderContext.encode(message.context, writer.uint32(42).fork()).ldelim();+ }return writer;},@@ -607,6 +632,12 @@ export const LoginRequest = {case 3:message.web = reader.bool();break;+ case 4:+ message.idpName = reader.string();+ break;+ case 5:+ message.context = IdentityProviderContext.decode(reader, reader.uint32());+ break;default:reader.skipType(tag & 7);break;@@ -620,6 +651,8 @@ export const LoginRequest = {email: isSet(object.email) ? String(object.email) : "",password: isSet(object.password) ? String(object.password) : "",web: isSet(object.web) ? Boolean(object.web) : false,+ idpName: isSet(object.idpName) ? String(object.idpName) : "",+ context: isSet(object.context) ? IdentityProviderContext.fromJSON(object.context) : undefined,};},@@ -628,6 +661,9 @@ export const LoginRequest = {message.email !== undefined && (obj.email = message.email);message.password !== undefined && (obj.password = message.password);message.web !== undefined && (obj.web = message.web);+ message.idpName !== undefined && (obj.idpName = message.idpName);+ message.context !== undefined &&+ (obj.context = message.context ? IdentityProviderContext.toJSON(message.context) : undefined);return obj;},@@ -636,6 +672,163 @@ export const LoginRequest = {message.email = object.email ?? "";message.password = object.password ?? "";message.web = object.web ?? false;+ message.idpName = object.idpName ?? "";+ message.context = (object.context !== undefined && object.context !== null)+ ? IdentityProviderContext.fromPartial(object.context)+ : undefined;+ return message;+ },+};++function createBaseIdentityProviderContext(): IdentityProviderContext {+ return { oauth2Context: undefined, oidcContext: undefined };+}++export const IdentityProviderContext = {+ encode(message: IdentityProviderContext, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.oauth2Context !== undefined) {+ OAuth2IdentityProviderContext.encode(message.oauth2Context, writer.uint32(10).fork()).ldelim();+ }+ if (message.oidcContext !== undefined) {+ OIDCIdentityProviderContextx.encode(message.oidcContext, writer.uint32(18).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): IdentityProviderContext {+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseIdentityProviderContext();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ message.oauth2Context = OAuth2IdentityProviderContext.decode(reader, reader.uint32());+ break;+ case 2:+ message.oidcContext = OIDCIdentityProviderContextx.decode(reader, reader.uint32());+ break;+ default:+ reader.skipType(tag & 7);+ break;+ }+ }+ return message;+ },++ fromJSON(object: any): IdentityProviderContext {+ return {+ oauth2Context: isSet(object.oauth2Context)+ ? OAuth2IdentityProviderContext.fromJSON(object.oauth2Context)+ : undefined,+ oidcContext: isSet(object.oidcContext) ? OIDCIdentityProviderContextx.fromJSON(object.oidcContext) : undefined,+ };+ },++ toJSON(message: IdentityProviderContext): unknown {+ const obj: any = {};+ message.oauth2Context !== undefined && (obj.oauth2Context = message.oauth2Context+ ? OAuth2IdentityProviderContext.toJSON(message.oauth2Context)+ : undefined);+ message.oidcContext !== undefined &&+ (obj.oidcContext = message.oidcContext ? OIDCIdentityProviderContextx.toJSON(message.oidcContext) : undefined);+ return obj;+ },++ fromPartial(object: DeepPartial<IdentityProviderContext>): IdentityProviderContext {+ const message = createBaseIdentityProviderContext();+ message.oauth2Context = (object.oauth2Context !== undefined && object.oauth2Context !== null)+ ? OAuth2IdentityProviderContext.fromPartial(object.oauth2Context)+ : undefined;+ message.oidcContext = (object.oidcContext !== undefined && object.oidcContext !== null)+ ? OIDCIdentityProviderContextx.fromPartial(object.oidcContext)+ : undefined;+ return message;+ },+};++function createBaseOAuth2IdentityProviderContext(): OAuth2IdentityProviderContext {+ return { code: "" };+}++export const OAuth2IdentityProviderContext = {+ encode(message: OAuth2IdentityProviderContext, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.code !== "") {+ writer.uint32(10).string(message.code);+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): OAuth2IdentityProviderContext {+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseOAuth2IdentityProviderContext();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ message.code = reader.string();+ break;+ default:+ reader.skipType(tag & 7);+ break;+ }+ }+ return message;+ },++ fromJSON(object: any): OAuth2IdentityProviderContext {+ return { code: isSet(object.code) ? String(object.code) : "" };+ },++ toJSON(message: OAuth2IdentityProviderContext): unknown {+ const obj: any = {};+ message.code !== undefined && (obj.code = message.code);+ return obj;+ },++ fromPartial(object: DeepPartial<OAuth2IdentityProviderContext>): OAuth2IdentityProviderContext {+ const message = createBaseOAuth2IdentityProviderContext();+ message.code = object.code ?? "";+ return message;+ },+};++function createBaseOIDCIdentityProviderContextx(): OIDCIdentityProviderContextx {+ return {};+}++export const OIDCIdentityProviderContextx = {+ encode(_: OIDCIdentityProviderContextx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): OIDCIdentityProviderContextx {+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseOIDCIdentityProviderContextx();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ default:+ reader.skipType(tag & 7);+ break;+ }+ }+ return message;+ },++ fromJSON(_: any): OIDCIdentityProviderContextx {+ return {};+ },++ toJSON(_: OIDCIdentityProviderContextx): unknown {+ const obj: any = {};+ return obj;+ },++ fromPartial(_: DeepPartial<OIDCIdentityProviderContextx>): OIDCIdentityProviderContextx {+ const message = createBaseOIDCIdentityProviderContextx();return message;},};diff --git a/go.mod b/go.modindex d1dda72e64..07ca59754e 100644--- a/go.mod+++ b/go.mod@@ -48,6 +48,7 @@ require (go.uber.org/zap v1.24.0golang.org/x/crypto v0.1.0golang.org/x/exp v0.0.0-20221031165847-c99f073a8326+ golang.org/x/oauth2 v0.3.0golang.org/x/sys v0.3.0golang.org/x/text v0.5.0google.golang.org/api v0.103.0@@ -180,7 +181,6 @@ require (go.opentelemetry.io/otel/trace v1.11.2 // indirectgo.uber.org/atomic v1.10.0 // indirectgolang.org/x/net v0.3.0 // indirect- golang.org/x/oauth2 v0.3.0 // indirectgolang.org/x/sync v0.1.0 // indirectgolang.org/x/time v0.1.0 // indirectgolang.org/x/tools v0.2.0 // indirectdiff --git a/proto/generated-go/store/idp.pb.go b/proto/generated-go/store/idp.pb.goindex 93d3b1b900..b923c81490 100644--- a/proto/generated-go/store/idp.pb.go+++ b/proto/generated-go/store/idp.pb.go@@ -392,6 +392,72 @@ func (x *FieldMapping) GetEmail() string {return ""}+type IdentityProviderUserInfo struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // Identifier is the value of the unique identifier in 3rd-party idp user info.+ Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"`+ // DisplayName is the value of display name in 3rd-party idp user info.+ DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`+ // Email is the value of primary email in 3rd-party idp user info.+ Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`+}++func (x *IdentityProviderUserInfo) Reset() {+ *x = IdentityProviderUserInfo{}+ if protoimpl.UnsafeEnabled {+ mi := &file_store_idp_proto_msgTypes[4]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *IdentityProviderUserInfo) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*IdentityProviderUserInfo) ProtoMessage() {}++func (x *IdentityProviderUserInfo) ProtoReflect() protoreflect.Message {+ mi := &file_store_idp_proto_msgTypes[4]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use IdentityProviderUserInfo.ProtoReflect.Descriptor instead.+func (*IdentityProviderUserInfo) Descriptor() ([]byte, []int) {+ return file_store_idp_proto_rawDescGZIP(), []int{4}+}++func (x *IdentityProviderUserInfo) GetIdentifier() string {+ if x != nil {+ return x.Identifier+ }+ return ""+}++func (x *IdentityProviderUserInfo) GetDisplayName() string {+ if x != nil {+ return x.DisplayName+ }+ return ""+}++func (x *IdentityProviderUserInfo) GetEmail() string {+ if x != nil {+ return x.Email+ }+ return ""+}+var File_store_idp_proto protoreflect.FileDescriptorvar file_store_idp_proto_rawDesc = []byte{@@ -445,14 +511,22 @@ var file_store_idp_proto_rawDesc = []byte{0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65,0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e,0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01,- 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x2a, 0x54, 0x0a, 0x14, 0x49, 0x64, 0x65,- 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70,- 0x65, 0x12, 0x26, 0x0a, 0x22, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x49, 0x54, 0x59, 0x5f, 0x50, 0x52,- 0x4f, 0x56, 0x49, 0x44, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50,- 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x41, 0x55,- 0x54, 0x48, 0x32, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4f, 0x49, 0x44, 0x43, 0x10, 0x02, 0x42,- 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f,- 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,+ 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x22, 0x73, 0x0a, 0x18, 0x49, 0x64, 0x65,+ 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x55, 0x73, 0x65,+ 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66,+ 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74,+ 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79,+ 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73,+ 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69,+ 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x2a, 0x54,+ 0x0a, 0x14, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64,+ 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x22, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x49,+ 0x54, 0x59, 0x5f, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45,+ 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a,+ 0x0a, 0x06, 0x4f, 0x41, 0x55, 0x54, 0x48, 0x32, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4f, 0x49,+ 0x44, 0x43, 0x10, 0x02, 0x42, 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65,+ 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,+ 0x6f, 0x33,}var (@@ -468,13 +542,14 @@ func file_store_idp_proto_rawDescGZIP() []byte {}var file_store_idp_proto_enumTypes = make([]protoimpl.EnumInfo, 1)-var file_store_idp_proto_msgTypes = make([]protoimpl.MessageInfo, 4)+var file_store_idp_proto_msgTypes = make([]protoimpl.MessageInfo, 5)var file_store_idp_proto_goTypes = []interface{}{(IdentityProviderType)(0), // 0: bytebase.store.IdentityProviderType(*IdentityProviderConfig)(nil), // 1: bytebase.store.IdentityProviderConfig(*OAuth2IdentityProviderConfig)(nil), // 2: bytebase.store.OAuth2IdentityProviderConfig(*OIDCIdentityProviderConfig)(nil), // 3: bytebase.store.OIDCIdentityProviderConfig(*FieldMapping)(nil), // 4: bytebase.store.FieldMapping+ (*IdentityProviderUserInfo)(nil), // 5: bytebase.store.IdentityProviderUserInfo}var file_store_idp_proto_depIdxs = []int32{2, // 0: bytebase.store.IdentityProviderConfig.oauth2_config:type_name -> bytebase.store.OAuth2IdentityProviderConfig@@ -542,6 +617,18 @@ func file_store_idp_proto_init() {return nil}}+ file_store_idp_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*IdentityProviderUserInfo); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }}file_store_idp_proto_msgTypes[0].OneofWrappers = []interface{}{(*IdentityProviderConfig_Oauth2Config)(nil),@@ -553,7 +640,7 @@ func file_store_idp_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: file_store_idp_proto_rawDesc,NumEnums: 1,- NumMessages: 4,+ NumMessages: 5,NumExtensions: 0,NumServices: 0,},diff --git a/proto/generated-go/v1/auth_service.pb.go b/proto/generated-go/v1/auth_service.pb.goindex d9e675abb8..ac7a721c22 100644--- a/proto/generated-go/v1/auth_service.pb.go+++ b/proto/generated-go/v1/auth_service.pb.go@@ -523,6 +523,11 @@ type LoginRequest struct {Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`// If web is set, we will set access token, refresh token, and user to the cookie.Web bool `protobuf:"varint,3,opt,name=web,proto3" json:"web,omitempty"`+ // The name of the identity provider.+ // Format: idps/{idp}+ IdpName string `protobuf:"bytes,4,opt,name=idp_name,json=idpName,proto3" json:"idp_name,omitempty"`+ // The context data is using to get the user information from identity provider.+ Context *IdentityProviderContext `protobuf:"bytes,5,opt,name=context,proto3" json:"context,omitempty"`}func (x *LoginRequest) Reset() {@@ -578,6 +583,186 @@ func (x *LoginRequest) GetWeb() bool {return false}+func (x *LoginRequest) GetIdpName() string {+ if x != nil {+ return x.IdpName+ }+ return ""+}++func (x *LoginRequest) GetContext() *IdentityProviderContext {+ if x != nil {+ return x.Context+ }+ return nil+}++type IdentityProviderContext struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // Types that are assignable to Context:+ //+ // *IdentityProviderContext_Oauth2Context+ // *IdentityProviderContext_OidcContext+ Context isIdentityProviderContext_Context `protobuf_oneof:"context"`+}++func (x *IdentityProviderContext) Reset() {+ *x = IdentityProviderContext{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_auth_service_proto_msgTypes[8]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *IdentityProviderContext) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*IdentityProviderContext) ProtoMessage() {}++func (x *IdentityProviderContext) ProtoReflect() protoreflect.Message {+ mi := &file_v1_auth_service_proto_msgTypes[8]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use IdentityProviderContext.ProtoReflect.Descriptor instead.+func (*IdentityProviderContext) Descriptor() ([]byte, []int) {+ return file_v1_auth_service_proto_rawDescGZIP(), []int{8}+}++func (m *IdentityProviderContext) GetContext() isIdentityProviderContext_Context {+ if m != nil {+ return m.Context+ }+ return nil+}++func (x *IdentityProviderContext) GetOauth2Context() *OAuth2IdentityProviderContext {+ if x, ok := x.GetContext().(*IdentityProviderContext_Oauth2Context); ok {+ return x.Oauth2Context+ }+ return nil+}++func (x *IdentityProviderContext) GetOidcContext() *OIDCIdentityProviderContextx {+ if x, ok := x.GetContext().(*IdentityProviderContext_OidcContext); ok {+ return x.OidcContext+ }+ return nil+}++type isIdentityProviderContext_Context interface {+ isIdentityProviderContext_Context()+}++type IdentityProviderContext_Oauth2Context struct {+ Oauth2Context *OAuth2IdentityProviderContext `protobuf:"bytes,1,opt,name=oauth2_context,json=oauth2Context,proto3,oneof"`+}++type IdentityProviderContext_OidcContext struct {+ OidcContext *OIDCIdentityProviderContextx `protobuf:"bytes,2,opt,name=oidc_context,json=oidcContext,proto3,oneof"`+}++func (*IdentityProviderContext_Oauth2Context) isIdentityProviderContext_Context() {}++func (*IdentityProviderContext_OidcContext) isIdentityProviderContext_Context() {}++type OAuth2IdentityProviderContext struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`+}++func (x *OAuth2IdentityProviderContext) Reset() {+ *x = OAuth2IdentityProviderContext{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_auth_service_proto_msgTypes[9]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *OAuth2IdentityProviderContext) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*OAuth2IdentityProviderContext) ProtoMessage() {}++func (x *OAuth2IdentityProviderContext) ProtoReflect() protoreflect.Message {+ mi := &file_v1_auth_service_proto_msgTypes[9]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use OAuth2IdentityProviderContext.ProtoReflect.Descriptor instead.+func (*OAuth2IdentityProviderContext) Descriptor() ([]byte, []int) {+ return file_v1_auth_service_proto_rawDescGZIP(), []int{9}+}++func (x *OAuth2IdentityProviderContext) GetCode() string {+ if x != nil {+ return x.Code+ }+ return ""+}++type OIDCIdentityProviderContextx struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields+}++func (x *OIDCIdentityProviderContextx) Reset() {+ *x = OIDCIdentityProviderContextx{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_auth_service_proto_msgTypes[10]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *OIDCIdentityProviderContextx) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*OIDCIdentityProviderContextx) ProtoMessage() {}++func (x *OIDCIdentityProviderContextx) ProtoReflect() protoreflect.Message {+ mi := &file_v1_auth_service_proto_msgTypes[10]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use OIDCIdentityProviderContextx.ProtoReflect.Descriptor instead.+func (*OIDCIdentityProviderContextx) Descriptor() ([]byte, []int) {+ return file_v1_auth_service_proto_rawDescGZIP(), []int{10}+}+type LoginResponse struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCache@@ -589,7 +774,7 @@ type LoginResponse struct {func (x *LoginResponse) Reset() {*x = LoginResponse{}if protoimpl.UnsafeEnabled {- mi := &file_v1_auth_service_proto_msgTypes[8]+ mi := &file_v1_auth_service_proto_msgTypes[11]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -602,7 +787,7 @@ func (x *LoginResponse) String() string {func (*LoginResponse) ProtoMessage() {}func (x *LoginResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[8]+ mi := &file_v1_auth_service_proto_msgTypes[11]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -615,7 +800,7 @@ func (x *LoginResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead.func (*LoginResponse) Descriptor() ([]byte, []int) {- return file_v1_auth_service_proto_rawDescGZIP(), []int{8}+ return file_v1_auth_service_proto_rawDescGZIP(), []int{11}}func (x *LoginResponse) GetToken() string {@@ -634,7 +819,7 @@ type LogoutRequest struct {func (x *LogoutRequest) Reset() {*x = LogoutRequest{}if protoimpl.UnsafeEnabled {- mi := &file_v1_auth_service_proto_msgTypes[9]+ mi := &file_v1_auth_service_proto_msgTypes[12]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -647,7 +832,7 @@ func (x *LogoutRequest) String() string {func (*LogoutRequest) ProtoMessage() {}func (x *LogoutRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[9]+ mi := &file_v1_auth_service_proto_msgTypes[12]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -660,7 +845,7 @@ func (x *LogoutRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use LogoutRequest.ProtoReflect.Descriptor instead.func (*LogoutRequest) Descriptor() ([]byte, []int) {- return file_v1_auth_service_proto_rawDescGZIP(), []int{9}+ return file_v1_auth_service_proto_rawDescGZIP(), []int{12}}type User struct {@@ -684,7 +869,7 @@ type User struct {func (x *User) Reset() {*x = User{}if protoimpl.UnsafeEnabled {- mi := &file_v1_auth_service_proto_msgTypes[10]+ mi := &file_v1_auth_service_proto_msgTypes[13]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -697,7 +882,7 @@ func (x *User) String() string {func (*User) ProtoMessage() {}func (x *User) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[10]+ mi := &file_v1_auth_service_proto_msgTypes[13]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -710,7 +895,7 @@ func (x *User) ProtoReflect() protoreflect.Message {// Deprecated: Use User.ProtoReflect.Descriptor instead.func (*User) Descriptor() ([]byte, []int) {- return file_v1_auth_service_proto_rawDescGZIP(), []int{10}+ return file_v1_auth_service_proto_rawDescGZIP(), []int{13}}func (x *User) GetName() string {@@ -821,98 +1006,122 @@ var file_v1_auth_service_proto_rawDesc = []byte{0x65, 0x22, 0x2f, 0x0a, 0x13, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65,0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x04, 0x6e, 0x61,- 0x6d, 0x65, 0x22, 0x52, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65,- 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28,- 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73,- 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73,- 0x77, 0x6f, 0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x77, 0x65, 0x62, 0x18, 0x03, 0x20, 0x01, 0x28,- 0x08, 0x52, 0x03, 0x77, 0x65, 0x62, 0x22, 0x25, 0x0a, 0x0d, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52,- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e,- 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x0f, 0x0a,- 0x0d, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xb3,- 0x02, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,- 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x04, 0x6e, 0x61, 0x6d,- 0x65, 0x12, 0x28, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e,- 0x32, 0x12, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53,- 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65,- 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69,- 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,- 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77,- 0x6f, 0x72, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x04, 0x52,- 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x31, 0x0a, 0x11, 0x69, 0x64, 0x65,- 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x06,- 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x10, 0x69, 0x64, 0x65, 0x6e,- 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x09,- 0x75, 0x73, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32,- 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73,- 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65,- 0x12, 0x32, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x08, 0x20,- 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,- 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72,- 0x52, 0x6f, 0x6c, 0x65, 0x2a, 0x54, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65,- 0x12, 0x19, 0x0a, 0x15, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e,- 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x55,- 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x5f,- 0x42, 0x4f, 0x54, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45,- 0x5f, 0x41, 0x43, 0x43, 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x03, 0x2a, 0x48, 0x0a, 0x08, 0x55, 0x73,- 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x52,- 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10,- 0x00, 0x12, 0x09, 0x0a, 0x05, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03,- 0x44, 0x42, 0x41, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x45, 0x56, 0x45, 0x4c, 0x4f, 0x50,- 0x45, 0x52, 0x10, 0x03, 0x32, 0xba, 0x06, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72,- 0x76, 0x69, 0x63, 0x65, 0x12, 0x5c, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12,- 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65,- 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x62,+ 0x6d, 0x65, 0x22, 0xb3, 0x01, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75,+ 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01,+ 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73,+ 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73,+ 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x77, 0x65, 0x62, 0x18, 0x03, 0x20, 0x01,+ 0x28, 0x08, 0x52, 0x03, 0x77, 0x65, 0x62, 0x12, 0x1f, 0x0a, 0x08, 0x69, 0x64, 0x70, 0x5f, 0x6e,+ 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52,+ 0x07, 0x69, 0x64, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74,+ 0x65, 0x78, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x62, 0x79, 0x74, 0x65,+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79,+ 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52,+ 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0xc9, 0x01, 0x0a, 0x17, 0x49, 0x64, 0x65,+ 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e,+ 0x74, 0x65, 0x78, 0x74, 0x12, 0x53, 0x0a, 0x0e, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x63,+ 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x62,+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x41, 0x75, 0x74, 0x68,+ 0x32, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65,+ 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x0d, 0x6f, 0x61, 0x75, 0x74,+ 0x68, 0x32, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x4e, 0x0a, 0x0c, 0x6f, 0x69, 0x64,+ 0x63, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,+ 0x29, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x49,+ 0x44, 0x43, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64,+ 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x78, 0x48, 0x00, 0x52, 0x0b, 0x6f, 0x69,+ 0x64, 0x63, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e,+ 0x74, 0x65, 0x78, 0x74, 0x22, 0x33, 0x0a, 0x1d, 0x4f, 0x41, 0x75, 0x74, 0x68, 0x32, 0x49, 0x64,+ 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f,+ 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20,+ 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x1e, 0x0a, 0x1c, 0x4f, 0x49, 0x44,+ 0x43, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65,+ 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x78, 0x22, 0x25, 0x0a, 0x0d, 0x4c, 0x6f, 0x67,+ 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f,+ 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e,+ 0x22, 0x0f, 0x0a, 0x0d, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,+ 0x74, 0x22, 0xb3, 0x02, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61,+ 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x04,+ 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20,+ 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,+ 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14,+ 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65,+ 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x04, 0x20,+ 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x08, 0x70, 0x61,+ 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41,+ 0x01, 0x04, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x31, 0x0a, 0x11,+ 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65,+ 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x10, 0x69,+ 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12,+ 0x32, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01,+ 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,+ 0x2e, 0x55, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x54,+ 0x79, 0x70, 0x65, 0x12, 0x32, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x72, 0x6f, 0x6c, 0x65,+ 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x08, 0x75,+ 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x2a, 0x54, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x54,+ 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45,+ 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08,+ 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x59, 0x53, 0x54,+ 0x45, 0x4d, 0x5f, 0x42, 0x4f, 0x54, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x52, 0x56,+ 0x49, 0x43, 0x45, 0x5f, 0x41, 0x43, 0x43, 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x03, 0x2a, 0x48, 0x0a,+ 0x08, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x53, 0x45,+ 0x52, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49,+ 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x10, 0x01, 0x12,+ 0x07, 0x0a, 0x03, 0x44, 0x42, 0x41, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x45, 0x56, 0x45,+ 0x4c, 0x4f, 0x50, 0x45, 0x52, 0x10, 0x03, 0x32, 0xba, 0x06, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68,+ 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5c, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73,+ 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,+ 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,+ 0x11, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73,+ 0x65, 0x72, 0x22, 0x21, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02,+ 0x14, 0x12, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65,+ 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x66, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65,+ 0x72, 0x73, 0x12, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,+ 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,+ 0x74, 0x1a, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,+ 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,+ 0x65, 0x22, 0x1a, 0xda, 0x41, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x82, 0xd3, 0xe4, 0x93,+ 0x02, 0x0b, 0x12, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x5f, 0x0a,+ 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x62, 0x79,+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,+ 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x62, 0x79,+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x1e,+ 0xda, 0x41, 0x04, 0x75, 0x73, 0x65, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x3a, 0x04, 0x75,+ 0x73, 0x65, 0x72, 0x22, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x79,+ 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x62,+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74,+ 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x62,0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22,- 0x21, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12,+ 0x38, 0xda, 0x41, 0x10, 0x75, 0x73, 0x65, 0x72, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f,+ 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x04, 0x75, 0x73, 0x65, 0x72,+ 0x32, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x6e, 0x61, 0x6d, 0x65,+ 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x67, 0x0a, 0x0a, 0x44, 0x65, 0x6c,+ 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,+ 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72,+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22,+ 0x21, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x2a, 0x12,0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f,- 0x2a, 0x7d, 0x12, 0x66, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12,- 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69,- 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e,- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73,- 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a,- 0xda, 0x41, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x12,- 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x5f, 0x0a, 0x0a, 0x43, 0x72,- 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,- 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65,- 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,- 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x1e, 0xda, 0x41, 0x04,- 0x75, 0x73, 0x65, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x3a, 0x04, 0x75, 0x73, 0x65, 0x72,- 0x22, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x79, 0x0a, 0x0a, 0x55,- 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65,- 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73,- 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x62, 0x79, 0x74, 0x65,- 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x38, 0xda, 0x41,- 0x10, 0x75, 0x73, 0x65, 0x72, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73,- 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x32, 0x17, 0x2f,- 0x76, 0x31, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73,- 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x67, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,- 0x55, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,- 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71,- 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,- 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x21, 0xda, 0x41,- 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x2a, 0x12, 0x2f, 0x76, 0x31,- 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12,- 0x6b, 0x0a, 0x0c, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12,- 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x6e,- 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,- 0x74, 0x1a, 0x11, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,- 0x55, 0x73, 0x65, 0x72, 0x22, 0x26, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x3a, 0x01, 0x2a, 0x22,- 0x1b, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73,- 0x2f, 0x2a, 0x7d, 0x3a, 0x75, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x59, 0x0a, 0x05,- 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,- 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,- 0x1a, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c,- 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3,- 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74,- 0x68, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x58, 0x0a, 0x06, 0x4c, 0x6f, 0x67, 0x6f, 0x75,- 0x74, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,- 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e,- 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,- 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a,- 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x6c, 0x6f, 0x67, 0x6f, 0x75,- 0x74, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67,- 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,+ 0x2a, 0x7d, 0x12, 0x6b, 0x0a, 0x0c, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73,+ 0x65, 0x72, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,+ 0x2e, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71,+ 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,+ 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x26, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x3a,+ 0x01, 0x2a, 0x22, 0x1b, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73,+ 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x75, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12,+ 0x59, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75,+ 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,+ 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,+ 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, 0x31, 0x2f,+ 0x61, 0x75, 0x74, 0x68, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x58, 0x0a, 0x06, 0x4c, 0x6f,+ 0x67, 0x6f, 0x75, 0x74, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,+ 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,+ 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,+ 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14,+ 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x6c, 0x6f,+ 0x67, 0x6f, 0x75, 0x74, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65,+ 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,}var (@@ -928,54 +1137,60 @@ func file_v1_auth_service_proto_rawDescGZIP() []byte {}var file_v1_auth_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2)-var file_v1_auth_service_proto_msgTypes = make([]protoimpl.MessageInfo, 11)+var file_v1_auth_service_proto_msgTypes = make([]protoimpl.MessageInfo, 14)var file_v1_auth_service_proto_goTypes = []interface{}{- (UserType)(0), // 0: bytebase.v1.UserType- (UserRole)(0), // 1: bytebase.v1.UserRole- (*GetUserRequest)(nil), // 2: bytebase.v1.GetUserRequest- (*ListUsersRequest)(nil), // 3: bytebase.v1.ListUsersRequest- (*ListUsersResponse)(nil), // 4: bytebase.v1.ListUsersResponse- (*CreateUserRequest)(nil), // 5: bytebase.v1.CreateUserRequest- (*UpdateUserRequest)(nil), // 6: bytebase.v1.UpdateUserRequest- (*DeleteUserRequest)(nil), // 7: bytebase.v1.DeleteUserRequest- (*UndeleteUserRequest)(nil), // 8: bytebase.v1.UndeleteUserRequest- (*LoginRequest)(nil), // 9: bytebase.v1.LoginRequest- (*LoginResponse)(nil), // 10: bytebase.v1.LoginResponse- (*LogoutRequest)(nil), // 11: bytebase.v1.LogoutRequest- (*User)(nil), // 12: bytebase.v1.User- (*fieldmaskpb.FieldMask)(nil), // 13: google.protobuf.FieldMask- (State)(0), // 14: bytebase.v1.State- (*emptypb.Empty)(nil), // 15: google.protobuf.Empty+ (UserType)(0), // 0: bytebase.v1.UserType+ (UserRole)(0), // 1: bytebase.v1.UserRole+ (*GetUserRequest)(nil), // 2: bytebase.v1.GetUserRequest+ (*ListUsersRequest)(nil), // 3: bytebase.v1.ListUsersRequest+ (*ListUsersResponse)(nil), // 4: bytebase.v1.ListUsersResponse+ (*CreateUserRequest)(nil), // 5: bytebase.v1.CreateUserRequest+ (*UpdateUserRequest)(nil), // 6: bytebase.v1.UpdateUserRequest+ (*DeleteUserRequest)(nil), // 7: bytebase.v1.DeleteUserRequest+ (*UndeleteUserRequest)(nil), // 8: bytebase.v1.UndeleteUserRequest+ (*LoginRequest)(nil), // 9: bytebase.v1.LoginRequest+ (*IdentityProviderContext)(nil), // 10: bytebase.v1.IdentityProviderContext+ (*OAuth2IdentityProviderContext)(nil), // 11: bytebase.v1.OAuth2IdentityProviderContext+ (*OIDCIdentityProviderContextx)(nil), // 12: bytebase.v1.OIDCIdentityProviderContextx+ (*LoginResponse)(nil), // 13: bytebase.v1.LoginResponse+ (*LogoutRequest)(nil), // 14: bytebase.v1.LogoutRequest+ (*User)(nil), // 15: bytebase.v1.User+ (*fieldmaskpb.FieldMask)(nil), // 16: google.protobuf.FieldMask+ (State)(0), // 17: bytebase.v1.State+ (*emptypb.Empty)(nil), // 18: google.protobuf.Empty}var file_v1_auth_service_proto_depIdxs = []int32{- 12, // 0: bytebase.v1.ListUsersResponse.users:type_name -> bytebase.v1.User- 12, // 1: bytebase.v1.CreateUserRequest.user:type_name -> bytebase.v1.User- 12, // 2: bytebase.v1.UpdateUserRequest.user:type_name -> bytebase.v1.User- 13, // 3: bytebase.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask- 14, // 4: bytebase.v1.User.state:type_name -> bytebase.v1.State- 0, // 5: bytebase.v1.User.user_type:type_name -> bytebase.v1.UserType- 1, // 6: bytebase.v1.User.user_role:type_name -> bytebase.v1.UserRole- 2, // 7: bytebase.v1.AuthService.GetUser:input_type -> bytebase.v1.GetUserRequest- 3, // 8: bytebase.v1.AuthService.ListUsers:input_type -> bytebase.v1.ListUsersRequest- 5, // 9: bytebase.v1.AuthService.CreateUser:input_type -> bytebase.v1.CreateUserRequest- 6, // 10: bytebase.v1.AuthService.UpdateUser:input_type -> bytebase.v1.UpdateUserRequest- 7, // 11: bytebase.v1.AuthService.DeleteUser:input_type -> bytebase.v1.DeleteUserRequest- 8, // 12: bytebase.v1.AuthService.UndeleteUser:input_type -> bytebase.v1.UndeleteUserRequest- 9, // 13: bytebase.v1.AuthService.Login:input_type -> bytebase.v1.LoginRequest- 11, // 14: bytebase.v1.AuthService.Logout:input_type -> bytebase.v1.LogoutRequest- 12, // 15: bytebase.v1.AuthService.GetUser:output_type -> bytebase.v1.User- 4, // 16: bytebase.v1.AuthService.ListUsers:output_type -> bytebase.v1.ListUsersResponse- 12, // 17: bytebase.v1.AuthService.CreateUser:output_type -> bytebase.v1.User- 12, // 18: bytebase.v1.AuthService.UpdateUser:output_type -> bytebase.v1.User- 15, // 19: bytebase.v1.AuthService.DeleteUser:output_type -> google.protobuf.Empty- 12, // 20: bytebase.v1.AuthService.UndeleteUser:output_type -> bytebase.v1.User- 10, // 21: bytebase.v1.AuthService.Login:output_type -> bytebase.v1.LoginResponse- 15, // 22: bytebase.v1.AuthService.Logout:output_type -> google.protobuf.Empty- 15, // [15:23] is the sub-list for method output_type- 7, // [7:15] is the sub-list for method input_type- 7, // [7:7] is the sub-list for extension type_name- 7, // [7:7] is the sub-list for extension extendee- 0, // [0:7] is the sub-list for field type_name+ 15, // 0: bytebase.v1.ListUsersResponse.users:type_name -> bytebase.v1.User+ 15, // 1: bytebase.v1.CreateUserRequest.user:type_name -> bytebase.v1.User+ 15, // 2: bytebase.v1.UpdateUserRequest.user:type_name -> bytebase.v1.User+ 16, // 3: bytebase.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask+ 10, // 4: bytebase.v1.LoginRequest.context:type_name -> bytebase.v1.IdentityProviderContext+ 11, // 5: bytebase.v1.IdentityProviderContext.oauth2_context:type_name -> bytebase.v1.OAuth2IdentityProviderContext+ 12, // 6: bytebase.v1.IdentityProviderContext.oidc_context:type_name -> bytebase.v1.OIDCIdentityProviderContextx+ 17, // 7: bytebase.v1.User.state:type_name -> bytebase.v1.State+ 0, // 8: bytebase.v1.User.user_type:type_name -> bytebase.v1.UserType+ 1, // 9: bytebase.v1.User.user_role:type_name -> bytebase.v1.UserRole+ 2, // 10: bytebase.v1.AuthService.GetUser:input_type -> bytebase.v1.GetUserRequest+ 3, // 11: bytebase.v1.AuthService.ListUsers:input_type -> bytebase.v1.ListUsersRequest+ 5, // 12: bytebase.v1.AuthService.CreateUser:input_type -> bytebase.v1.CreateUserRequest+ 6, // 13: bytebase.v1.AuthService.UpdateUser:input_type -> bytebase.v1.UpdateUserRequest+ 7, // 14: bytebase.v1.AuthService.DeleteUser:input_type -> bytebase.v1.DeleteUserRequest+ 8, // 15: bytebase.v1.AuthService.UndeleteUser:input_type -> bytebase.v1.UndeleteUserRequest+ 9, // 16: bytebase.v1.AuthService.Login:input_type -> bytebase.v1.LoginRequest+ 14, // 17: bytebase.v1.AuthService.Logout:input_type -> bytebase.v1.LogoutRequest+ 15, // 18: bytebase.v1.AuthService.GetUser:output_type -> bytebase.v1.User+ 4, // 19: bytebase.v1.AuthService.ListUsers:output_type -> bytebase.v1.ListUsersResponse+ 15, // 20: bytebase.v1.AuthService.CreateUser:output_type -> bytebase.v1.User+ 15, // 21: bytebase.v1.AuthService.UpdateUser:output_type -> bytebase.v1.User+ 18, // 22: bytebase.v1.AuthService.DeleteUser:output_type -> google.protobuf.Empty+ 15, // 23: bytebase.v1.AuthService.UndeleteUser:output_type -> bytebase.v1.User+ 13, // 24: bytebase.v1.AuthService.Login:output_type -> bytebase.v1.LoginResponse+ 18, // 25: bytebase.v1.AuthService.Logout:output_type -> google.protobuf.Empty+ 18, // [18:26] is the sub-list for method output_type+ 10, // [10:18] is the sub-list for method input_type+ 10, // [10:10] is the sub-list for extension type_name+ 10, // [10:10] is the sub-list for extension extendee+ 0, // [0:10] is the sub-list for field type_name}func init() { file_v1_auth_service_proto_init() }@@ -1082,7 +1297,7 @@ func file_v1_auth_service_proto_init() {}}file_v1_auth_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*LoginResponse); i {+ switch v := v.(*IdentityProviderContext); i {case 0:return &v.statecase 1:@@ -1094,7 +1309,7 @@ func file_v1_auth_service_proto_init() {}}file_v1_auth_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*LogoutRequest); i {+ switch v := v.(*OAuth2IdentityProviderContext); i {case 0:return &v.statecase 1:@@ -1106,6 +1321,42 @@ func file_v1_auth_service_proto_init() {}}file_v1_auth_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*OIDCIdentityProviderContextx); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_auth_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*LoginResponse); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_auth_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*LogoutRequest); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_auth_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*User); i {case 0:return &v.state@@ -1118,13 +1369,17 @@ func file_v1_auth_service_proto_init() {}}}+ file_v1_auth_service_proto_msgTypes[8].OneofWrappers = []interface{}{+ (*IdentityProviderContext_Oauth2Context)(nil),+ (*IdentityProviderContext_OidcContext)(nil),+ }type x struct{}out := protoimpl.TypeBuilder{File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: file_v1_auth_service_proto_rawDesc,NumEnums: 2,- NumMessages: 11,+ NumMessages: 14,NumExtensions: 0,NumServices: 1,},diff --git a/proto/store/idp.proto b/proto/store/idp.protoindex 2a32967e7b..ec6c072d4f 100644--- a/proto/store/idp.proto+++ b/proto/store/idp.proto@@ -63,3 +63,14 @@ message FieldMapping {// Email is the field name of primary email in 3rd-party idp user info. Required.string email = 3;}++message IdentityProviderUserInfo {+ // Identifier is the value of the unique identifier in 3rd-party idp user info.+ string identifier = 1;++ // DisplayName is the value of display name in 3rd-party idp user info.+ string display_name = 2;++ // Email is the value of primary email in 3rd-party idp user info.+ string email = 3;+}diff --git a/proto/v1/auth_service.proto b/proto/v1/auth_service.protoindex 04f83e4ecf..f2ae7e1bc4 100644--- a/proto/v1/auth_service.proto+++ b/proto/v1/auth_service.proto@@ -142,6 +142,27 @@ message LoginRequest {// If web is set, we will set access token, refresh token, and user to the cookie.bool web = 3;++ // The name of the identity provider.+ // Format: idps/{idp}+ string idp_name = 4 [(google.api.field_behavior) = REQUIRED];++ // The context data is using to get the user information from identity provider.+ IdentityProviderContext context = 5;+}++message IdentityProviderContext {+ oneof context {+ OAuth2IdentityProviderContext oauth2_context = 1;+ OIDCIdentityProviderContextx oidc_context = 2;+ }+}++message OAuth2IdentityProviderContext {+ string code = 1;+}++message OIDCIdentityProviderContextx {}message LoginResponse {