Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose MapUserFn for NewCustomServer #224

Open
cdanyl opened this issue Oct 15, 2024 · 0 comments
Open

Expose MapUserFn for NewCustomServer #224

cdanyl opened this issue Oct 15, 2024 · 0 comments

Comments

@cdanyl
Copy link

cdanyl commented Oct 15, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant