summaryrefslogtreecommitdiff
path: root/experimental/embed/provider/authentication.go
blob: 3903e6c1c4929744d66881303efa4dfe42eacb45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package provider

import (
	"crypto/x509"

	"github.com/authelia/authelia/v4/internal/authentication"
	"github.com/authelia/authelia/v4/internal/configuration/schema"
)

// NewAuthenticationFile directly instantiates a new authentication.UserProvider using a *authentication.FileUserProvider.
//
// Warning: This method may panic if the provided configuration isn't validated.
func NewAuthenticationFile(config *schema.Configuration) authentication.UserProvider {
	return authentication.NewFileUserProvider(config.AuthenticationBackend.File)
}

// NewAuthenticationLDAP directly instantiates a new authentication.UserProvider using a *authentication.LDAPUserProvider.
//
// Warning: This method may panic if the provided configuration isn't validated.
func NewAuthenticationLDAP(config *schema.Configuration, caCertPool *x509.CertPool) authentication.UserProvider {
	return authentication.NewLDAPUserProvider(config.AuthenticationBackend, caCertPool)
}