Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

Allow providers to set session User and Email #229

Open
raphink opened this issue Mar 31, 2016 · 4 comments
Open

Allow providers to set session User and Email #229

raphink opened this issue Mar 31, 2016 · 4 comments

Comments

@raphink
Copy link
Contributor

raphink commented Mar 31, 2016

Currently, Oauth2_proxy computers session User from session Email (as the left part of the email string).

It would be better to have providers provide that information, to have a correct X-Forwarded-User value.

@raphink
Copy link
Contributor Author

raphink commented Mar 31, 2016

Use case: in gogs, the field can be used to automatically create users. Passing usernames makes more sense than passing emails for that need.

@hexedpackets
Copy link

This would also be very useful for GitHub, where the user's primary email can often be meaningless to the upstream service (especially if they have a dozen emails on their account like I do), but the username is a useful identifier.

@ekristen
Copy link

+1, what can we do to get this added? Thanks!

@h4wkmoon
Copy link

Hi, I'm not a go dev, but my guess is that the issue is here

func (s *SessionState) userOrEmail() string {
	u := s.User
	if s.Email != "" {
		u = s.Email
	}
	return u
}

As you can see, if the user has an email (which happens all the time), the email overrides the username.
My proposal would be to, either:

  • use "username" instead of the email, as a rule
  • let this be set by parameters. Let's say, a "username field" option in the command-line.

As I said, I don't know golang. How I can I compile and test the changes I could make ? (Code is already cloned on my laptop)

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

No branches or pull requests

4 participants