Add initial implementation of impersonation proxy.

Signed-off-by: Margo Crawford <margaretc@vmware.com>
Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
Margo Crawford
2021-02-03 09:31:13 -08:00
parent e1d06ce4d8
commit b6abb022f6
6 changed files with 510 additions and 0 deletions
@@ -0,0 +1,41 @@
// Copyright 2020-2021 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package main
import (
"encoding/base64"
"encoding/json"
"fmt"
"os"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
authenticationv1alpha1 "go.pinniped.dev/generated/1.20/apis/concierge/authentication/v1alpha1"
loginv1alpha1 "go.pinniped.dev/generated/1.20/apis/concierge/login/v1alpha1"
)
func main() {
reqJSON, err := json.Marshal(&loginv1alpha1.TokenCredentialRequest{
ObjectMeta: metav1.ObjectMeta{
Namespace: os.Getenv("PINNIPED_TEST_CONCIERGE_NAMESPACE"),
},
TypeMeta: metav1.TypeMeta{
Kind: "TokenCredentialRequest",
APIVersion: loginv1alpha1.GroupName + "/v1alpha1",
},
Spec: loginv1alpha1.TokenCredentialRequestSpec{
Token: os.Getenv("PINNIPED_TEST_USER_TOKEN"),
Authenticator: corev1.TypedLocalObjectReference{
APIGroup: &authenticationv1alpha1.SchemeGroupVersion.Group,
Kind: os.Getenv("PINNIPED_AUTHENTICATOR_KIND"),
Name: os.Getenv("PINNIPED_AUTHENTICATOR_NAME"),
},
},
})
if err != nil {
panic(err)
}
fmt.Println(base64.RawURLEncoding.EncodeToString(reqJSON))
}