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, )
| 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. |
| 83 | func 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 |
no test coverage detected