// newAuthenticatorFromTokenFile returns an authenticator.Request or an error
func newAuthenticatorFromTokenFile(tokenAuthFile string) (authenticator.Request, error) {
	tokenAuthenticator, err := tokenfile.NewCSV(tokenAuthFile)
	if err != nil {
		return nil, err
	}

	return bearertoken.New(tokenAuthenticator), nil
}
Example #2
0
// NewAuthenticatorFromTokenFile returns an authenticator.Request or an error
func NewAuthenticatorFromTokenFile(tokenAuthFile string) (authenticator.Request, error) {
	var authenticator authenticator.Request
	if len(tokenAuthFile) != 0 {
		tokenAuthenticator, err := tokenfile.NewCSV(tokenAuthFile)
		if err != nil {
			return nil, err
		}
		authenticator = bearertoken.New(tokenAuthenticator)
	}
	return authenticator, nil
}