forked from fabric8io/kubernetes-client
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix (kubernetes-client-api) : Track sources from where OAuthToken get…
…s set (fabric8io#4802) + Add enum OAuthTokenSource in Config which tell us about the source from which Config's OAuthToken was set. + Skip refresh in case current OAuthTokenSource is set to USER (the scenario reported in the linked issue) Signed-off-by: Rohan Kumar <rohaan@redhat.com>
- Loading branch information
1 parent
13d6dfd
commit 8f986a4
Showing
9 changed files
with
437 additions
and
81 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
50 changes: 50 additions & 0 deletions
50
kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/OAuthTokenSource.java
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,50 @@ | ||
/** | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.fabric8.kubernetes.client; | ||
|
||
/** | ||
* Enum to track source of OAuthToken | ||
*/ | ||
public enum OAuthTokenSource { | ||
/** | ||
* OAuthToken that comes from Config's OAuthTokenProvider. If token is coming from this source | ||
* it would not be considered for refresh. | ||
*/ | ||
OAUTHTOKEN_PROVIDER, | ||
/** | ||
* OAuthToken directly provided by user during building initial Config. It would not be considered | ||
* for refresh. It is responsibility of caller to refresh it on its own. | ||
*/ | ||
USER, | ||
/** | ||
* OAuthToken picked up from System properties or environment variables | ||
*/ | ||
SYSTEM_PROPERTIES_OR_ENVIRONMENT_VARIABLES, | ||
/** | ||
* OAuthToken picked up from KubeConfig file | ||
*/ | ||
KUBECONFIG, | ||
/** | ||
* OAuthToken picked from | ||
* <a href="https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins">client-go | ||
* credential plugins</a> | ||
*/ | ||
EXEC_CREDENTIAL_PLUGIN, | ||
/** | ||
* OAuthToken picked from mounted ServiceAccount file inside container | ||
*/ | ||
SERVICEACCOUNT_TOKEN_FILE | ||
} |
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
Oops, something went wrong.