mirror of https://github.com/go-gitea/gitea.git
Signed-off-by: jolheiser <john.olheiser@gmail.com>
This commit is contained in:
parent
39412c61bf
commit
074f7abd95
|
@ -12,6 +12,9 @@ import (
|
||||||
"github.com/msteinert/pam"
|
"github.com/msteinert/pam"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Supported is true when built with PAM
|
||||||
|
var Supported = true
|
||||||
|
|
||||||
// Auth pam auth service
|
// Auth pam auth service
|
||||||
func Auth(serviceName, userName, passwd string) (string, error) {
|
func Auth(serviceName, userName, passwd string) (string, error) {
|
||||||
t, err := pam.StartFunc(serviceName, userName, func(s pam.Style, msg string) (string, error) {
|
t, err := pam.StartFunc(serviceName, userName, func(s pam.Style, msg string) (string, error) {
|
||||||
|
|
|
@ -10,6 +10,9 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Supported is false when built without PAM
|
||||||
|
var Supported = false
|
||||||
|
|
||||||
// Auth not supported lack of pam tag
|
// Auth not supported lack of pam tag
|
||||||
func Auth(serviceName, userName, passwd string) (string, error) {
|
func Auth(serviceName, userName, passwd string) (string, error) {
|
||||||
return "", errors.New("PAM not supported")
|
return "", errors.New("PAM not supported")
|
||||||
|
|
|
@ -13,6 +13,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/auth"
|
"code.gitea.io/gitea/modules/auth"
|
||||||
"code.gitea.io/gitea/modules/auth/ldap"
|
"code.gitea.io/gitea/modules/auth/ldap"
|
||||||
"code.gitea.io/gitea/modules/auth/oauth2"
|
"code.gitea.io/gitea/modules/auth/oauth2"
|
||||||
|
"code.gitea.io/gitea/modules/auth/pam"
|
||||||
"code.gitea.io/gitea/modules/base"
|
"code.gitea.io/gitea/modules/base"
|
||||||
"code.gitea.io/gitea/modules/context"
|
"code.gitea.io/gitea/modules/context"
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
|
@ -57,14 +58,20 @@ type dropdownItem struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
authSources = []dropdownItem{
|
authSources = func() []dropdownItem {
|
||||||
{models.LoginNames[models.LoginLDAP], models.LoginLDAP},
|
items := []dropdownItem{
|
||||||
{models.LoginNames[models.LoginDLDAP], models.LoginDLDAP},
|
{models.LoginNames[models.LoginLDAP], models.LoginLDAP},
|
||||||
{models.LoginNames[models.LoginSMTP], models.LoginSMTP},
|
{models.LoginNames[models.LoginDLDAP], models.LoginDLDAP},
|
||||||
{models.LoginNames[models.LoginPAM], models.LoginPAM},
|
{models.LoginNames[models.LoginSMTP], models.LoginSMTP},
|
||||||
{models.LoginNames[models.LoginOAuth2], models.LoginOAuth2},
|
{models.LoginNames[models.LoginOAuth2], models.LoginOAuth2},
|
||||||
{models.LoginNames[models.LoginSSPI], models.LoginSSPI},
|
{models.LoginNames[models.LoginSSPI], models.LoginSSPI},
|
||||||
}
|
}
|
||||||
|
if pam.Supported {
|
||||||
|
items = append(items, dropdownItem{models.LoginNames[models.LoginPAM], models.LoginPAM})
|
||||||
|
}
|
||||||
|
return items
|
||||||
|
}()
|
||||||
|
|
||||||
securityProtocols = []dropdownItem{
|
securityProtocols = []dropdownItem{
|
||||||
{models.SecurityProtocolNames[ldap.SecurityProtocolUnencrypted], ldap.SecurityProtocolUnencrypted},
|
{models.SecurityProtocolNames[ldap.SecurityProtocolUnencrypted], ldap.SecurityProtocolUnencrypted},
|
||||||
{models.SecurityProtocolNames[ldap.SecurityProtocolLDAPS], ldap.SecurityProtocolLDAPS},
|
{models.SecurityProtocolNames[ldap.SecurityProtocolLDAPS], ldap.SecurityProtocolLDAPS},
|
||||||
|
|
Loading…
Reference in New Issue