2021-01-20 00:37:02 +00:00
|
|
|
// 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"
|
|
|
|
|
2021-02-18 18:37:28 +00:00
|
|
|
authenticationv1alpha1 "go.pinniped.dev/generated/latest/apis/concierge/authentication/v1alpha1"
|
|
|
|
loginv1alpha1 "go.pinniped.dev/generated/latest/apis/concierge/login/v1alpha1"
|
2021-01-20 00:37:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
2021-02-24 18:56:24 +00:00
|
|
|
fmt.Println(base64.StdEncoding.EncodeToString(reqJSON))
|
2021-01-20 00:37:02 +00:00
|
|
|
}
|