feat: support mapping avatar url from oauth2

pull/4654/head
johnnyjoy 3 months ago
parent e41916408a
commit eb33a604b2

@ -4,4 +4,5 @@ type IdentityProviderUserInfo struct {
Identifier string Identifier string
DisplayName string DisplayName string
Email string Email string
AvatarURL string
} }

@ -113,5 +113,10 @@ func (p *IdentityProvider) UserInfo(token string) (*idp.IdentityProviderUserInfo
userInfo.Email = v userInfo.Email = v
} }
} }
if p.config.FieldMapping.AvatarUrl != "" {
if v, ok := claims[p.config.FieldMapping.AvatarUrl].(string); ok {
userInfo.AvatarURL = v
}
}
return userInfo, nil return userInfo, nil
} }

@ -69,6 +69,7 @@ message FieldMapping {
string identifier = 1; string identifier = 1;
string display_name = 2; string display_name = 2;
string email = 3; string email = 3;
string avatar_url = 4;
} }
message OAuth2Config { message OAuth2Config {

@ -1,5 +1,4 @@
version: v2 version: v2
clean: true
managed: managed:
enabled: true enabled: true
disable: disable:

@ -219,6 +219,7 @@ type FieldMapping struct {
Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"`
DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
AvatarUrl string `protobuf:"bytes,4,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@ -274,6 +275,13 @@ func (x *FieldMapping) GetEmail() string {
return "" return ""
} }
func (x *FieldMapping) GetAvatarUrl() string {
if x != nil {
return x.AvatarUrl
}
return ""
}
type OAuth2Config struct { type OAuth2Config struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
@ -653,13 +661,15 @@ const file_api_v1_idp_service_proto_rawDesc = "" +
"\x06OAUTH2\x10\x01\"e\n" + "\x06OAUTH2\x10\x01\"e\n" +
"\x16IdentityProviderConfig\x12A\n" + "\x16IdentityProviderConfig\x12A\n" +
"\roauth2_config\x18\x01 \x01(\v2\x1a.memos.api.v1.OAuth2ConfigH\x00R\foauth2ConfigB\b\n" + "\roauth2_config\x18\x01 \x01(\v2\x1a.memos.api.v1.OAuth2ConfigH\x00R\foauth2ConfigB\b\n" +
"\x06config\"g\n" + "\x06config\"\x86\x01\n" +
"\fFieldMapping\x12\x1e\n" + "\fFieldMapping\x12\x1e\n" +
"\n" + "\n" +
"identifier\x18\x01 \x01(\tR\n" + "identifier\x18\x01 \x01(\tR\n" +
"identifier\x12!\n" + "identifier\x12!\n" +
"\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12\x14\n" + "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12\x14\n" +
"\x05email\x18\x03 \x01(\tR\x05email\"\x85\x02\n" + "\x05email\x18\x03 \x01(\tR\x05email\x12\x1d\n" +
"\n" +
"avatar_url\x18\x04 \x01(\tR\tavatarUrl\"\x85\x02\n" +
"\fOAuth2Config\x12\x1b\n" + "\fOAuth2Config\x12\x1b\n" +
"\tclient_id\x18\x01 \x01(\tR\bclientId\x12#\n" + "\tclient_id\x18\x01 \x01(\tR\bclientId\x12#\n" +
"\rclient_secret\x18\x02 \x01(\tR\fclientSecret\x12\x19\n" + "\rclient_secret\x18\x02 \x01(\tR\fclientSecret\x12\x19\n" +

@ -305,9 +305,7 @@ paths:
$ref: '#/definitions/googlerpcStatus' $ref: '#/definitions/googlerpcStatus'
parameters: parameters:
- name: parent - name: parent
description: |- description: "The parent is the owner of the memos.\r\nIf not specified or `users/-`, it will list all memos."
The parent is the owner of the memos.
If not specified or `users/-`, it will list all memos.
in: query in: query
required: false required: false
type: string type: string
@ -318,16 +316,12 @@ paths:
type: integer type: integer
format: int32 format: int32
- name: pageToken - name: pageToken
description: |- description: "A page token, received from a previous `ListMemos` call.\r\nProvide this to retrieve the subsequent page."
A page token, received from a previous `ListMemos` call.
Provide this to retrieve the subsequent page.
in: query in: query
required: false required: false
type: string type: string
- name: state - name: state
description: |- description: "The state of the memos to list.\r\nDefault to `NORMAL`. Set to `ARCHIVED` to list archived memos."
The state of the memos to list.
Default to `NORMAL`. Set to `ARCHIVED` to list archived memos.
in: query in: query
required: false required: false
type: string type: string
@ -337,16 +331,12 @@ paths:
- ARCHIVED - ARCHIVED
default: STATE_UNSPECIFIED default: STATE_UNSPECIFIED
- name: sort - name: sort
description: |- description: "What field to sort the results by.\r\nDefault to display_time."
What field to sort the results by.
Default to display_time.
in: query in: query
required: false required: false
type: string type: string
- name: direction - name: direction
description: |- description: "The direction to sort the results by.\r\nDefault to DESC."
The direction to sort the results by.
Default to DESC.
in: query in: query
required: false required: false
type: string type: string
@ -356,16 +346,12 @@ paths:
- DESC - DESC
default: DIRECTION_UNSPECIFIED default: DIRECTION_UNSPECIFIED
- name: filter - name: filter
description: |- description: "Filter is a CEL expression to filter memos.\r\nRefer to `Shortcut.filter`."
Filter is a CEL expression to filter memos.
Refer to `Shortcut.filter`.
in: query in: query
required: false required: false
type: string type: string
- name: oldFilter - name: oldFilter
description: |- description: "[Deprecated] Old filter contains some specific conditions to filter memos.\r\nFormat: \"creator == 'users/{user}' && visibilities == ['PUBLIC', 'PROTECTED']\""
[Deprecated] Old filter contains some specific conditions to filter memos.
Format: "creator == 'users/{user}' && visibilities == ['PUBLIC', 'PROTECTED']"
in: query in: query
required: false required: false
type: string type: string
@ -410,9 +396,7 @@ paths:
$ref: '#/definitions/googlerpcStatus' $ref: '#/definitions/googlerpcStatus'
parameters: parameters:
- name: id - name: id
description: |- description: "The id of the reaction.\r\nRefer to the `Reaction.id`."
The id of the reaction.
Refer to the `Reaction.id`.
in: path in: path
required: true required: true
type: integer type: integer
@ -678,9 +662,7 @@ paths:
$ref: '#/definitions/googlerpcStatus' $ref: '#/definitions/googlerpcStatus'
parameters: parameters:
- name: name - name: name
description: |- description: "The resource name of the workspace setting.\r\nFormat: settings/{setting}"
The resource name of the workspace setting.
Format: settings/{setting}
in: path in: path
required: true required: true
type: string type: string
@ -702,9 +684,7 @@ paths:
$ref: '#/definitions/googlerpcStatus' $ref: '#/definitions/googlerpcStatus'
parameters: parameters:
- name: setting.name - name: setting.name
description: |- description: "name is the name of the setting.\r\nFormat: settings/{setting}"
name is the name of the setting.
Format: settings/{setting}
in: path in: path
required: true required: true
type: string type: string
@ -826,17 +806,13 @@ paths:
$ref: '#/definitions/googlerpcStatus' $ref: '#/definitions/googlerpcStatus'
parameters: parameters:
- name: memo.name - name: memo.name
description: |- description: "The name of the memo.\r\nFormat: memos/{memo}, memo is the user defined id or uuid."
The name of the memo.
Format: memos/{memo}, memo is the user defined id or uuid.
in: path in: path
required: true required: true
type: string type: string
pattern: memos/[^/]+ pattern: memos/[^/]+
- name: memo - name: memo
description: |- description: "The memo to update.\r\nThe `name` field is required."
The memo to update.
The `name` field is required.
in: body in: body
required: true required: true
schema: schema:
@ -846,9 +822,7 @@ paths:
$ref: '#/definitions/v1State' $ref: '#/definitions/v1State'
creator: creator:
type: string type: string
title: |- title: "The name of the creator.\r\nFormat: users/{user}"
The name of the creator.
Format: users/{user}
createTime: createTime:
type: string type: string
format: date-time format: date-time
@ -896,9 +870,7 @@ paths:
readOnly: true readOnly: true
parent: parent:
type: string type: string
title: |- title: "The name of the parent memo.\r\nFormat: memos/{id}"
The name of the parent memo.
Format: memos/{id}
readOnly: true readOnly: true
snippet: snippet:
type: string type: string
@ -907,9 +879,7 @@ paths:
location: location:
$ref: '#/definitions/apiv1Location' $ref: '#/definitions/apiv1Location'
description: The location of the memo. description: The location of the memo.
title: |- title: "The memo to update.\r\nThe `name` field is required."
The memo to update.
The `name` field is required.
required: required:
- memo - memo
tags: tags:
@ -1105,9 +1075,7 @@ paths:
$ref: '#/definitions/googlerpcStatus' $ref: '#/definitions/googlerpcStatus'
parameters: parameters:
- name: name - name: name
description: |- description: "The name of the activity.\r\nFormat: activities/{id}, id is the system generated auto-incremented id."
The name of the activity.
Format: activities/{id}, id is the system generated auto-incremented id.
in: path in: path
required: true required: true
type: string type: string
@ -1466,9 +1434,7 @@ paths:
$ref: '#/definitions/googlerpcStatus' $ref: '#/definitions/googlerpcStatus'
parameters: parameters:
- name: parent - name: parent
description: |- description: "The parent is the owner of the memos.\r\nIf not specified or `users/-`, it will list all memos."
The parent is the owner of the memos.
If not specified or `users/-`, it will list all memos.
in: path in: path
required: true required: true
type: string type: string
@ -1480,16 +1446,12 @@ paths:
type: integer type: integer
format: int32 format: int32
- name: pageToken - name: pageToken
description: |- description: "A page token, received from a previous `ListMemos` call.\r\nProvide this to retrieve the subsequent page."
A page token, received from a previous `ListMemos` call.
Provide this to retrieve the subsequent page.
in: query in: query
required: false required: false
type: string type: string
- name: state - name: state
description: |- description: "The state of the memos to list.\r\nDefault to `NORMAL`. Set to `ARCHIVED` to list archived memos."
The state of the memos to list.
Default to `NORMAL`. Set to `ARCHIVED` to list archived memos.
in: query in: query
required: false required: false
type: string type: string
@ -1499,16 +1461,12 @@ paths:
- ARCHIVED - ARCHIVED
default: STATE_UNSPECIFIED default: STATE_UNSPECIFIED
- name: sort - name: sort
description: |- description: "What field to sort the results by.\r\nDefault to display_time."
What field to sort the results by.
Default to display_time.
in: query in: query
required: false required: false
type: string type: string
- name: direction - name: direction
description: |- description: "The direction to sort the results by.\r\nDefault to DESC."
The direction to sort the results by.
Default to DESC.
in: query in: query
required: false required: false
type: string type: string
@ -1518,16 +1476,12 @@ paths:
- DESC - DESC
default: DIRECTION_UNSPECIFIED default: DIRECTION_UNSPECIFIED
- name: filter - name: filter
description: |- description: "Filter is a CEL expression to filter memos.\r\nRefer to `Shortcut.filter`."
Filter is a CEL expression to filter memos.
Refer to `Shortcut.filter`.
in: query in: query
required: false required: false
type: string type: string
- name: oldFilter - name: oldFilter
description: |- description: "[Deprecated] Old filter contains some specific conditions to filter memos.\r\nFormat: \"creator == 'users/{user}' && visibilities == ['PUBLIC', 'PROTECTED']\""
[Deprecated] Old filter contains some specific conditions to filter memos.
Format: "creator == 'users/{user}' && visibilities == ['PUBLIC', 'PROTECTED']"
in: query in: query
required: false required: false
type: string type: string
@ -1665,9 +1619,7 @@ paths:
$ref: '#/definitions/googlerpcStatus' $ref: '#/definitions/googlerpcStatus'
parameters: parameters:
- name: parent - name: parent
description: |- description: "The parent, who owns the tags.\r\nFormat: memos/{id}. Use \"memos/-\" to delete all tags."
The parent, who owns the tags.
Format: memos/{id}. Use "memos/-" to delete all tags.
in: path in: path
required: true required: true
type: string type: string
@ -1698,9 +1650,7 @@ paths:
$ref: '#/definitions/googlerpcStatus' $ref: '#/definitions/googlerpcStatus'
parameters: parameters:
- name: parent - name: parent
description: |- description: "The parent, who owns the tags.\r\nFormat: memos/{id}. Use \"memos/-\" to rename all tags."
The parent, who owns the tags.
Format: memos/{id}. Use "memos/-" to rename all tags.
in: path in: path
required: true required: true
type: string type: string
@ -1727,9 +1677,7 @@ paths:
$ref: '#/definitions/googlerpcStatus' $ref: '#/definitions/googlerpcStatus'
parameters: parameters:
- name: resource.name - name: resource.name
description: |- description: "The name of the resource.\r\nFormat: resources/{resource}, resource is the user defined if or uuid."
The name of the resource.
Format: resources/{resource}, resource is the user defined if or uuid.
in: path in: path
required: true required: true
type: string type: string
@ -1815,9 +1763,7 @@ paths:
$ref: '#/definitions/googlerpcStatus' $ref: '#/definitions/googlerpcStatus'
parameters: parameters:
- name: user.name - name: user.name
description: |- description: "The name of the user.\r\nFormat: users/{id}, id is the system generated auto-incremented id."
The name of the user.
Format: users/{id}, id is the system generated auto-incremented id.
in: path in: path
required: true required: true
type: string type: string
@ -2080,9 +2026,7 @@ definitions:
properties: properties:
memo: memo:
type: string type: string
description: |- description: "The memo name of comment.\r\nRefer to `Memo.name`."
The memo name of comment.
Refer to `Memo.name`.
relatedMemo: relatedMemo:
type: string type: string
description: The name of related memo. description: The name of related memo.
@ -2101,6 +2045,8 @@ definitions:
type: string type: string
email: email:
type: string type: string
avatarUrl:
type: string
apiv1IdentityProvider: apiv1IdentityProvider:
type: object type: object
properties: properties:
@ -2144,17 +2090,13 @@ definitions:
properties: properties:
name: name:
type: string type: string
description: |- description: "The name of the memo.\r\nFormat: memos/{memo}, memo is the user defined id or uuid."
The name of the memo.
Format: memos/{memo}, memo is the user defined id or uuid.
readOnly: true readOnly: true
state: state:
$ref: '#/definitions/v1State' $ref: '#/definitions/v1State'
creator: creator:
type: string type: string
title: |- title: "The name of the creator.\r\nFormat: users/{user}"
The name of the creator.
Format: users/{user}
createTime: createTime:
type: string type: string
format: date-time format: date-time
@ -2202,9 +2144,7 @@ definitions:
readOnly: true readOnly: true
parent: parent:
type: string type: string
title: |- title: "The name of the parent memo.\r\nFormat: memos/{id}"
The name of the parent memo.
Format: memos/{id}
readOnly: true readOnly: true
snippet: snippet:
type: string type: string
@ -2290,10 +2230,7 @@ definitions:
weekStartDayOffset: weekStartDayOffset:
type: integer type: integer
format: int32 format: int32
description: |- description: "week_start_day_offset is the week start day offset from Sunday.\r\n0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday\r\nDefault is Sunday."
week_start_day_offset is the week start day offset from Sunday.
0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday
Default is Sunday.
disallowChangeUsername: disallowChangeUsername:
type: boolean type: boolean
description: disallow_change_username disallows changing username. description: disallow_change_username disallows changing username.
@ -2346,9 +2283,7 @@ definitions:
properties: properties:
name: name:
type: string type: string
title: |- title: "name is the name of the setting.\r\nFormat: settings/{setting}"
name is the name of the setting.
Format: settings/{setting}
generalSetting: generalSetting:
$ref: '#/definitions/apiv1WorkspaceGeneralSetting' $ref: '#/definitions/apiv1WorkspaceGeneralSetting'
storageSetting: storageSetting:
@ -2363,9 +2298,7 @@ definitions:
description: storage_type is the storage type. description: storage_type is the storage type.
filepathTemplate: filepathTemplate:
type: string type: string
title: |- title: "The template of file path.\r\ne.g. assets/{timestamp}_{filename}"
The template of file path.
e.g. assets/{timestamp}_{filename}
uploadSizeLimitMb: uploadSizeLimitMb:
type: string type: string
format: int64 format: int64
@ -2524,15 +2457,11 @@ definitions:
properties: properties:
name: name:
type: string type: string
title: |- title: "The name of the activity.\r\nFormat: activities/{id}"
The name of the activity.
Format: activities/{id}
readOnly: true readOnly: true
creator: creator:
type: string type: string
title: |- title: "The name of the creator.\r\nFormat: users/{user}"
The name of the creator.
Format: users/{user}
type: type:
type: string type: string
description: The type of the activity. description: The type of the activity.
@ -2794,9 +2723,7 @@ definitions:
$ref: '#/definitions/apiv1Memo' $ref: '#/definitions/apiv1Memo'
nextPageToken: nextPageToken:
type: string type: string
description: |- description: "A token, which can be sent as `page_token` to retrieve the next page.\r\nIf this field is omitted, there are no subsequent pages."
A token, which can be sent as `page_token` to retrieve the next page.
If this field is omitted, there are no subsequent pages.
v1ListNode: v1ListNode:
type: object type: object
properties: properties:
@ -2885,9 +2812,7 @@ definitions:
properties: properties:
name: name:
type: string type: string
title: |- title: "The name of the memo.\r\nFormat: memos/{id}"
The name of the memo.
Format: memos/{id}
uid: uid:
type: string type: string
snippet: snippet:
@ -3073,9 +2998,7 @@ definitions:
properties: properties:
name: name:
type: string type: string
description: |- description: "The name of the resource.\r\nFormat: resources/{resource}, resource is the user defined if or uuid."
The name of the resource.
Format: resources/{resource}, resource is the user defined if or uuid.
readOnly: true readOnly: true
createTime: createTime:
type: string type: string
@ -3209,9 +3132,7 @@ definitions:
properties: properties:
name: name:
type: string type: string
description: |- description: "The name of the user.\r\nFormat: users/{id}, id is the system generated auto-incremented id."
The name of the user.
Format: users/{id}, id is the system generated auto-incremented id.
readOnly: true readOnly: true
role: role:
$ref: '#/definitions/UserRole' $ref: '#/definitions/UserRole'
@ -3261,9 +3182,7 @@ definitions:
items: items:
type: string type: string
format: date-time format: date-time
description: |- description: "The timestamps when the memos were displayed.\r\nWe should return raw data to the client, and let the client format the data with the user's timezone."
The timestamps when the memos were displayed.
We should return raw data to the client, and let the client format the data with the user's timezone.
memoTypeStats: memoTypeStats:
$ref: '#/definitions/UserStatsMemoTypeStats' $ref: '#/definitions/UserStatsMemoTypeStats'
description: The stats of memo types. description: The stats of memo types.
@ -3272,9 +3191,7 @@ definitions:
additionalProperties: additionalProperties:
type: integer type: integer
format: int32 format: int32
title: |- title: "The count of tags.\r\nFormat: \"tag1\": 1, \"tag2\": 2"
The count of tags.
Format: "tag1": 1, "tag2": 2
pinnedMemos: pinnedMemos:
type: array type: array
items: items:

@ -214,6 +214,7 @@ type FieldMapping struct {
Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"`
DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
AvatarUrl string `protobuf:"bytes,4,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@ -269,6 +270,13 @@ func (x *FieldMapping) GetEmail() string {
return "" return ""
} }
func (x *FieldMapping) GetAvatarUrl() string {
if x != nil {
return x.AvatarUrl
}
return ""
}
type OAuth2Config struct { type OAuth2Config struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
@ -378,13 +386,15 @@ const file_store_idp_proto_rawDesc = "" +
"\x06OAUTH2\x10\x01\"d\n" + "\x06OAUTH2\x10\x01\"d\n" +
"\x16IdentityProviderConfig\x12@\n" + "\x16IdentityProviderConfig\x12@\n" +
"\roauth2_config\x18\x01 \x01(\v2\x19.memos.store.OAuth2ConfigH\x00R\foauth2ConfigB\b\n" + "\roauth2_config\x18\x01 \x01(\v2\x19.memos.store.OAuth2ConfigH\x00R\foauth2ConfigB\b\n" +
"\x06config\"g\n" + "\x06config\"\x86\x01\n" +
"\fFieldMapping\x12\x1e\n" + "\fFieldMapping\x12\x1e\n" +
"\n" + "\n" +
"identifier\x18\x01 \x01(\tR\n" + "identifier\x18\x01 \x01(\tR\n" +
"identifier\x12!\n" + "identifier\x12!\n" +
"\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12\x14\n" + "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12\x14\n" +
"\x05email\x18\x03 \x01(\tR\x05email\"\x84\x02\n" + "\x05email\x18\x03 \x01(\tR\x05email\x12\x1d\n" +
"\n" +
"avatar_url\x18\x04 \x01(\tR\tavatarUrl\"\x84\x02\n" +
"\fOAuth2Config\x12\x1b\n" + "\fOAuth2Config\x12\x1b\n" +
"\tclient_id\x18\x01 \x01(\tR\bclientId\x12#\n" + "\tclient_id\x18\x01 \x01(\tR\bclientId\x12#\n" +
"\rclient_secret\x18\x02 \x01(\tR\fclientSecret\x12\x19\n" + "\rclient_secret\x18\x02 \x01(\tR\fclientSecret\x12\x19\n" +

@ -27,6 +27,7 @@ message FieldMapping {
string identifier = 1; string identifier = 1;
string display_name = 2; string display_name = 2;
string email = 3; string email = 3;
string avatar_url = 4;
} }
message OAuth2Config { message OAuth2Config {

@ -129,9 +129,10 @@ func (s *APIV1Service) SignInWithSSO(ctx context.Context, request *v1pb.SignInWi
userCreate := &store.User{ userCreate := &store.User{
Username: userInfo.Identifier, Username: userInfo.Identifier,
// The new signup user should be normal user by default. // The new signup user should be normal user by default.
Role: store.RoleUser, Role: store.RoleUser,
Nickname: userInfo.DisplayName, Nickname: userInfo.DisplayName,
Email: userInfo.Email, Email: userInfo.Email,
AvatarURL: userInfo.AvatarURL,
} }
password, err := util.RandomString(20) password, err := util.RandomString(20)
if err != nil { if err != nil {

@ -64,6 +64,7 @@ export interface FieldMapping {
identifier: string; identifier: string;
displayName: string; displayName: string;
email: string; email: string;
avatarUrl: string;
} }
export interface OAuth2Config { export interface OAuth2Config {
@ -255,7 +256,7 @@ export const IdentityProviderConfig: MessageFns<IdentityProviderConfig> = {
}; };
function createBaseFieldMapping(): FieldMapping { function createBaseFieldMapping(): FieldMapping {
return { identifier: "", displayName: "", email: "" }; return { identifier: "", displayName: "", email: "", avatarUrl: "" };
} }
export const FieldMapping: MessageFns<FieldMapping> = { export const FieldMapping: MessageFns<FieldMapping> = {
@ -269,6 +270,9 @@ export const FieldMapping: MessageFns<FieldMapping> = {
if (message.email !== "") { if (message.email !== "") {
writer.uint32(26).string(message.email); writer.uint32(26).string(message.email);
} }
if (message.avatarUrl !== "") {
writer.uint32(34).string(message.avatarUrl);
}
return writer; return writer;
}, },
@ -303,6 +307,14 @@ export const FieldMapping: MessageFns<FieldMapping> = {
message.email = reader.string(); message.email = reader.string();
continue; continue;
} }
case 4: {
if (tag !== 34) {
break;
}
message.avatarUrl = reader.string();
continue;
}
} }
if ((tag & 7) === 4 || tag === 0) { if ((tag & 7) === 4 || tag === 0) {
break; break;
@ -320,6 +332,7 @@ export const FieldMapping: MessageFns<FieldMapping> = {
message.identifier = object.identifier ?? ""; message.identifier = object.identifier ?? "";
message.displayName = object.displayName ?? ""; message.displayName = object.displayName ?? "";
message.email = object.email ?? ""; message.email = object.email ?? "";
message.avatarUrl = object.avatarUrl ?? "";
return message; return message;
}, },
}; };

@ -35,7 +35,7 @@ export enum Edition {
EDITION_2024 = "EDITION_2024", EDITION_2024 = "EDITION_2024",
/** /**
* EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be
* used or relied on outside of tests. * used or relyed on outside of tests.
*/ */
EDITION_1_TEST_ONLY = "EDITION_1_TEST_ONLY", EDITION_1_TEST_ONLY = "EDITION_1_TEST_ONLY",
EDITION_2_TEST_ONLY = "EDITION_2_TEST_ONLY", EDITION_2_TEST_ONLY = "EDITION_2_TEST_ONLY",
@ -177,19 +177,11 @@ export interface FileDescriptorProto {
* The supported values are "proto2", "proto3", and "editions". * The supported values are "proto2", "proto3", and "editions".
* *
* If `edition` is present, this value must be "editions". * If `edition` is present, this value must be "editions".
* WARNING: This field should only be used by protobuf plugins or special
* cases like the proto compiler. Other uses are discouraged and
* developers should rely on the protoreflect APIs for their client language.
*/ */
syntax?: syntax?:
| string | string
| undefined; | undefined;
/** /** The edition of the proto file. */
* The edition of the proto file.
* WARNING: This field should only be used by protobuf plugins or special
* cases like the proto compiler. Other uses are discouraged and
* developers should rely on the protoreflect APIs for their client language.
*/
edition?: Edition | undefined; edition?: Edition | undefined;
} }
@ -836,12 +828,7 @@ export interface FileOptions {
rubyPackage?: rubyPackage?:
| string | string
| undefined; | undefined;
/** /** Any features defined in the specific edition. */
* Any features defined in the specific edition.
* WARNING: This field should only be used by protobuf plugins or special
* cases like the proto compiler. Other uses are discouraged and
* developers should rely on the protoreflect APIs for their client language.
*/
features?: features?:
| FeatureSet | FeatureSet
| undefined; | undefined;
@ -979,12 +966,7 @@ export interface MessageOptions {
deprecatedLegacyJsonFieldConflicts?: deprecatedLegacyJsonFieldConflicts?:
| boolean | boolean
| undefined; | undefined;
/** /** Any features defined in the specific edition. */
* Any features defined in the specific edition.
* WARNING: This field should only be used by protobuf plugins or special
* cases like the proto compiler. Other uses are discouraged and
* developers should rely on the protoreflect APIs for their client language.
*/
features?: features?:
| FeatureSet | FeatureSet
| undefined; | undefined;
@ -994,13 +976,12 @@ export interface MessageOptions {
export interface FieldOptions { export interface FieldOptions {
/** /**
* NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead.
* The ctype option instructs the C++ code generator to use a different * The ctype option instructs the C++ code generator to use a different
* representation of the field than it normally would. See the specific * representation of the field than it normally would. See the specific
* options below. This option is only implemented to support use of * options below. This option is only implemented to support use of
* [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
* type "bytes" in the open source release. * type "bytes" in the open source release -- sorry, we'll try to include
* TODO: make ctype actually deprecated. * other types in a future version!
*/ */
ctype?: ctype?:
| FieldOptions_CType | FieldOptions_CType
@ -1089,12 +1070,7 @@ export interface FieldOptions {
retention?: FieldOptions_OptionRetention | undefined; retention?: FieldOptions_OptionRetention | undefined;
targets: FieldOptions_OptionTargetType[]; targets: FieldOptions_OptionTargetType[];
editionDefaults: FieldOptions_EditionDefault[]; editionDefaults: FieldOptions_EditionDefault[];
/** /** Any features defined in the specific edition. */
* Any features defined in the specific edition.
* WARNING: This field should only be used by protobuf plugins or special
* cases like the proto compiler. Other uses are discouraged and
* developers should rely on the protoreflect APIs for their client language.
*/
features?: FeatureSet | undefined; features?: FeatureSet | undefined;
featureSupport?: featureSupport?:
| FieldOptions_FeatureSupport | FieldOptions_FeatureSupport
@ -1193,7 +1169,11 @@ export function fieldOptions_JSTypeToNumber(object: FieldOptions_JSType): number
} }
} }
/** If set to RETENTION_SOURCE, the option will be omitted from the binary. */ /**
* If set to RETENTION_SOURCE, the option will be omitted from the binary.
* Note: as of January 2023, support for this is in progress and does not yet
* have an effect (b/264593489).
*/
export enum FieldOptions_OptionRetention { export enum FieldOptions_OptionRetention {
RETENTION_UNKNOWN = "RETENTION_UNKNOWN", RETENTION_UNKNOWN = "RETENTION_UNKNOWN",
RETENTION_RUNTIME = "RETENTION_RUNTIME", RETENTION_RUNTIME = "RETENTION_RUNTIME",
@ -1236,7 +1216,8 @@ export function fieldOptions_OptionRetentionToNumber(object: FieldOptions_Option
/** /**
* This indicates the types of entities that the field may apply to when used * This indicates the types of entities that the field may apply to when used
* as an option. If it is unset, then the field may be freely used as an * as an option. If it is unset, then the field may be freely used as an
* option on any kind of entity. * option on any kind of entity. Note: as of January 2023, support for this is
* in progress and does not yet have an effect (b/264593489).
*/ */
export enum FieldOptions_OptionTargetType { export enum FieldOptions_OptionTargetType {
TARGET_TYPE_UNKNOWN = "TARGET_TYPE_UNKNOWN", TARGET_TYPE_UNKNOWN = "TARGET_TYPE_UNKNOWN",
@ -1360,12 +1341,7 @@ export interface FieldOptions_FeatureSupport {
} }
export interface OneofOptions { export interface OneofOptions {
/** /** Any features defined in the specific edition. */
* Any features defined in the specific edition.
* WARNING: This field should only be used by protobuf plugins or special
* cases like the proto compiler. Other uses are discouraged and
* developers should rely on the protoreflect APIs for their client language.
*/
features?: features?:
| FeatureSet | FeatureSet
| undefined; | undefined;
@ -1403,12 +1379,7 @@ export interface EnumOptions {
deprecatedLegacyJsonFieldConflicts?: deprecatedLegacyJsonFieldConflicts?:
| boolean | boolean
| undefined; | undefined;
/** /** Any features defined in the specific edition. */
* Any features defined in the specific edition.
* WARNING: This field should only be used by protobuf plugins or special
* cases like the proto compiler. Other uses are discouraged and
* developers should rely on the protoreflect APIs for their client language.
*/
features?: features?:
| FeatureSet | FeatureSet
| undefined; | undefined;
@ -1426,12 +1397,7 @@ export interface EnumValueOptions {
deprecated?: deprecated?:
| boolean | boolean
| undefined; | undefined;
/** /** Any features defined in the specific edition. */
* Any features defined in the specific edition.
* WARNING: This field should only be used by protobuf plugins or special
* cases like the proto compiler. Other uses are discouraged and
* developers should rely on the protoreflect APIs for their client language.
*/
features?: features?:
| FeatureSet | FeatureSet
| undefined; | undefined;
@ -1452,12 +1418,7 @@ export interface EnumValueOptions {
} }
export interface ServiceOptions { export interface ServiceOptions {
/** /** Any features defined in the specific edition. */
* Any features defined in the specific edition.
* WARNING: This field should only be used by protobuf plugins or special
* cases like the proto compiler. Other uses are discouraged and
* developers should rely on the protoreflect APIs for their client language.
*/
features?: features?:
| FeatureSet | FeatureSet
| undefined; | undefined;
@ -1485,12 +1446,7 @@ export interface MethodOptions {
idempotencyLevel?: idempotencyLevel?:
| MethodOptions_IdempotencyLevel | MethodOptions_IdempotencyLevel
| undefined; | undefined;
/** /** Any features defined in the specific edition. */
* Any features defined in the specific edition.
* WARNING: This field should only be used by protobuf plugins or special
* cases like the proto compiler. Other uses are discouraged and
* developers should rely on the protoreflect APIs for their client language.
*/
features?: features?:
| FeatureSet | FeatureSet
| undefined; | undefined;
@ -1593,7 +1549,6 @@ export interface FeatureSet {
utf8Validation?: FeatureSet_Utf8Validation | undefined; utf8Validation?: FeatureSet_Utf8Validation | undefined;
messageEncoding?: FeatureSet_MessageEncoding | undefined; messageEncoding?: FeatureSet_MessageEncoding | undefined;
jsonFormat?: FeatureSet_JsonFormat | undefined; jsonFormat?: FeatureSet_JsonFormat | undefined;
enforceNamingStyle?: FeatureSet_EnforceNamingStyle | undefined;
} }
export enum FeatureSet_FieldPresence { export enum FeatureSet_FieldPresence {
@ -1836,45 +1791,6 @@ export function featureSet_JsonFormatToNumber(object: FeatureSet_JsonFormat): nu
} }
} }
export enum FeatureSet_EnforceNamingStyle {
ENFORCE_NAMING_STYLE_UNKNOWN = "ENFORCE_NAMING_STYLE_UNKNOWN",
STYLE2024 = "STYLE2024",
STYLE_LEGACY = "STYLE_LEGACY",
UNRECOGNIZED = "UNRECOGNIZED",
}
export function featureSet_EnforceNamingStyleFromJSON(object: any): FeatureSet_EnforceNamingStyle {
switch (object) {
case 0:
case "ENFORCE_NAMING_STYLE_UNKNOWN":
return FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN;
case 1:
case "STYLE2024":
return FeatureSet_EnforceNamingStyle.STYLE2024;
case 2:
case "STYLE_LEGACY":
return FeatureSet_EnforceNamingStyle.STYLE_LEGACY;
case -1:
case "UNRECOGNIZED":
default:
return FeatureSet_EnforceNamingStyle.UNRECOGNIZED;
}
}
export function featureSet_EnforceNamingStyleToNumber(object: FeatureSet_EnforceNamingStyle): number {
switch (object) {
case FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN:
return 0;
case FeatureSet_EnforceNamingStyle.STYLE2024:
return 1;
case FeatureSet_EnforceNamingStyle.STYLE_LEGACY:
return 2;
case FeatureSet_EnforceNamingStyle.UNRECOGNIZED:
default:
return -1;
}
}
/** /**
* A compiled specification for the defaults of a set of features. These * A compiled specification for the defaults of a set of features. These
* messages are generated from FeatureSet extensions and can be used to seed * messages are generated from FeatureSet extensions and can be used to seed
@ -4998,7 +4914,6 @@ function createBaseFeatureSet(): FeatureSet {
utf8Validation: FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN, utf8Validation: FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN,
messageEncoding: FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN, messageEncoding: FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN,
jsonFormat: FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN, jsonFormat: FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN,
enforceNamingStyle: FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN,
}; };
} }
@ -5033,12 +4948,6 @@ export const FeatureSet: MessageFns<FeatureSet> = {
if (message.jsonFormat !== undefined && message.jsonFormat !== FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN) { if (message.jsonFormat !== undefined && message.jsonFormat !== FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN) {
writer.uint32(48).int32(featureSet_JsonFormatToNumber(message.jsonFormat)); writer.uint32(48).int32(featureSet_JsonFormatToNumber(message.jsonFormat));
} }
if (
message.enforceNamingStyle !== undefined &&
message.enforceNamingStyle !== FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN
) {
writer.uint32(56).int32(featureSet_EnforceNamingStyleToNumber(message.enforceNamingStyle));
}
return writer; return writer;
}, },
@ -5097,14 +5006,6 @@ export const FeatureSet: MessageFns<FeatureSet> = {
message.jsonFormat = featureSet_JsonFormatFromJSON(reader.int32()); message.jsonFormat = featureSet_JsonFormatFromJSON(reader.int32());
continue; continue;
} }
case 7: {
if (tag !== 56) {
break;
}
message.enforceNamingStyle = featureSet_EnforceNamingStyleFromJSON(reader.int32());
continue;
}
} }
if ((tag & 7) === 4 || tag === 0) { if ((tag & 7) === 4 || tag === 0) {
break; break;
@ -5126,8 +5027,6 @@ export const FeatureSet: MessageFns<FeatureSet> = {
message.utf8Validation = object.utf8Validation ?? FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; message.utf8Validation = object.utf8Validation ?? FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN;
message.messageEncoding = object.messageEncoding ?? FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; message.messageEncoding = object.messageEncoding ?? FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN;
message.jsonFormat = object.jsonFormat ?? FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; message.jsonFormat = object.jsonFormat ?? FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN;
message.enforceNamingStyle = object.enforceNamingStyle ??
FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN;
return message; return message;
}, },
}; };

Loading…
Cancel
Save