-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#5612) * fix #5608 support authentication with certificate * fix #5608 support authentication with certificate * review
- Loading branch information
Showing
9 changed files
with
214 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
certData=`echo $PART1 $1 | tr '[a-z]' '[A-Z]'` | ||
keyData=`echo $PART2 $1 | tr '[a-z]' '[A-Z]'` | ||
cat <<EOF | ||
{ | ||
"kind": "ExecCredential", | ||
"apiVersion": "client.authentication.k8s.io/v1", | ||
"spec": {}, | ||
"status": { | ||
"clientCertificateData": "$certData", | ||
"clientKeyData": "$keyData" | ||
} | ||
} | ||
EOF |
48 changes: 48 additions & 0 deletions
48
kubernetes-client-api/src/test/resources/cert-generator-win.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
@REM | ||
@REM Copyright (C) 2015 Red Hat, Inc. | ||
@REM | ||
@REM Licensed under the Apache License, Version 2.0 (the "License"); | ||
@REM you may not use this file except in compliance with the License. | ||
@REM You may obtain a copy of the License at | ||
@REM | ||
@REM http://www.apache.org/licenses/LICENSE-2.0 | ||
@REM | ||
@REM Unless required by applicable law or agreed to in writing, software | ||
@REM distributed under the License is distributed on an "AS IS" BASIS, | ||
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
@REM See the License for the specific language governing permissions and | ||
@REM limitations under the License. | ||
@REM | ||
|
||
@echo off | ||
SET valid=true | ||
IF [%PART1%]==[] ( | ||
IF [%PART2%]==[] ( | ||
SET valid=false | ||
) | ||
) | ||
IF [%valid%]==[true] ( | ||
IF [%1]==[] ( | ||
SET certData=%PART1% | ||
SET keyData=%PART2% | ||
) ELSE ( | ||
SET certData=%PART1% %~1 | ||
SET keyData=%PART2% %~1 | ||
) | ||
CALL :upper certData | ||
CALL :upper keyData | ||
) | ||
|
||
echo { | ||
echo "kind": "ExecCredential", | ||
echo "apiVersion": "client.authentication.k8s.io/v1", | ||
echo "spec": {}, | ||
echo "status": { | ||
echo "clientCertificateData": "%certData%", | ||
echo "clientKeyData": "%keyData%" | ||
echo } | ||
echo } | ||
GOTO :EOF | ||
|
||
:upper | ||
FOR %%a IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO CALL SET "%1=%%%1:%%a=%%a%%%" |
25 changes: 25 additions & 0 deletions
25
kubernetes-client-api/src/test/resources/test-kubeconfig-exec-cert-auth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: v1 | ||
kind: Config | ||
clusters: | ||
- cluster: | ||
server: https://wherever | ||
name: test | ||
contexts: | ||
- context: | ||
cluster: test | ||
user: test | ||
name: test | ||
current-context: test | ||
users: | ||
- name: test | ||
user: | ||
exec: | ||
apiVersion: client.authentication.k8s.io/v1 | ||
args: | ||
- data | ||
command: ./cert-generator | ||
env: | ||
- name: PART1 | ||
value: cert | ||
- name: PART2 | ||
value: key |
20 changes: 20 additions & 0 deletions
20
kubernetes-client-api/src/test/resources/test-kubeconfig-exec-cert-auth-ec-invalid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v1 | ||
kind: Config | ||
clusters: | ||
- cluster: | ||
server: https://wherever | ||
name: test | ||
contexts: | ||
- context: | ||
cluster: test | ||
user: test | ||
name: test | ||
current-context: test | ||
users: | ||
- name: test | ||
user: | ||
exec: | ||
apiVersion: client.authentication.k8s.io/v1 | ||
args: null | ||
command: ./cert-generator | ||
env: null |
25 changes: 25 additions & 0 deletions
25
kubernetes-client-api/src/test/resources/test-kubeconfig-exec-win-cert-auth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: v1 | ||
kind: Config | ||
clusters: | ||
- cluster: | ||
server: https://wherever | ||
name: test | ||
contexts: | ||
- context: | ||
cluster: test | ||
user: test | ||
name: test | ||
current-context: test | ||
users: | ||
- name: test | ||
user: | ||
exec: | ||
apiVersion: client.authentication.k8s.io/v1 | ||
args: | ||
- data | ||
command: ".\\cert-generator-win.bat" | ||
env: | ||
- name: PART1 | ||
value: cert | ||
- name: PART2 | ||
value: key |
20 changes: 20 additions & 0 deletions
20
kubernetes-client-api/src/test/resources/test-kubeconfig-exec-win-cert-auth-ec-invalid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v1 | ||
kind: Config | ||
clusters: | ||
- cluster: | ||
server: https://wherever | ||
name: test | ||
contexts: | ||
- context: | ||
cluster: test | ||
user: test | ||
name: test | ||
current-context: test | ||
users: | ||
- name: test | ||
user: | ||
exec: | ||
apiVersion: client.authentication.k8s.io/v1 | ||
args: null | ||
command: ".\\cert-generator-win.bat" | ||
env: null |