-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
OAuth2 auto-register #5123
Merged
Merged
OAuth2 auto-register #5123
Changes from 26 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
a3366c4
Refactored handleOAuth2SignIn in routers/user/auth.go
mgjm 6e2ece4
Refactored user creation
mgjm a473815
Added auto-register for OAuth2 users
mgjm a700b02
Moved oauth2 settings to new section in app.ini
mgjm f0124c4
Added oauth2 use nickname setting
mgjm 9504a74
Merge branch 'master' into oauth2-auto-register
lafriks 688afbd
Merge branch 'master' into oauth2-auto-register
mgjm aeb833c
Moved oauth2_client settings to service file
mgjm 527c7e6
Updated comments on auth helpers
mgjm 6a3a0e7
Renamed oauth2_client settings
mgjm 7a84789
Uncommented setting in app.ini.sample
mgjm b57cb72
Merge branch 'master' into oauth2-auto-register
mgjm 3f93e42
Merge branch 'master' into oauth2-auto-register
6543 6fe0f39
fix conflict resolve relict
6543 c39ed5a
Merge branch 'master' into oauth2-auto-register
6543 bcd3fb6
Merge branch 'master' into oauth2-auto-register
6543 9d1e1f2
Added error for missing fields in OAuth2 response
mgjm 8a64dfe
Fixed error handling in createUserInContext
mgjm aece370
Merge branch 'master' into oauth2-auto-register
6543 1373b78
Merge branch 'master' into oauth2-auto-register
6543 8ee4097
Merge branch 'master' into oauth2-auto-register
6543 7b2ff29
Merge branch 'master' into oauth2-auto-register
6543 e166d49
Merge branch 'master' into oauth2-auto-register
6543 4cc2d8f
Merge branch 'master' into oauth2-auto-register
kvaster 3edad74
Linking and auto linking on oauth2 registration
kvaster 7a811af
Code cleanup
kvaster 150163e
Fix lint problems
kvaster 586dff7
Fix bugs in validating config options
kvaster fb464db
Convert oauth2 client types to string enums
kvaster d62cf15
Fix ioutil.ReadAll
mgjm f4924a3
Set default username source to nickname
mgjm 28b696c
Merge branch 'master' into oauth2-auto-register
mgjm 491610a
Add copyright and empty line
mgjm cd7241e
Move oauth2 client settings to new file
mgjm a3cf72b
Add automatic oauth2 scopes for github and google
mgjm 3d99ee8
Add hint to change the openid connect scopes if fields are missing
mgjm 917ed54
Merge branch 'master' into oauth2-auto-register
mgjm ebc0d0b
OAuth2 sign in is not handled properly after all merges
kvaster 7795946
Merge branch 'master' into oauth2-auto-register
mgjm d448ed9
Merge branch 'master' into oauth2-auto-register
6543 1d4d7d3
Merge branch 'master' into oauth2-auto-register
6543 8f44610
Merge branch 'master' into oauth2-auto-register
6543 f320e34
More detailed description of options in cheat sheet
kvaster 2987081
Correct info about auto linking security risk
kvaster 7b96396
Extend info about auto linking security risk
mgjm 4de0b71
Merge branch 'master' into oauth2-auto-register
6543 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package migrations | ||
mgjm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
import ( | ||
"xorm.io/xorm" | ||
"xorm.io/xorm/schemas" | ||
) | ||
|
||
func convertAvatarUrlToText(x *xorm.Engine) error { | ||
dbType := x.Dialect().URI().DBType | ||
if dbType == schemas.SQLITE { // For SQLITE, varchar or char will always be represented as TEXT | ||
return nil | ||
} | ||
|
||
// Some oauth2 providers may give very long avatar urls (i.e. Google) | ||
return modifyColumn(x, "external_login_user", &schemas.Column{ | ||
Name: "avatar_url", | ||
SQLType: schemas.SQLType{ | ||
Name: schemas.Text, | ||
}, | ||
Nullable: true, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really need to customize these? Maybe just always request "email profile" if
ENABLE_AUTO_REGISTRATION
is enabled?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Profile scope may be usefull even without auto linking. This patch also provides possibility for automatic avatar update from oauth provider.