MCPcopy
hub / github.com/ContainerSSH/ContainerSSH / NewGSSAPIAuthenticator

Function NewGSSAPIAuthenticator

internal/auth/authentication_factory.go:83–100  ·  view source on GitHub ↗

NewGSSAPIAuthenticator returns a GSSAPI authenticator as configured, and if needed a backing service that needs to run for the authentication to work. If GSSAPI authentication is disabled it returns nil. If the configuration is invalid an error is returned.

(
	cfg config.GSSAPIAuthConfig,
	logger log.Logger,
	metrics metrics.Collector,
)

Source from the content-addressed store, hash-verified

81// run for the authentication to work. If GSSAPI authentication is disabled it returns nil. If the configuration is
82// invalid an error is returned.
83func NewGSSAPIAuthenticator(
84 cfg config.GSSAPIAuthConfig,
85 logger log.Logger,
86 metrics metrics.Collector,
87) (GSSAPIAuthenticator, service.Service, error) {
88 if err := cfg.Validate(); err != nil {
89 return nil, nil, err
90 }
91 switch cfg.Method {
92 case config.GSSAPIAuthMethodDisabled:
93 return nil, nil, nil
94 case config.GSSAPIAuthMethodKerberos:
95 cli, err := NewKerberosClient(AuthenticationTypeGSSAPI, cfg.Kerberos, logger, metrics)
96 return cli, nil, err
97 default:
98 return nil, nil, fmt.Errorf("unsupported method: %s", cfg.Method)
99 }
100}
101
102// NewAuthorizationProvider returns an authorization provider as configured, and if needed a backing service that needs to
103// run for the authorization to work. If authorization is disabled it returns nil. If the configuration is

Callers 1

NewFunction · 0.92

Calls 3

NewKerberosClientFunction · 0.85
ValidateMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected