クラス CubbyholeAuthentication
java.lang.ObjectSE
org.springframework.vault.authentication.CubbyholeAuthentication
- 実装済みのインターフェース一覧:
AuthenticationStepsFactory,ClientAuthentication
public class CubbyholeAuthentication
extends ObjectSE
implements ClientAuthentication, AuthenticationStepsFactory
Cubbyhole
ClientAuthentication の実装。Cubbyhole 認証は、Vault プリミティブを使用して、安全な認証ワークフローを提供します。Cubbyhole 認証は、主要なログイン方法として tokens を使用します。短期トークンは、Vault の Cubbyhole シークレットバックエンドから 2 番目のログイン VaultToken を取得するために使用されます。通常、ログイントークンは存続期間が長く、Vault との対話に使用されます。ログイントークンは、ラップされたレスポンスまたは data セクションから取得できます。
ラップされたトークンレスポンスの使用
トークンを作成する
$ vault token-create -wrap-ttl="10m"
Key Value
--- -----
wrapping_token: 397ccb93-ff6c-b17b-9389-380b01ca2645
wrapping_token_ttl: 0h10m0s
wrapping_token_creation_time: 2016-09-18 20:29:48.652957077 +0200 CEST
wrapped_accessor: 46b6aebb-187f-932a-26d7-4f3d86a68319
CubbyholeAuthentication のセットアップ
CubbyholeAuthenticationOptions options = CubbyholeAuthenticationOptions
.builder()
.initialToken(VaultToken.of("397ccb93-ff6c-b17b-9389-380b01ca2645"))
.wrapped()
.build();
CubbyholeAuthentication authentication = new CubbyholeAuthentication(options, restOperations);
保存されたトークンレスポンスの使用
トークンを作成する
$ vault token-create
Key Value
--- -----
token f9e30681-d46a-cdaf-aaa0-2ae0a9ad0819
token_accessor 4eee9bd9-81bb-06d6-af01-723c54a72148
token_duration 0s
token_renewable false
token_policies [root]
$ token-create -use-limit=2 -orphan -no-default-policy -policy=none
Key Value
--- -----
token 895cb88b-aef4-0e33-ba65-d50007290780
token_accessor e84b661c-8aa8-2286-b788-f258f30c8325
token_duration 0s
token_renewable false
token_policies [none]
$ export VAULT_TOKEN=895cb88b-aef4-0e33-ba65-d50007290780
$ vault write cubbyhole/token token=f9e30681-d46a-cdaf-aaa0-2ae0a9ad0819
CubbyholeAuthentication のセットアップ
CubbyholeAuthenticationOptions options = CubbyholeAuthenticationOptions
.builder()
.initialToken(VaultToken.of("895cb88b-aef4-0e33-ba65-d50007290780"))
.path("cubbyhole/token")
.build();
CubbyholeAuthentication authentication = new CubbyholeAuthentication(options, restOperations);
残りの TTL/ 更新可能性 ゼロ以外の TTL に関連付けられた Cubbyhole から取得されたトークンは、トークンの作成時に TTL を開始します。その時間は、アプリケーションの起動と必ずしも一致しません。最初の遅延を補うために、Cubbyhole 認証は、ゼロ以外の TTL に関連付けられたトークンに対して self lookup を実行して、残りの TTL を取得します。Cubbyhole 認証は、TTL なしでラップされたトークンを自己検索しません。これは、ゼロの TTL は、関連付けられている TTL がないことを示すためです。
ラップされていないトークンは、トークンを取得するだけでは、更新可能性と TTL に関する詳細を提供しません。セルフルックアップは、更新可能性と残りの TTL をルックアップします。
コンストラクター概要
コンストラクターコンストラクター説明CubbyholeAuthentication(CubbyholeAuthenticationOptions options, RestOperations restOperations) 方法の概要
修飾子と型メソッド説明static AuthenticationStepsCubbyholeAuthenticationOptionsを指定して、cubbyhole 認証用のAuthenticationStepsを作成します。認証フローを記述するAuthenticationStepsを取得します。login()VaultTokenを返します。
コンストラクターの詳細
CubbyholeAuthentication
public CubbyholeAuthentication(CubbyholeAuthenticationOptions options, RestOperations restOperations) - パラメーター:
options- null であってはなりません。restOperations- null であってはなりません。
メソッドの詳細
createAuthenticationSteps
CubbyholeAuthenticationOptionsを指定して、cubbyhole 認証用のAuthenticationStepsを作成します。- パラメーター:
options- null であってはなりません。- 戻り値:
- カビーホール認証用の
AuthenticationSteps。 - 導入:
- 2.0
login
インターフェースからコピーされた説明:ClientAuthenticationVaultTokenを返します。このメソッドは、必要に応じて Vault にログインしてtokenを取得できます。- 次で指定:
- インターフェース
ClientAuthenticationのlogin - 戻り値:
VaultToken。- 例外:
VaultException
getAuthenticationSteps
インターフェースからコピーされた説明:AuthenticationStepsFactory認証フローを記述するAuthenticationStepsを取得します。- 次で指定:
- インターフェース
AuthenticationStepsFactoryのgetAuthenticationSteps - 戻り値:
- 認証フローを記述する
AuthenticationSteps。