Skip to content

Expose MapUserFn for NewCustomServer #224

@cdanyl

Description

@cdanyl

Using NewCustomServer how can use MapUserFn?

MapUserFn: defaultMapUserFn,
to be able to do something like
ID: "google_" + token.HashID(sha1.New(), data.Value("sub")),

My problem using a customServer, i am blocked with an error provider is not allowed.

A custom provider with name provider doesn't create a user.id equal to provider_1234567890

func (a *Authenticator) isProviderAllowed(userID string) bool {

func newOauth2Provider(
	goauth2 *goauth2.Server,
	oauth2Config *config.Oauth2,
	oauth2loginPageHandler http.HandlerFunc,
	oauth2Logger *OAuth2Logger,
) *provider.CustomServer {
	serverOption := provider.CustomServerOpt{
		URL:              oauth2Config.Server,
		L:                oauth2Logger,
		LoginPageHandler: oauth2loginPageHandler,
	}

	prov := provider.NewCustomServer(goauth2, serverOption)

	return prov
}

server.AddCustomProvider("provider", client, oauth2Provider.HandlerOpt)

Maybe i am doing something wrong, but i think is good idea to expose MapUserFn

Maybe related : umputun/remark42#1660 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions