c82f568b2c
We were previously issuing both client certs and server certs with both extended key usages included. Split the Issue*() methods into separate methods for issuing server certs versus client certs so they can have different extended key usages tailored for each use case. Also took the opportunity to clean up the parameters of the Issue*() methods and New() methods to more closely match how we prefer to call them. We were always only passing the common name part of the pkix.Name to New(), so now the New() method just takes the common name as a string. When making a server cert, we don't need to set the deprecated common name field, so remove that param. When making a client cert, we're always making it in the format expected by the Kube API server, so just accept the username and group as parameters directly.
57 lines
2.4 KiB
Go
57 lines
2.4 KiB
Go
// Copyright 2020-2021 the Pinniped contributors. All Rights Reserved.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
// Code generated by MockGen. DO NOT EDIT.
|
|
// Source: go.pinniped.dev/internal/registry/credentialrequest (interfaces: TokenCredentialRequestAuthenticator)
|
|
|
|
// Package credentialrequestmocks is a generated GoMock package.
|
|
package credentialrequestmocks
|
|
|
|
import (
|
|
context "context"
|
|
reflect "reflect"
|
|
|
|
gomock "github.com/golang/mock/gomock"
|
|
login "go.pinniped.dev/generated/latest/apis/concierge/login"
|
|
user "k8s.io/apiserver/pkg/authentication/user"
|
|
)
|
|
|
|
// MockTokenCredentialRequestAuthenticator is a mock of TokenCredentialRequestAuthenticator interface.
|
|
type MockTokenCredentialRequestAuthenticator struct {
|
|
ctrl *gomock.Controller
|
|
recorder *MockTokenCredentialRequestAuthenticatorMockRecorder
|
|
}
|
|
|
|
// MockTokenCredentialRequestAuthenticatorMockRecorder is the mock recorder for MockTokenCredentialRequestAuthenticator.
|
|
type MockTokenCredentialRequestAuthenticatorMockRecorder struct {
|
|
mock *MockTokenCredentialRequestAuthenticator
|
|
}
|
|
|
|
// NewMockTokenCredentialRequestAuthenticator creates a new mock instance.
|
|
func NewMockTokenCredentialRequestAuthenticator(ctrl *gomock.Controller) *MockTokenCredentialRequestAuthenticator {
|
|
mock := &MockTokenCredentialRequestAuthenticator{ctrl: ctrl}
|
|
mock.recorder = &MockTokenCredentialRequestAuthenticatorMockRecorder{mock}
|
|
return mock
|
|
}
|
|
|
|
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
func (m *MockTokenCredentialRequestAuthenticator) EXPECT() *MockTokenCredentialRequestAuthenticatorMockRecorder {
|
|
return m.recorder
|
|
}
|
|
|
|
// AuthenticateTokenCredentialRequest mocks base method.
|
|
func (m *MockTokenCredentialRequestAuthenticator) AuthenticateTokenCredentialRequest(arg0 context.Context, arg1 *login.TokenCredentialRequest) (user.Info, error) {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "AuthenticateTokenCredentialRequest", arg0, arg1)
|
|
ret0, _ := ret[0].(user.Info)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// AuthenticateTokenCredentialRequest indicates an expected call of AuthenticateTokenCredentialRequest.
|
|
func (mr *MockTokenCredentialRequestAuthenticatorMockRecorder) AuthenticateTokenCredentialRequest(arg0, arg1 interface{}) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AuthenticateTokenCredentialRequest", reflect.TypeOf((*MockTokenCredentialRequestAuthenticator)(nil).AuthenticateTokenCredentialRequest), arg0, arg1)
|
|
}
|