]> source.dussan.org Git - gitea.git/commit
Add single sign-on support via SSPI on Windows (#8463)
authorQuaSoft <info@quasoft.net>
Fri, 22 Nov 2019 23:33:31 +0000 (01:33 +0200)
committerLauris BH <lauris@nix.lv>
Fri, 22 Nov 2019 23:33:31 +0000 (01:33 +0200)
commit7b4d2f7a2aa3af093571628f979bdc939f10890c
treef9abd74c01d006892f5474557cb545e4f60dfe71
parenteb1b225d9a920e68ce415b9732b4ec1d9527a2a2
Add single sign-on support via SSPI on Windows (#8463)

* Add single sign-on support via SSPI on Windows

* Ensure plugins implement interface

* Ensure plugins implement interface

* Move functions used only by the SSPI auth method to sspi_windows.go

* Field SSPISeparatorReplacement of AuthenticationForm should not be required via binding, as binding will insist the field is non-empty even if another login type is selected

* Fix breaking of oauth authentication on download links. Do not create new session with SSPI authentication on download links.

* Update documentation for the new 'SPNEGO with SSPI' login source

* Mention in documentation that ROOT_URL should contain the FQDN of the server

* Make sure that Contexter is not checking for active login sources when the ORM engine is not initialized (eg. when installing)

* Always initialize and free SSO methods, even if they are not enabled, as a method can be activated while the app is running (from Authentication sources)

* Add option in SSPIConfig for removing of domains from logon names

* Update helper text for StripDomainNames option

* Make sure handleSignIn() is called after a new user object is created by SSPI auth method

* Remove default value from text of form field helper

Co-Authored-By: Lauris BH <lauris@nix.lv>
* Remove default value from text of form field helper

Co-Authored-By: Lauris BH <lauris@nix.lv>
* Remove default value from text of form field helper

Co-Authored-By: Lauris BH <lauris@nix.lv>
* Only make a query to the DB to check if SSPI is enabled on handlers that need that information for templates

* Remove code duplication

* Log errors in ActiveLoginSources

Co-Authored-By: Lauris BH <lauris@nix.lv>
* Revert suffix of randomly generated E-mails for Reverse proxy authentication

Co-Authored-By: Lauris BH <lauris@nix.lv>
* Revert unneeded white-space change in template

Co-Authored-By: Lauris BH <lauris@nix.lv>
* Add copyright comments at the top of new files

* Use loopback name for randomly generated emails

* Add locale tag for the SSPISeparatorReplacement field with proper casing

* Revert casing of SSPISeparatorReplacement field in locale file, moving it up, next to other form fields

* Update docs/content/doc/features/authentication.en-us.md

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Remove Priority() method and define the order in which SSO auth methods should be executed in one place

* Log authenticated username only if it's not empty

* Rephrase helper text for automatic creation of users

* Return error if more than one active SSPI auth source is found

* Change newUser() function to return error, letting caller log/handle the error

* Move isPublicResource, isPublicPage and handleSignIn functions outside SSPI auth method to allow other SSO methods to reuse them if needed

* Refactor initialization of the list containing SSO auth methods

* Validate SSPI settings on POST

* Change SSPI to only perform authentication on its own login page, API paths and download links. Leave Toggle middleware to redirect non authenticated users to login page

* Make 'Default language' in SSPI config empty, unless changed by admin

* Show error if admin tries to add a second authentication source of type SSPI

* Simplify declaration of global variable

* Rebuild gitgraph.js on Linux

* Make sure config values containing only whitespace are not accepted
174 files changed:
docs/content/doc/features/authentication.en-us.md
go.mod
go.sum
models/login_source.go
modules/auth/auth.go
modules/auth/auth_form.go
modules/auth/sso/basic.go [new file with mode: 0644]
modules/auth/sso/interface.go [new file with mode: 0644]
modules/auth/sso/oauth2.go [new file with mode: 0644]
modules/auth/sso/reverseproxy.go [new file with mode: 0644]
modules/auth/sso/session.go [new file with mode: 0644]
modules/auth/sso/sso.go [new file with mode: 0644]
modules/auth/sso/sspi_windows.go [new file with mode: 0644]
options/locale/locale_en-US.ini
public/js/index.js
public/js/index.js.map
routers/admin/auths.go
routers/init.go
routers/repo/http.go
routers/user/auth.go
templates/admin/auth/edit.tmpl
templates/admin/auth/new.tmpl
templates/admin/auth/source/sspi.tmpl [new file with mode: 0644]
templates/user/auth/signin_navbar.tmpl
vendor/github.com/quasoft/websspi/.gitignore [new file with mode: 0644]
vendor/github.com/quasoft/websspi/.travis.yml [new file with mode: 0644]
vendor/github.com/quasoft/websspi/LICENSE [new file with mode: 0644]
vendor/github.com/quasoft/websspi/README.md [new file with mode: 0644]
vendor/github.com/quasoft/websspi/go.mod [new file with mode: 0644]
vendor/github.com/quasoft/websspi/go.sum [new file with mode: 0644]
vendor/github.com/quasoft/websspi/secctx/session.go [new file with mode: 0644]
vendor/github.com/quasoft/websspi/secctx/store.go [new file with mode: 0644]
vendor/github.com/quasoft/websspi/userinfo.go [new file with mode: 0644]
vendor/github.com/quasoft/websspi/utf16.go [new file with mode: 0644]
vendor/github.com/quasoft/websspi/websspi_windows.go [new file with mode: 0644]
vendor/github.com/quasoft/websspi/win32_windows.go [new file with mode: 0644]
vendor/golang.org/x/sys/cpu/byteorder.go
vendor/golang.org/x/sys/cpu/cpu.go
vendor/golang.org/x/sys/cpu/cpu_arm.go
vendor/golang.org/x/sys/cpu/cpu_linux_arm.go [new file with mode: 0644]
vendor/golang.org/x/sys/unix/mkall.sh
vendor/golang.org/x/sys/unix/mkerrors.sh
vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go [new file with mode: 0644]
vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go [new file with mode: 0644]
vendor/golang.org/x/sys/unix/syscall_darwin.go
vendor/golang.org/x/sys/unix/syscall_darwin_386.1_11.go [new file with mode: 0644]
vendor/golang.org/x/sys/unix/syscall_darwin_386.go
vendor/golang.org/x/sys/unix/syscall_darwin_amd64.1_11.go [new file with mode: 0644]
vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
vendor/golang.org/x/sys/unix/syscall_darwin_arm.1_11.go [new file with mode: 0644]
vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
vendor/golang.org/x/sys/unix/syscall_darwin_arm64.1_11.go [new file with mode: 0644]
vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
vendor/golang.org/x/sys/unix/syscall_dragonfly.go
vendor/golang.org/x/sys/unix/syscall_freebsd.go
vendor/golang.org/x/sys/unix/syscall_linux.go
vendor/golang.org/x/sys/unix/syscall_netbsd.go
vendor/golang.org/x/sys/unix/syscall_openbsd.go
vendor/golang.org/x/sys/unix/syscall_solaris.go
vendor/golang.org/x/sys/unix/zerrors_darwin_386.go
vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go
vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go
vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go
vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go
vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go
vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go
vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go
vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go
vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go
vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go
vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go
vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go
vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go
vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go
vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go
vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go
vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_11.go
vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.go [new file with mode: 0644]
vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.s [new file with mode: 0644]
vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go
vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s
vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_11.go
vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go [new file with mode: 0644]
vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s [new file with mode: 0644]
vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_11.go
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.go [new file with mode: 0644]
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.s [new file with mode: 0644]
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_11.go
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go [new file with mode: 0644]
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s [new file with mode: 0644]
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go
vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go
vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go
vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go
vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go
vendor/golang.org/x/sys/unix/zsyscall_linux_386.go
vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go
vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go
vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go
vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go
vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go
vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go
vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go
vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go
vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go
vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go
vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go
vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go
vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go
vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go
vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go
vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go
vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go
vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go
vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go
vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go
vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go
vendor/golang.org/x/sys/unix/zsysnum_linux_386.go
vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go
vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go
vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go
vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go
vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go
vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go
vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
vendor/golang.org/x/sys/unix/ztypes_linux_386.go
vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go
vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
vendor/golang.org/x/sys/windows/asm_windows_386.s [deleted file]
vendor/golang.org/x/sys/windows/asm_windows_amd64.s [deleted file]
vendor/golang.org/x/sys/windows/asm_windows_arm.s [deleted file]
vendor/golang.org/x/sys/windows/dll_windows.go
vendor/golang.org/x/sys/windows/mksyscall.go
vendor/golang.org/x/sys/windows/security_windows.go
vendor/golang.org/x/sys/windows/syscall_windows.go
vendor/golang.org/x/sys/windows/types_windows.go
vendor/golang.org/x/sys/windows/zsyscall_windows.go
vendor/modules.txt
web_src/js/index.js