-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add single sign-on support via SSPI on Windows #8463
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
Changes from 3 commits
de972f1
a2d91cb
1a3aff3
f0668a3
a75887e
056929c
c91d9f9
aa43212
e24ebb4
db8bbd8
62e38ab
5d99d6c
d3c328f
16b47df
d4cc173
0d952c8
9cbfd06
2c3abb9
9bff4ae
dd8937c
d5c3e9e
bbbe623
24c6ef1
f7fb038
c9a9f5b
0a4d2c3
734fb6d
9d2a8dd
a8503f0
ab26413
f64128f
d9018e9
9432220
6fd308d
be85ea7
e6dca6b
29e47ef
38be450
e4bbc91
814873a
359cd8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,14 +139,19 @@ func (s *SSPI) getConfig() (*models.SSPIConfig, error) { | |
return sources[0].SSPI(), nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems that more than one can be found, but we will take only the first one. It's probably better then to return an error if more than one is found. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed with commit bc9242f There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should also check when adding new auth source that no SSPI auth source already exists and throw user error there There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lafriks Ok, should we prevent having two source of type SSPI, even if one of them is not active? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually there is little value in having a second SSPI source in deactivated state. There are only a few configuration options, most of them booleans, so there seems to be no reason for someone to want to keep a backup configuration. Changed it to throw an error when adding a new auth source of type SSPI, if another one already exists, no matter if its activated or not. Commit 207e692 |
||
} | ||
|
||
func (s *SSPI) shouldAuthenticate(ctx *macaron.Context) bool { | ||
func (s *SSPI) shouldAuthenticate(ctx *macaron.Context) (shouldAuth bool) { | ||
shouldAuth = false | ||
path := strings.TrimSuffix(ctx.Req.URL.Path, "/") | ||
if path == "/user/login" && ctx.Req.FormValue("user_name") != "" && ctx.Req.FormValue("password") != "" { | ||
return false | ||
} else if ctx.Req.FormValue("auth_with_sspi") == "1" { | ||
return true | ||
if path == "/user/login" { | ||
if ctx.Req.FormValue("user_name") != "" && ctx.Req.FormValue("password") != "" { | ||
shouldAuth = false | ||
} else if ctx.Req.FormValue("auth_with_sspi") == "1" { | ||
shouldAuth = true | ||
} | ||
} else if isAPIPath(ctx) || isAttachmentDownload(ctx) { | ||
shouldAuth = true | ||
} | ||
return !isPublicPage(ctx) && !isPublicResource(ctx) | ||
return | ||
} | ||
|
||
// newUser creates a new user object for the purpose of automatic registration | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1823,7 +1823,7 @@ auths.sspi_strip_domain_names_helper = If checked, domain names will be removed | |
auths.sspi_separator_replacement = Separator to use instead of \, / and @ | ||
auths.sspi_separator_replacement_helper = The character to use to replace the separators of down-level logon names (eg. the \ in "DOMAIN\user") and user principal names (eg. the @ in "[email protected]"). | ||
auths.sspi_default_language = Default user language | ||
auths.sspi_default_language_helper = Default language for users automatically created by SSPI auth method | ||
auths.sspi_default_language_helper = Default language for users automatically created by SSPI auth method. Leave empty if you prefer language to be automatically detected. | ||
auths.tips = Tips | ||
auths.tips.oauth2.general = OAuth2 Authentication | ||
auths.tips.oauth2.general.tip = When registering a new OAuth2 authentication, the callback/redirect URL should be: <host>/user/oauth2/<Authentication Name>/callback | ||
|
@@ -1849,6 +1849,7 @@ auths.delete_auth_desc = Deleting an authentication source prevents users from u | |
auths.still_in_used = The authentication source is still in use. Convert or delete any users using this authentication source first. | ||
auths.deletion_success = The authentication source has been deleted. | ||
auths.login_source_exist = The authentication source '%s' already exists. | ||
auths.login_source_of_type_exist = An authentication source of this type already exists. | ||
|
||
config.server_config = Server Configuration | ||
config.app_name = Site Title | ||
|
Uh oh!
There was an error while loading. Please reload this page.