Add app_data
This commit is contained in:
parent
e625ed9633
commit
35e563ab3b
|
@ -33,12 +33,14 @@ type User struct {
|
||||||
IsMultiFactorAuthEnabled *bool `json:"is_multi_factor_auth_enabled" bson:"is_multi_factor_auth_enabled" cql:"is_multi_factor_auth_enabled" dynamo:"is_multi_factor_auth_enabled"`
|
IsMultiFactorAuthEnabled *bool `json:"is_multi_factor_auth_enabled" bson:"is_multi_factor_auth_enabled" cql:"is_multi_factor_auth_enabled" dynamo:"is_multi_factor_auth_enabled"`
|
||||||
UpdatedAt int64 `json:"updated_at" bson:"updated_at" cql:"updated_at" dynamo:"updated_at"`
|
UpdatedAt int64 `json:"updated_at" bson:"updated_at" cql:"updated_at" dynamo:"updated_at"`
|
||||||
CreatedAt int64 `json:"created_at" bson:"created_at" cql:"created_at" dynamo:"created_at"`
|
CreatedAt int64 `json:"created_at" bson:"created_at" cql:"created_at" dynamo:"created_at"`
|
||||||
|
AppData *string `json:"app_data" bson:"app_data" cql:"app_data" dynamo:"app_data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (user *User) AsAPIUser() *model.User {
|
func (user *User) AsAPIUser() *model.User {
|
||||||
isEmailVerified := user.EmailVerifiedAt != nil
|
isEmailVerified := user.EmailVerifiedAt != nil
|
||||||
isPhoneVerified := user.PhoneNumberVerifiedAt != nil
|
isPhoneVerified := user.PhoneNumberVerifiedAt != nil
|
||||||
|
appDataMap := make(map[string]interface{})
|
||||||
|
json.Unmarshal([]byte(refs.StringValue(user.AppData)), &appDataMap)
|
||||||
// id := user.ID
|
// id := user.ID
|
||||||
// if strings.Contains(id, Collections.User+"/") {
|
// if strings.Contains(id, Collections.User+"/") {
|
||||||
// id = strings.TrimPrefix(id, Collections.User+"/")
|
// id = strings.TrimPrefix(id, Collections.User+"/")
|
||||||
|
@ -63,6 +65,7 @@ func (user *User) AsAPIUser() *model.User {
|
||||||
IsMultiFactorAuthEnabled: user.IsMultiFactorAuthEnabled,
|
IsMultiFactorAuthEnabled: user.IsMultiFactorAuthEnabled,
|
||||||
CreatedAt: refs.NewInt64Ref(user.CreatedAt),
|
CreatedAt: refs.NewInt64Ref(user.CreatedAt),
|
||||||
UpdatedAt: refs.NewInt64Ref(user.UpdatedAt),
|
UpdatedAt: refs.NewInt64Ref(user.UpdatedAt),
|
||||||
|
AppData: appDataMap,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,6 @@ func getEmailTemplate(event string, data map[string]interface{}) (*model.EmailTe
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
subjectString := buf.String()
|
subjectString := buf.String()
|
||||||
|
|
||||||
return &model.EmailTemplate{
|
return &model.EmailTemplate{
|
||||||
Template: templateString,
|
Template: templateString,
|
||||||
Subject: subjectString,
|
Subject: subjectString,
|
||||||
|
|
|
@ -30,7 +30,7 @@ require (
|
||||||
go.mongodb.org/mongo-driver v1.8.1
|
go.mongodb.org/mongo-driver v1.8.1
|
||||||
golang.org/x/crypto v0.4.0
|
golang.org/x/crypto v0.4.0
|
||||||
golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914
|
golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
google.golang.org/appengine v1.6.7
|
||||||
google.golang.org/protobuf v1.28.1 // indirect
|
google.golang.org/protobuf v1.28.1 // indirect
|
||||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
||||||
gopkg.in/mail.v2 v2.3.1
|
gopkg.in/mail.v2 v2.3.1
|
||||||
|
|
1275
server/go.sum
1275
server/go.sum
File diff suppressed because it is too large
Load Diff
|
@ -245,6 +245,7 @@ type ComplexityRoot struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
User struct {
|
User struct {
|
||||||
|
AppData func(childComplexity int) int
|
||||||
Birthdate func(childComplexity int) int
|
Birthdate func(childComplexity int) int
|
||||||
CreatedAt func(childComplexity int) int
|
CreatedAt func(childComplexity int) int
|
||||||
Email func(childComplexity int) int
|
Email func(childComplexity int) int
|
||||||
|
@ -1695,6 +1696,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||||
|
|
||||||
return e.complexity.TestEndpointResponse.Response(childComplexity), true
|
return e.complexity.TestEndpointResponse.Response(childComplexity), true
|
||||||
|
|
||||||
|
case "User.app_data":
|
||||||
|
if e.complexity.User.AppData == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.User.AppData(childComplexity), true
|
||||||
|
|
||||||
case "User.birthdate":
|
case "User.birthdate":
|
||||||
if e.complexity.User.Birthdate == nil {
|
if e.complexity.User.Birthdate == nil {
|
||||||
break
|
break
|
||||||
|
@ -2229,6 +2237,7 @@ type User {
|
||||||
updated_at: Int64
|
updated_at: Int64
|
||||||
revoked_timestamp: Int64
|
revoked_timestamp: Int64
|
||||||
is_multi_factor_auth_enabled: Boolean
|
is_multi_factor_auth_enabled: Boolean
|
||||||
|
app_data: Map
|
||||||
}
|
}
|
||||||
|
|
||||||
type Users {
|
type Users {
|
||||||
|
@ -2500,6 +2509,7 @@ input MobileSignUpInput {
|
||||||
# it is used to get code for an on-going auth process during login
|
# it is used to get code for an on-going auth process during login
|
||||||
# and use that code for setting ` + "`" + `c_hash` + "`" + ` in id_token
|
# and use that code for setting ` + "`" + `c_hash` + "`" + ` in id_token
|
||||||
state: String
|
state: String
|
||||||
|
app_data: Map
|
||||||
}
|
}
|
||||||
|
|
||||||
input SignUpInput {
|
input SignUpInput {
|
||||||
|
@ -2522,6 +2532,7 @@ input SignUpInput {
|
||||||
# it is used to get code for an on-going auth process during login
|
# it is used to get code for an on-going auth process during login
|
||||||
# and use that code for setting ` + "`" + `c_hash` + "`" + ` in id_token
|
# and use that code for setting ` + "`" + `c_hash` + "`" + ` in id_token
|
||||||
state: String
|
state: String
|
||||||
|
app_data: Map
|
||||||
}
|
}
|
||||||
|
|
||||||
input LoginInput {
|
input LoginInput {
|
||||||
|
@ -2577,6 +2588,7 @@ input UpdateProfileInput {
|
||||||
phone_number: String
|
phone_number: String
|
||||||
picture: String
|
picture: String
|
||||||
is_multi_factor_auth_enabled: Boolean
|
is_multi_factor_auth_enabled: Boolean
|
||||||
|
app_data: Map
|
||||||
}
|
}
|
||||||
|
|
||||||
input UpdateUserInput {
|
input UpdateUserInput {
|
||||||
|
@ -2593,6 +2605,7 @@ input UpdateUserInput {
|
||||||
picture: String
|
picture: String
|
||||||
roles: [String]
|
roles: [String]
|
||||||
is_multi_factor_auth_enabled: Boolean
|
is_multi_factor_auth_enabled: Boolean
|
||||||
|
app_data: Map
|
||||||
}
|
}
|
||||||
|
|
||||||
input ForgotPasswordInput {
|
input ForgotPasswordInput {
|
||||||
|
@ -3804,6 +3817,8 @@ func (ec *executionContext) fieldContext_AuthResponse_user(ctx context.Context,
|
||||||
return ec.fieldContext_User_revoked_timestamp(ctx, field)
|
return ec.fieldContext_User_revoked_timestamp(ctx, field)
|
||||||
case "is_multi_factor_auth_enabled":
|
case "is_multi_factor_auth_enabled":
|
||||||
return ec.fieldContext_User_is_multi_factor_auth_enabled(ctx, field)
|
return ec.fieldContext_User_is_multi_factor_auth_enabled(ctx, field)
|
||||||
|
case "app_data":
|
||||||
|
return ec.fieldContext_User_app_data(ctx, field)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("no field named %q was found under type User", field.Name)
|
return nil, fmt.Errorf("no field named %q was found under type User", field.Name)
|
||||||
},
|
},
|
||||||
|
@ -7099,6 +7114,8 @@ func (ec *executionContext) fieldContext_InviteMembersResponse_Users(ctx context
|
||||||
return ec.fieldContext_User_revoked_timestamp(ctx, field)
|
return ec.fieldContext_User_revoked_timestamp(ctx, field)
|
||||||
case "is_multi_factor_auth_enabled":
|
case "is_multi_factor_auth_enabled":
|
||||||
return ec.fieldContext_User_is_multi_factor_auth_enabled(ctx, field)
|
return ec.fieldContext_User_is_multi_factor_auth_enabled(ctx, field)
|
||||||
|
case "app_data":
|
||||||
|
return ec.fieldContext_User_app_data(ctx, field)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("no field named %q was found under type User", field.Name)
|
return nil, fmt.Errorf("no field named %q was found under type User", field.Name)
|
||||||
},
|
},
|
||||||
|
@ -8801,6 +8818,8 @@ func (ec *executionContext) fieldContext_Mutation__update_user(ctx context.Conte
|
||||||
return ec.fieldContext_User_revoked_timestamp(ctx, field)
|
return ec.fieldContext_User_revoked_timestamp(ctx, field)
|
||||||
case "is_multi_factor_auth_enabled":
|
case "is_multi_factor_auth_enabled":
|
||||||
return ec.fieldContext_User_is_multi_factor_auth_enabled(ctx, field)
|
return ec.fieldContext_User_is_multi_factor_auth_enabled(ctx, field)
|
||||||
|
case "app_data":
|
||||||
|
return ec.fieldContext_User_app_data(ctx, field)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("no field named %q was found under type User", field.Name)
|
return nil, fmt.Errorf("no field named %q was found under type User", field.Name)
|
||||||
},
|
},
|
||||||
|
@ -10103,6 +10122,8 @@ func (ec *executionContext) fieldContext_Query_profile(ctx context.Context, fiel
|
||||||
return ec.fieldContext_User_revoked_timestamp(ctx, field)
|
return ec.fieldContext_User_revoked_timestamp(ctx, field)
|
||||||
case "is_multi_factor_auth_enabled":
|
case "is_multi_factor_auth_enabled":
|
||||||
return ec.fieldContext_User_is_multi_factor_auth_enabled(ctx, field)
|
return ec.fieldContext_User_is_multi_factor_auth_enabled(ctx, field)
|
||||||
|
case "app_data":
|
||||||
|
return ec.fieldContext_User_app_data(ctx, field)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("no field named %q was found under type User", field.Name)
|
return nil, fmt.Errorf("no field named %q was found under type User", field.Name)
|
||||||
},
|
},
|
||||||
|
@ -10368,6 +10389,8 @@ func (ec *executionContext) fieldContext_Query__user(ctx context.Context, field
|
||||||
return ec.fieldContext_User_revoked_timestamp(ctx, field)
|
return ec.fieldContext_User_revoked_timestamp(ctx, field)
|
||||||
case "is_multi_factor_auth_enabled":
|
case "is_multi_factor_auth_enabled":
|
||||||
return ec.fieldContext_User_is_multi_factor_auth_enabled(ctx, field)
|
return ec.fieldContext_User_is_multi_factor_auth_enabled(ctx, field)
|
||||||
|
case "app_data":
|
||||||
|
return ec.fieldContext_User_app_data(ctx, field)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("no field named %q was found under type User", field.Name)
|
return nil, fmt.Errorf("no field named %q was found under type User", field.Name)
|
||||||
},
|
},
|
||||||
|
@ -12229,6 +12252,47 @@ func (ec *executionContext) fieldContext_User_is_multi_factor_auth_enabled(ctx c
|
||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _User_app_data(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_User_app_data(ctx, field)
|
||||||
|
if err != nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.AppData, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(map[string]interface{})
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalOMap2map(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_User_app_data(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "User",
|
||||||
|
Field: field,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
|
return nil, errors.New("field of type Map does not have child fields")
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _Users_pagination(ctx context.Context, field graphql.CollectedField, obj *model.Users) (ret graphql.Marshaler) {
|
func (ec *executionContext) _Users_pagination(ctx context.Context, field graphql.CollectedField, obj *model.Users) (ret graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_Users_pagination(ctx, field)
|
fc, err := ec.fieldContext_Users_pagination(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -12360,6 +12424,8 @@ func (ec *executionContext) fieldContext_Users_users(ctx context.Context, field
|
||||||
return ec.fieldContext_User_revoked_timestamp(ctx, field)
|
return ec.fieldContext_User_revoked_timestamp(ctx, field)
|
||||||
case "is_multi_factor_auth_enabled":
|
case "is_multi_factor_auth_enabled":
|
||||||
return ec.fieldContext_User_is_multi_factor_auth_enabled(ctx, field)
|
return ec.fieldContext_User_is_multi_factor_auth_enabled(ctx, field)
|
||||||
|
case "app_data":
|
||||||
|
return ec.fieldContext_User_app_data(ctx, field)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("no field named %q was found under type User", field.Name)
|
return nil, fmt.Errorf("no field named %q was found under type User", field.Name)
|
||||||
},
|
},
|
||||||
|
@ -16201,7 +16267,7 @@ func (ec *executionContext) unmarshalInputMobileSignUpInput(ctx context.Context,
|
||||||
asMap[k] = v
|
asMap[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldsInOrder := [...]string{"email", "given_name", "family_name", "middle_name", "nickname", "gender", "birthdate", "phone_number", "picture", "password", "confirm_password", "roles", "scope", "redirect_uri", "is_multi_factor_auth_enabled", "state"}
|
fieldsInOrder := [...]string{"email", "given_name", "family_name", "middle_name", "nickname", "gender", "birthdate", "phone_number", "picture", "password", "confirm_password", "roles", "scope", "redirect_uri", "is_multi_factor_auth_enabled", "state", "app_data"}
|
||||||
for _, k := range fieldsInOrder {
|
for _, k := range fieldsInOrder {
|
||||||
v, ok := asMap[k]
|
v, ok := asMap[k]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -16336,6 +16402,14 @@ func (ec *executionContext) unmarshalInputMobileSignUpInput(ctx context.Context,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return it, err
|
return it, err
|
||||||
}
|
}
|
||||||
|
case "app_data":
|
||||||
|
var err error
|
||||||
|
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("app_data"))
|
||||||
|
it.AppData, err = ec.unmarshalOMap2map(ctx, v)
|
||||||
|
if err != nil {
|
||||||
|
return it, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16609,7 +16683,7 @@ func (ec *executionContext) unmarshalInputSignUpInput(ctx context.Context, obj i
|
||||||
asMap[k] = v
|
asMap[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldsInOrder := [...]string{"email", "given_name", "family_name", "middle_name", "nickname", "gender", "birthdate", "phone_number", "picture", "password", "confirm_password", "roles", "scope", "redirect_uri", "is_multi_factor_auth_enabled", "state"}
|
fieldsInOrder := [...]string{"email", "given_name", "family_name", "middle_name", "nickname", "gender", "birthdate", "phone_number", "picture", "password", "confirm_password", "roles", "scope", "redirect_uri", "is_multi_factor_auth_enabled", "state", "app_data"}
|
||||||
for _, k := range fieldsInOrder {
|
for _, k := range fieldsInOrder {
|
||||||
v, ok := asMap[k]
|
v, ok := asMap[k]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -16744,6 +16818,14 @@ func (ec *executionContext) unmarshalInputSignUpInput(ctx context.Context, obj i
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return it, err
|
return it, err
|
||||||
}
|
}
|
||||||
|
case "app_data":
|
||||||
|
var err error
|
||||||
|
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("app_data"))
|
||||||
|
it.AppData, err = ec.unmarshalOMap2map(ctx, v)
|
||||||
|
if err != nil {
|
||||||
|
return it, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17333,7 +17415,7 @@ func (ec *executionContext) unmarshalInputUpdateProfileInput(ctx context.Context
|
||||||
asMap[k] = v
|
asMap[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldsInOrder := [...]string{"old_password", "new_password", "confirm_new_password", "email", "given_name", "family_name", "middle_name", "nickname", "gender", "birthdate", "phone_number", "picture", "is_multi_factor_auth_enabled"}
|
fieldsInOrder := [...]string{"old_password", "new_password", "confirm_new_password", "email", "given_name", "family_name", "middle_name", "nickname", "gender", "birthdate", "phone_number", "picture", "is_multi_factor_auth_enabled", "app_data"}
|
||||||
for _, k := range fieldsInOrder {
|
for _, k := range fieldsInOrder {
|
||||||
v, ok := asMap[k]
|
v, ok := asMap[k]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -17444,6 +17526,14 @@ func (ec *executionContext) unmarshalInputUpdateProfileInput(ctx context.Context
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return it, err
|
return it, err
|
||||||
}
|
}
|
||||||
|
case "app_data":
|
||||||
|
var err error
|
||||||
|
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("app_data"))
|
||||||
|
it.AppData, err = ec.unmarshalOMap2map(ctx, v)
|
||||||
|
if err != nil {
|
||||||
|
return it, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17457,7 +17547,7 @@ func (ec *executionContext) unmarshalInputUpdateUserInput(ctx context.Context, o
|
||||||
asMap[k] = v
|
asMap[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldsInOrder := [...]string{"id", "email", "email_verified", "given_name", "family_name", "middle_name", "nickname", "gender", "birthdate", "phone_number", "picture", "roles", "is_multi_factor_auth_enabled"}
|
fieldsInOrder := [...]string{"id", "email", "email_verified", "given_name", "family_name", "middle_name", "nickname", "gender", "birthdate", "phone_number", "picture", "roles", "is_multi_factor_auth_enabled", "app_data"}
|
||||||
for _, k := range fieldsInOrder {
|
for _, k := range fieldsInOrder {
|
||||||
v, ok := asMap[k]
|
v, ok := asMap[k]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -17568,6 +17658,14 @@ func (ec *executionContext) unmarshalInputUpdateUserInput(ctx context.Context, o
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return it, err
|
return it, err
|
||||||
}
|
}
|
||||||
|
case "app_data":
|
||||||
|
var err error
|
||||||
|
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("app_data"))
|
||||||
|
it.AppData, err = ec.unmarshalOMap2map(ctx, v)
|
||||||
|
if err != nil {
|
||||||
|
return it, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19474,6 +19572,10 @@ func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj
|
||||||
|
|
||||||
out.Values[i] = ec._User_is_multi_factor_auth_enabled(ctx, field, obj)
|
out.Values[i] = ec._User_is_multi_factor_auth_enabled(ctx, field, obj)
|
||||||
|
|
||||||
|
case "app_data":
|
||||||
|
|
||||||
|
out.Values[i] = ec._User_app_data(ctx, field, obj)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
panic("unknown field " + strconv.Quote(field.Name))
|
panic("unknown field " + strconv.Quote(field.Name))
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,22 +207,23 @@ type MobileLoginInput struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type MobileSignUpInput struct {
|
type MobileSignUpInput struct {
|
||||||
Email *string `json:"email"`
|
Email *string `json:"email"`
|
||||||
GivenName *string `json:"given_name"`
|
GivenName *string `json:"given_name"`
|
||||||
FamilyName *string `json:"family_name"`
|
FamilyName *string `json:"family_name"`
|
||||||
MiddleName *string `json:"middle_name"`
|
MiddleName *string `json:"middle_name"`
|
||||||
Nickname *string `json:"nickname"`
|
Nickname *string `json:"nickname"`
|
||||||
Gender *string `json:"gender"`
|
Gender *string `json:"gender"`
|
||||||
Birthdate *string `json:"birthdate"`
|
Birthdate *string `json:"birthdate"`
|
||||||
PhoneNumber string `json:"phone_number"`
|
PhoneNumber string `json:"phone_number"`
|
||||||
Picture *string `json:"picture"`
|
Picture *string `json:"picture"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
ConfirmPassword string `json:"confirm_password"`
|
ConfirmPassword string `json:"confirm_password"`
|
||||||
Roles []string `json:"roles"`
|
Roles []string `json:"roles"`
|
||||||
Scope []string `json:"scope"`
|
Scope []string `json:"scope"`
|
||||||
RedirectURI *string `json:"redirect_uri"`
|
RedirectURI *string `json:"redirect_uri"`
|
||||||
IsMultiFactorAuthEnabled *bool `json:"is_multi_factor_auth_enabled"`
|
IsMultiFactorAuthEnabled *bool `json:"is_multi_factor_auth_enabled"`
|
||||||
State *string `json:"state"`
|
State *string `json:"state"`
|
||||||
|
AppData map[string]interface{} `json:"app_data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type OAuthRevokeInput struct {
|
type OAuthRevokeInput struct {
|
||||||
|
@ -282,22 +283,23 @@ type SessionQueryInput struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type SignUpInput struct {
|
type SignUpInput struct {
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
GivenName *string `json:"given_name"`
|
GivenName *string `json:"given_name"`
|
||||||
FamilyName *string `json:"family_name"`
|
FamilyName *string `json:"family_name"`
|
||||||
MiddleName *string `json:"middle_name"`
|
MiddleName *string `json:"middle_name"`
|
||||||
Nickname *string `json:"nickname"`
|
Nickname *string `json:"nickname"`
|
||||||
Gender *string `json:"gender"`
|
Gender *string `json:"gender"`
|
||||||
Birthdate *string `json:"birthdate"`
|
Birthdate *string `json:"birthdate"`
|
||||||
PhoneNumber *string `json:"phone_number"`
|
PhoneNumber *string `json:"phone_number"`
|
||||||
Picture *string `json:"picture"`
|
Picture *string `json:"picture"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
ConfirmPassword string `json:"confirm_password"`
|
ConfirmPassword string `json:"confirm_password"`
|
||||||
Roles []string `json:"roles"`
|
Roles []string `json:"roles"`
|
||||||
Scope []string `json:"scope"`
|
Scope []string `json:"scope"`
|
||||||
RedirectURI *string `json:"redirect_uri"`
|
RedirectURI *string `json:"redirect_uri"`
|
||||||
IsMultiFactorAuthEnabled *bool `json:"is_multi_factor_auth_enabled"`
|
IsMultiFactorAuthEnabled *bool `json:"is_multi_factor_auth_enabled"`
|
||||||
State *string `json:"state"`
|
State *string `json:"state"`
|
||||||
|
AppData map[string]interface{} `json:"app_data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type TestEndpointRequest struct {
|
type TestEndpointRequest struct {
|
||||||
|
@ -380,35 +382,37 @@ type UpdateEnvInput struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateProfileInput struct {
|
type UpdateProfileInput struct {
|
||||||
OldPassword *string `json:"old_password"`
|
OldPassword *string `json:"old_password"`
|
||||||
NewPassword *string `json:"new_password"`
|
NewPassword *string `json:"new_password"`
|
||||||
ConfirmNewPassword *string `json:"confirm_new_password"`
|
ConfirmNewPassword *string `json:"confirm_new_password"`
|
||||||
Email *string `json:"email"`
|
Email *string `json:"email"`
|
||||||
GivenName *string `json:"given_name"`
|
GivenName *string `json:"given_name"`
|
||||||
FamilyName *string `json:"family_name"`
|
FamilyName *string `json:"family_name"`
|
||||||
MiddleName *string `json:"middle_name"`
|
MiddleName *string `json:"middle_name"`
|
||||||
Nickname *string `json:"nickname"`
|
Nickname *string `json:"nickname"`
|
||||||
Gender *string `json:"gender"`
|
Gender *string `json:"gender"`
|
||||||
Birthdate *string `json:"birthdate"`
|
Birthdate *string `json:"birthdate"`
|
||||||
PhoneNumber *string `json:"phone_number"`
|
PhoneNumber *string `json:"phone_number"`
|
||||||
Picture *string `json:"picture"`
|
Picture *string `json:"picture"`
|
||||||
IsMultiFactorAuthEnabled *bool `json:"is_multi_factor_auth_enabled"`
|
IsMultiFactorAuthEnabled *bool `json:"is_multi_factor_auth_enabled"`
|
||||||
|
AppData map[string]interface{} `json:"app_data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateUserInput struct {
|
type UpdateUserInput struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Email *string `json:"email"`
|
Email *string `json:"email"`
|
||||||
EmailVerified *bool `json:"email_verified"`
|
EmailVerified *bool `json:"email_verified"`
|
||||||
GivenName *string `json:"given_name"`
|
GivenName *string `json:"given_name"`
|
||||||
FamilyName *string `json:"family_name"`
|
FamilyName *string `json:"family_name"`
|
||||||
MiddleName *string `json:"middle_name"`
|
MiddleName *string `json:"middle_name"`
|
||||||
Nickname *string `json:"nickname"`
|
Nickname *string `json:"nickname"`
|
||||||
Gender *string `json:"gender"`
|
Gender *string `json:"gender"`
|
||||||
Birthdate *string `json:"birthdate"`
|
Birthdate *string `json:"birthdate"`
|
||||||
PhoneNumber *string `json:"phone_number"`
|
PhoneNumber *string `json:"phone_number"`
|
||||||
Picture *string `json:"picture"`
|
Picture *string `json:"picture"`
|
||||||
Roles []*string `json:"roles"`
|
Roles []*string `json:"roles"`
|
||||||
IsMultiFactorAuthEnabled *bool `json:"is_multi_factor_auth_enabled"`
|
IsMultiFactorAuthEnabled *bool `json:"is_multi_factor_auth_enabled"`
|
||||||
|
AppData map[string]interface{} `json:"app_data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateWebhookRequest struct {
|
type UpdateWebhookRequest struct {
|
||||||
|
@ -421,25 +425,26 @@ type UpdateWebhookRequest struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
EmailVerified bool `json:"email_verified"`
|
EmailVerified bool `json:"email_verified"`
|
||||||
SignupMethods string `json:"signup_methods"`
|
SignupMethods string `json:"signup_methods"`
|
||||||
GivenName *string `json:"given_name"`
|
GivenName *string `json:"given_name"`
|
||||||
FamilyName *string `json:"family_name"`
|
FamilyName *string `json:"family_name"`
|
||||||
MiddleName *string `json:"middle_name"`
|
MiddleName *string `json:"middle_name"`
|
||||||
Nickname *string `json:"nickname"`
|
Nickname *string `json:"nickname"`
|
||||||
PreferredUsername *string `json:"preferred_username"`
|
PreferredUsername *string `json:"preferred_username"`
|
||||||
Gender *string `json:"gender"`
|
Gender *string `json:"gender"`
|
||||||
Birthdate *string `json:"birthdate"`
|
Birthdate *string `json:"birthdate"`
|
||||||
PhoneNumber *string `json:"phone_number"`
|
PhoneNumber *string `json:"phone_number"`
|
||||||
PhoneNumberVerified *bool `json:"phone_number_verified"`
|
PhoneNumberVerified *bool `json:"phone_number_verified"`
|
||||||
Picture *string `json:"picture"`
|
Picture *string `json:"picture"`
|
||||||
Roles []string `json:"roles"`
|
Roles []string `json:"roles"`
|
||||||
CreatedAt *int64 `json:"created_at"`
|
CreatedAt *int64 `json:"created_at"`
|
||||||
UpdatedAt *int64 `json:"updated_at"`
|
UpdatedAt *int64 `json:"updated_at"`
|
||||||
RevokedTimestamp *int64 `json:"revoked_timestamp"`
|
RevokedTimestamp *int64 `json:"revoked_timestamp"`
|
||||||
IsMultiFactorAuthEnabled *bool `json:"is_multi_factor_auth_enabled"`
|
IsMultiFactorAuthEnabled *bool `json:"is_multi_factor_auth_enabled"`
|
||||||
|
AppData map[string]interface{} `json:"app_data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Users struct {
|
type Users struct {
|
||||||
|
|
|
@ -51,6 +51,7 @@ type User {
|
||||||
updated_at: Int64
|
updated_at: Int64
|
||||||
revoked_timestamp: Int64
|
revoked_timestamp: Int64
|
||||||
is_multi_factor_auth_enabled: Boolean
|
is_multi_factor_auth_enabled: Boolean
|
||||||
|
app_data: Map
|
||||||
}
|
}
|
||||||
|
|
||||||
type Users {
|
type Users {
|
||||||
|
@ -322,6 +323,7 @@ input MobileSignUpInput {
|
||||||
# it is used to get code for an on-going auth process during login
|
# it is used to get code for an on-going auth process during login
|
||||||
# and use that code for setting `c_hash` in id_token
|
# and use that code for setting `c_hash` in id_token
|
||||||
state: String
|
state: String
|
||||||
|
app_data: Map
|
||||||
}
|
}
|
||||||
|
|
||||||
input SignUpInput {
|
input SignUpInput {
|
||||||
|
@ -344,6 +346,7 @@ input SignUpInput {
|
||||||
# it is used to get code for an on-going auth process during login
|
# it is used to get code for an on-going auth process during login
|
||||||
# and use that code for setting `c_hash` in id_token
|
# and use that code for setting `c_hash` in id_token
|
||||||
state: String
|
state: String
|
||||||
|
app_data: Map
|
||||||
}
|
}
|
||||||
|
|
||||||
input LoginInput {
|
input LoginInput {
|
||||||
|
@ -399,6 +402,7 @@ input UpdateProfileInput {
|
||||||
phone_number: String
|
phone_number: String
|
||||||
picture: String
|
picture: String
|
||||||
is_multi_factor_auth_enabled: Boolean
|
is_multi_factor_auth_enabled: Boolean
|
||||||
|
app_data: Map
|
||||||
}
|
}
|
||||||
|
|
||||||
input UpdateUserInput {
|
input UpdateUserInput {
|
||||||
|
@ -415,6 +419,7 @@ input UpdateUserInput {
|
||||||
picture: String
|
picture: String
|
||||||
roles: [String]
|
roles: [String]
|
||||||
is_multi_factor_auth_enabled: Boolean
|
is_multi_factor_auth_enabled: Boolean
|
||||||
|
app_data: Map
|
||||||
}
|
}
|
||||||
|
|
||||||
input ForgotPasswordInput {
|
input ForgotPasswordInput {
|
||||||
|
|
|
@ -171,7 +171,6 @@ func LoginResolver(ctx context.Context, params model.LoginInput) (*model.AuthRes
|
||||||
if nonce == "" {
|
if nonce == "" {
|
||||||
nonce = uuid.New().String()
|
nonce = uuid.New().String()
|
||||||
}
|
}
|
||||||
|
|
||||||
authToken, err := token.CreateAuthToken(gc, user, roles, scope, constants.AuthRecipeMethodBasicAuth, nonce, code)
|
authToken, err := token.CreateAuthToken(gc, user, roles, scope, constants.AuthRecipeMethodBasicAuth, nonce, code)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debug("Failed to create auth token", err)
|
log.Debug("Failed to create auth token", err)
|
||||||
|
|
|
@ -2,6 +2,8 @@ package resolvers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
@ -171,6 +173,17 @@ func SignupResolver(ctx context.Context, params model.SignUpInput) (*model.AuthR
|
||||||
user.IsMultiFactorAuthEnabled = refs.NewBoolRef(true)
|
user.IsMultiFactorAuthEnabled = refs.NewBoolRef(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if params.AppData != nil {
|
||||||
|
appDataString := ""
|
||||||
|
appDataBytes, err := json.Marshal(params.AppData)
|
||||||
|
if err != nil {
|
||||||
|
log.Debug("failed to marshall source app_data: ", err)
|
||||||
|
return nil, errors.New("malformed app_data")
|
||||||
|
}
|
||||||
|
appDataString = string(appDataBytes)
|
||||||
|
user.AppData = &appDataString
|
||||||
|
}
|
||||||
|
|
||||||
user.SignupMethods = constants.AuthRecipeMethodBasicAuth
|
user.SignupMethods = constants.AuthRecipeMethodBasicAuth
|
||||||
isEmailVerificationDisabled, err := memorystore.Provider.GetBoolStoreEnvVariable(constants.EnvKeyDisableEmailVerification)
|
isEmailVerificationDisabled, err := memorystore.Provider.GetBoolStoreEnvVariable(constants.EnvKeyDisableEmailVerification)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package resolvers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -47,7 +48,7 @@ func UpdateProfileResolver(ctx context.Context, params model.UpdateProfileInput)
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate if all params are not empty
|
// validate if all params are not empty
|
||||||
if params.GivenName == nil && params.FamilyName == nil && params.Picture == nil && params.MiddleName == nil && params.Nickname == nil && params.OldPassword == nil && params.Email == nil && params.Birthdate == nil && params.Gender == nil && params.PhoneNumber == nil && params.NewPassword == nil && params.ConfirmNewPassword == nil && params.IsMultiFactorAuthEnabled == nil {
|
if params.GivenName == nil && params.FamilyName == nil && params.Picture == nil && params.MiddleName == nil && params.Nickname == nil && params.OldPassword == nil && params.Email == nil && params.Birthdate == nil && params.Gender == nil && params.PhoneNumber == nil && params.NewPassword == nil && params.ConfirmNewPassword == nil && params.IsMultiFactorAuthEnabled == nil && params.AppData == nil {
|
||||||
log.Debug("All params are empty")
|
log.Debug("All params are empty")
|
||||||
return res, fmt.Errorf("please enter at least one param to update")
|
return res, fmt.Errorf("please enter at least one param to update")
|
||||||
}
|
}
|
||||||
|
@ -56,7 +57,6 @@ func UpdateProfileResolver(ctx context.Context, params model.UpdateProfileInput)
|
||||||
log := log.WithFields(log.Fields{
|
log := log.WithFields(log.Fields{
|
||||||
"user_id": userID,
|
"user_id": userID,
|
||||||
})
|
})
|
||||||
|
|
||||||
user, err := db.Provider.GetUserByID(ctx, userID)
|
user, err := db.Provider.GetUserByID(ctx, userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debug("Failed to get user by id: ", err)
|
log.Debug("Failed to get user by id: ", err)
|
||||||
|
@ -99,7 +99,16 @@ func UpdateProfileResolver(ctx context.Context, params model.UpdateProfileInput)
|
||||||
if params.Picture != nil && refs.StringValue(user.Picture) != refs.StringValue(params.Picture) {
|
if params.Picture != nil && refs.StringValue(user.Picture) != refs.StringValue(params.Picture) {
|
||||||
user.Picture = params.Picture
|
user.Picture = params.Picture
|
||||||
}
|
}
|
||||||
|
if params.AppData != nil {
|
||||||
|
appDataString := ""
|
||||||
|
appDataBytes, err := json.Marshal(params.AppData)
|
||||||
|
if err != nil {
|
||||||
|
log.Debug("failed to marshall source app_data: ", err)
|
||||||
|
return nil, errors.New("malformed app_data")
|
||||||
|
}
|
||||||
|
appDataString = string(appDataBytes)
|
||||||
|
user.AppData = &appDataString
|
||||||
|
}
|
||||||
if params.IsMultiFactorAuthEnabled != nil && refs.BoolValue(user.IsMultiFactorAuthEnabled) != refs.BoolValue(params.IsMultiFactorAuthEnabled) {
|
if params.IsMultiFactorAuthEnabled != nil && refs.BoolValue(user.IsMultiFactorAuthEnabled) != refs.BoolValue(params.IsMultiFactorAuthEnabled) {
|
||||||
if refs.BoolValue(params.IsMultiFactorAuthEnabled) {
|
if refs.BoolValue(params.IsMultiFactorAuthEnabled) {
|
||||||
isEnvServiceEnabled, err := memorystore.Provider.GetBoolStoreEnvVariable(constants.EnvKeyIsEmailServiceEnabled)
|
isEnvServiceEnabled, err := memorystore.Provider.GetBoolStoreEnvVariable(constants.EnvKeyIsEmailServiceEnabled)
|
||||||
|
|
|
@ -2,6 +2,7 @@ package resolvers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -95,6 +96,17 @@ func UpdateUserResolver(ctx context.Context, params model.UpdateUserInput) (*mod
|
||||||
user.Picture = params.Picture
|
user.Picture = params.Picture
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if params.AppData != nil {
|
||||||
|
appDataString := ""
|
||||||
|
appDataBytes, err := json.Marshal(params.AppData)
|
||||||
|
if err != nil {
|
||||||
|
log.Debug("failed to marshall source app_data: ", err)
|
||||||
|
return nil, errors.New("malformed app_data")
|
||||||
|
}
|
||||||
|
appDataString = string(appDataBytes)
|
||||||
|
user.AppData = &appDataString
|
||||||
|
}
|
||||||
|
|
||||||
if params.IsMultiFactorAuthEnabled != nil && refs.BoolValue(user.IsMultiFactorAuthEnabled) != refs.BoolValue(params.IsMultiFactorAuthEnabled) {
|
if params.IsMultiFactorAuthEnabled != nil && refs.BoolValue(user.IsMultiFactorAuthEnabled) != refs.BoolValue(params.IsMultiFactorAuthEnabled) {
|
||||||
user.IsMultiFactorAuthEnabled = params.IsMultiFactorAuthEnabled
|
user.IsMultiFactorAuthEnabled = params.IsMultiFactorAuthEnabled
|
||||||
if refs.BoolValue(params.IsMultiFactorAuthEnabled) {
|
if refs.BoolValue(params.IsMultiFactorAuthEnabled) {
|
||||||
|
|
|
@ -386,6 +386,7 @@ func CreateIDToken(user *models.User, roles []string, hostname, nonce, atHash, c
|
||||||
userBytes, _ := json.Marshal(&resUser)
|
userBytes, _ := json.Marshal(&resUser)
|
||||||
var userMap map[string]interface{}
|
var userMap map[string]interface{}
|
||||||
json.Unmarshal(userBytes, &userMap)
|
json.Unmarshal(userBytes, &userMap)
|
||||||
|
fmt.Println("=> userBytes", string(userBytes))
|
||||||
claimKey, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyJwtRoleClaim)
|
claimKey, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyJwtRoleClaim)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
claimKey = "roles"
|
claimKey = "roles"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user