drop support for deprecated App-ID auth backend (#61) (#78)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
App-ID is deprecated since Vault 0.6 and was removed in 1.12. Our compatibility methods are deprecated since Connector 0.4. It's time to drop it for good.
This commit is contained in:
@@ -58,7 +58,6 @@ public class HTTPVaultConnector implements VaultConnector {
|
||||
private static final String PATH_ROLES = "/roles";
|
||||
private static final String PATH_CREATE_ORPHAN = "/create-orphan";
|
||||
private static final String PATH_AUTH_USERPASS = PATH_AUTH + "/userpass/login/";
|
||||
private static final String PATH_AUTH_APPID = PATH_AUTH + "/app-id";
|
||||
private static final String PATH_AUTH_APPROLE = PATH_AUTH + "/approle";
|
||||
private static final String PATH_AUTH_APPROLE_ROLE = PATH_AUTH_APPROLE + "/role/%s%s";
|
||||
|
||||
@@ -200,18 +199,6 @@ public class HTTPVaultConnector implements VaultConnector {
|
||||
return queryAuth(PATH_AUTH_USERPASS + username, payload);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated(since = "0.4", forRemoval = true)
|
||||
public final AuthResponse authAppId(final String appID, final String userID) throws VaultConnectorException {
|
||||
return queryAuth(
|
||||
PATH_AUTH_APPID + PATH_LOGIN,
|
||||
Map.of(
|
||||
"app_id", appID,
|
||||
"user_id", userID
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final AuthResponse authAppRole(final String roleID, final String secretID) throws VaultConnectorException {
|
||||
final Map<String, String> payload = mapOfStrings(
|
||||
@@ -241,40 +228,6 @@ public class HTTPVaultConnector implements VaultConnector {
|
||||
return auth;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated(since = "0.4", forRemoval = true)
|
||||
public final boolean registerAppId(final String appID, final String policy, final String displayName)
|
||||
throws VaultConnectorException {
|
||||
requireAuth();
|
||||
|
||||
/* Issue request and expect code 204 with empty response */
|
||||
request.postWithoutResponse(
|
||||
PATH_AUTH_APPID + "/map/app-id/" + appID,
|
||||
Map.of(
|
||||
"value", policy,
|
||||
"display_name", displayName
|
||||
),
|
||||
token
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated(since = "0.4", forRemoval = true)
|
||||
public final boolean registerUserId(final String appID, final String userID) throws VaultConnectorException {
|
||||
requireAuth();
|
||||
|
||||
/* Issue request and expect code 204 with empty response */
|
||||
request.postWithoutResponse(
|
||||
PATH_AUTH_APPID + "/map/user-id/" + userID,
|
||||
singletonMap("value", appID),
|
||||
token
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean createAppRole(final AppRole role) throws VaultConnectorException {
|
||||
requireAuth();
|
||||
|
@@ -112,19 +112,6 @@ public interface VaultConnector extends AutoCloseable, Serializable {
|
||||
*/
|
||||
AuthResponse authUserPass(final String username, final String password) throws VaultConnectorException;
|
||||
|
||||
/**
|
||||
* Authorize to Vault using AppID method.
|
||||
*
|
||||
* @param appID The App ID
|
||||
* @param userID The User ID
|
||||
* @return The {@link AuthResponse}
|
||||
* @throws VaultConnectorException on error
|
||||
* @deprecated As of Vault 0.6.1 App-ID is superseded by AppRole. App-ID was removed in Vault 1.12.
|
||||
* Consider using {@link #authAppRole} instead.
|
||||
*/
|
||||
@Deprecated(since = "0.4", forRemoval = true)
|
||||
AuthResponse authAppId(final String appID, final String userID) throws VaultConnectorException;
|
||||
|
||||
/**
|
||||
* Authorize to Vault using AppRole method without secret ID.
|
||||
*
|
||||
@@ -148,21 +135,6 @@ public interface VaultConnector extends AutoCloseable, Serializable {
|
||||
*/
|
||||
AuthResponse authAppRole(final String roleID, final String secretID) throws VaultConnectorException;
|
||||
|
||||
/**
|
||||
* Register new App-ID with policy.
|
||||
*
|
||||
* @param appID The unique App-ID
|
||||
* @param policy The policy to associate with
|
||||
* @param displayName Arbitrary name to display
|
||||
* @return {@code true} on success
|
||||
* @throws VaultConnectorException on error
|
||||
* @deprecated As of Vault 0.6.1 App-ID is superseded by AppRole. App-ID was removed in Vault 1.12.
|
||||
* Consider using {@link #createAppRole} instead.
|
||||
*/
|
||||
@Deprecated(since = "0.4", forRemoval = true)
|
||||
boolean registerAppId(final String appID, final String policy, final String displayName)
|
||||
throws VaultConnectorException;
|
||||
|
||||
/**
|
||||
* Register a new AppRole role from given metamodel.
|
||||
*
|
||||
@@ -344,38 +316,6 @@ public interface VaultConnector extends AutoCloseable, Serializable {
|
||||
*/
|
||||
List<String> listAppRoleSecrets(final String roleName) throws VaultConnectorException;
|
||||
|
||||
/**
|
||||
* Register User-ID with App-ID.
|
||||
*
|
||||
* @param appID The App-ID
|
||||
* @param userID The User-ID
|
||||
* @return {@code true} on success
|
||||
* @throws VaultConnectorException on error
|
||||
* @deprecated As of Vault 0.6.1 App-ID is superseded by AppRole. App-ID was removed in Vault 1.12.
|
||||
* Consider using {@link #createAppRoleSecret} instead.
|
||||
*/
|
||||
@Deprecated(since = "0.4", forRemoval = true)
|
||||
boolean registerUserId(final String appID, final String userID) throws VaultConnectorException;
|
||||
|
||||
/**
|
||||
* Register new App-ID and User-ID at once.
|
||||
*
|
||||
* @param appID The App-ID
|
||||
* @param policy The policy to associate with
|
||||
* @param displayName Arbitrary name to display
|
||||
* @param userID The User-ID
|
||||
* @return {@code true} on success
|
||||
* @throws VaultConnectorException on error
|
||||
* @deprecated As of Vault 0.6.1 App-ID is superseded by AppRole. App-ID was removed in Vault 1.12.
|
||||
*/
|
||||
@Deprecated(since = "0.4", forRemoval = true)
|
||||
default boolean registerAppUserId(final String appID,
|
||||
final String policy,
|
||||
final String displayName,
|
||||
final String userID) throws VaultConnectorException {
|
||||
return registerAppId(appID, policy, userID) && registerUserId(appID, userID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get authorization status.
|
||||
*
|
||||
|
@@ -24,8 +24,6 @@ package de.stklcode.jvault.connector.model;
|
||||
*/
|
||||
public enum AuthBackend {
|
||||
TOKEN("token"),
|
||||
@Deprecated(since = "1.1.3", forRemoval = true)
|
||||
APPID("app-id"),
|
||||
APPROLE("approle"),
|
||||
USERPASS("userpass"),
|
||||
GITHUB("github"), // Not supported yet.
|
||||
|
Reference in New Issue
Block a user