Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions api/src/test/java/io/serverlessworkflow/api/ApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import io.serverlessworkflow.api.types.CallHTTP;
import io.serverlessworkflow.api.types.CallTask;
import io.serverlessworkflow.api.types.HTTPArguments;
import io.serverlessworkflow.api.types.OAuth2AutenthicationData;
import io.serverlessworkflow.api.types.OAuth2AutenthicationData.OAuth2AutenthicationDataGrant;
import io.serverlessworkflow.api.types.OAuth2AuthenticationData;
import io.serverlessworkflow.api.types.OAuth2AuthenticationData.OAuth2AuthenticationDataGrant;
import io.serverlessworkflow.api.types.OAuth2AuthenticationPolicy;
import io.serverlessworkflow.api.types.OAuth2AuthenticationPolicyConfiguration;
import io.serverlessworkflow.api.types.OAuth2AuthenticationPropertiesEndpoints;
Expand Down Expand Up @@ -107,10 +107,10 @@ void testOauth2Auth() throws IOException {
assertThat(endpoints.getToken()).isEqualTo("/auth/token");
assertThat(endpoints.getIntrospection()).isEqualTo("/auth/introspect");

OAuth2AutenthicationData oauth2Data = oauth2Props.getOAuth2AutenthicationData();
OAuth2AuthenticationData oauth2Data = oauth2Props.getOAuth2AuthenticationData();
assertThat(oauth2Data.getAuthority().getLiteralUri())
.isEqualTo(URI.create("http://keycloak/realms/fake-authority"));
assertThat(oauth2Data.getGrant()).isEqualTo(OAuth2AutenthicationDataGrant.CLIENT_CREDENTIALS);
assertThat(oauth2Data.getGrant()).isEqualTo(OAuth2AuthenticationDataGrant.CLIENT_CREDENTIALS);
assertThat(oauth2Data.getClient().getId()).isEqualTo("workflow-runtime-id");
assertThat(oauth2Data.getClient().getSecret()).isEqualTo("workflow-runtime-secret");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public OAuth2AuthenticationPolicyBuilder endpoints(
public OAuth2AuthenticationPolicy build() {
final OAuth2AuthenticationPolicyConfiguration configuration =
new OAuth2AuthenticationPolicyConfiguration();
configuration.setOAuth2AutenthicationData(this.getAuthenticationData());
configuration.setOAuth2AuthenticationData(this.getAuthenticationData());
configuration.setOAuth2ConnectAuthenticationProperties(this.properties);

final Oauth2 oauth2 = new Oauth2();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
package io.serverlessworkflow.fluent.spec;

import io.serverlessworkflow.api.types.AuthenticationPolicy;
import io.serverlessworkflow.api.types.OAuth2AutenthicationData;
import io.serverlessworkflow.api.types.OAuth2AutenthicationDataClient;
import io.serverlessworkflow.api.types.OAuth2AuthenticationData;
import io.serverlessworkflow.api.types.OAuth2AuthenticationDataClient;
import io.serverlessworkflow.api.types.OAuth2AuthenticationPropertiesEndpoints;
import io.serverlessworkflow.api.types.OAuth2TokenDefinition;
import io.serverlessworkflow.api.types.OAuth2TokenRequest;
import java.util.List;
import java.util.function.Consumer;

public abstract class OIDCBuilder<T extends AuthenticationPolicy> {
private final OAuth2AutenthicationData authenticationData;
private final OAuth2AuthenticationData authenticationData;

OIDCBuilder() {
this.authenticationData = new OAuth2AutenthicationData();
this.authenticationData = new OAuth2AuthenticationData();
this.authenticationData.setRequest(new OAuth2TokenRequest());
}

Expand All @@ -37,7 +37,7 @@ public OIDCBuilder<T> authority(String authority) {
return this;
}

public OIDCBuilder<T> grant(OAuth2AutenthicationData.OAuth2AutenthicationDataGrant grant) {
public OIDCBuilder<T> grant(OAuth2AuthenticationData.OAuth2AuthenticationDataGrant grant) {
this.authenticationData.setGrant(grant);
return this;
}
Expand Down Expand Up @@ -100,7 +100,7 @@ public OIDCBuilder<T> client(Consumer<OAuth2AuthenticationDataClientBuilder> cli
return this;
}

protected final OAuth2AutenthicationData getAuthenticationData() {
protected final OAuth2AuthenticationData getAuthenticationData() {
return authenticationData;
}

Expand Down Expand Up @@ -129,10 +129,10 @@ public OAuth2TokenDefinition build() {
}

public static final class OAuth2AuthenticationDataClientBuilder {
private final OAuth2AutenthicationDataClient client;
private final OAuth2AuthenticationDataClient client;

OAuth2AuthenticationDataClientBuilder() {
this.client = new OAuth2AutenthicationDataClient();
this.client = new OAuth2AuthenticationDataClient();
}

public OAuth2AuthenticationDataClientBuilder id(String id) {
Expand All @@ -151,12 +151,12 @@ public OAuth2AuthenticationDataClientBuilder assertion(String assertion) {
}

public OAuth2AuthenticationDataClientBuilder authentication(
OAuth2AutenthicationDataClient.ClientAuthentication authentication) {
OAuth2AuthenticationDataClient.ClientAuthentication authentication) {
this.client.setAuthentication(authentication);
return this;
}

public OAuth2AutenthicationDataClient build() {
public OAuth2AuthenticationDataClient build() {
return this.client;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*/
package io.serverlessworkflow.impl.executors.http.oauth;

import static io.serverlessworkflow.api.types.OAuth2AutenthicationData.OAuth2AutenthicationDataGrant.CLIENT_CREDENTIALS;
import static io.serverlessworkflow.api.types.OAuth2AutenthicationData.OAuth2AutenthicationDataGrant.PASSWORD;
import static io.serverlessworkflow.api.types.OAuth2AuthenticationData.OAuth2AuthenticationDataGrant.CLIENT_CREDENTIALS;
import static io.serverlessworkflow.api.types.OAuth2AuthenticationData.OAuth2AuthenticationDataGrant.PASSWORD;

import io.serverlessworkflow.api.types.OAuth2AutenthicationData;
import io.serverlessworkflow.api.types.OAuth2AuthenticationData;
import io.serverlessworkflow.api.types.Oauth2;
import java.util.Base64;

Expand All @@ -31,8 +31,8 @@ public ClientSecretBasic(Oauth2 oauth2) {
}

public void execute(HttpRequestBuilder requestBuilder) {
OAuth2AutenthicationData authenticationData =
oauth2.getOAuth2ConnectAuthenticationProperties().getOAuth2AutenthicationData();
OAuth2AuthenticationData authenticationData =
oauth2.getOAuth2ConnectAuthenticationProperties().getOAuth2AuthenticationData();
if (authenticationData.getGrant().equals(PASSWORD)) {
password(requestBuilder, authenticationData);
} else if (authenticationData.getGrant().equals(CLIENT_CREDENTIALS)) {
Expand All @@ -44,7 +44,7 @@ public void execute(HttpRequestBuilder requestBuilder) {
}

private void clientCredentials(
HttpRequestBuilder requestBuilder, OAuth2AutenthicationData authenticationData) {
HttpRequestBuilder requestBuilder, OAuth2AuthenticationData authenticationData) {
if (authenticationData.getClient() == null
|| authenticationData.getClient().getId() == null
|| authenticationData.getClient().getSecret() == null) {
Expand All @@ -63,7 +63,7 @@ private void clientCredentials(
}

private void password(
HttpRequestBuilder requestBuilder, OAuth2AutenthicationData authenticationData) {
HttpRequestBuilder requestBuilder, OAuth2AuthenticationData authenticationData) {
if (authenticationData.getUsername() == null || authenticationData.getPassword() == null) {
throw new IllegalArgumentException(
"Username and password must be provided for password grant type");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*/
package io.serverlessworkflow.impl.executors.http.oauth;

import static io.serverlessworkflow.api.types.OAuth2AutenthicationData.OAuth2AutenthicationDataGrant.CLIENT_CREDENTIALS;
import static io.serverlessworkflow.api.types.OAuth2AutenthicationData.OAuth2AutenthicationDataGrant.PASSWORD;
import static io.serverlessworkflow.api.types.OAuth2AuthenticationData.OAuth2AuthenticationDataGrant.CLIENT_CREDENTIALS;
import static io.serverlessworkflow.api.types.OAuth2AuthenticationData.OAuth2AuthenticationDataGrant.PASSWORD;

import io.serverlessworkflow.api.types.OAuth2AutenthicationData;
import io.serverlessworkflow.api.types.OAuth2AuthenticationData;
import io.serverlessworkflow.api.types.Oauth2;

class ClientSecretPostStep {
Expand All @@ -29,8 +29,8 @@ public ClientSecretPostStep(Oauth2 oauth2) {
}

public void execute(HttpRequestBuilder requestBuilder) {
OAuth2AutenthicationData authenticationData =
oauth2.getOAuth2ConnectAuthenticationProperties().getOAuth2AutenthicationData();
OAuth2AuthenticationData authenticationData =
oauth2.getOAuth2ConnectAuthenticationProperties().getOAuth2AuthenticationData();

if (authenticationData.getGrant().equals(PASSWORD)) {
password(requestBuilder, authenticationData);
Expand All @@ -43,7 +43,7 @@ public void execute(HttpRequestBuilder requestBuilder) {
}

private void clientCredentials(
HttpRequestBuilder requestBuilder, OAuth2AutenthicationData authenticationData) {
HttpRequestBuilder requestBuilder, OAuth2AuthenticationData authenticationData) {
if (authenticationData.getClient() == null
|| authenticationData.getClient().getId() == null
|| authenticationData.getClient().getSecret() == null) {
Expand All @@ -59,7 +59,7 @@ private void clientCredentials(
}

private void password(
HttpRequestBuilder requestBuilder, OAuth2AutenthicationData authenticationData) {
HttpRequestBuilder requestBuilder, OAuth2AuthenticationData authenticationData) {
if (authenticationData.getUsername() == null || authenticationData.getPassword() == null) {
throw new IllegalArgumentException(
"Username and password must be provided for password grant type");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import static io.serverlessworkflow.api.types.OAuth2TokenRequest.Oauth2TokenRequestEncoding;
import static io.serverlessworkflow.api.types.OAuth2TokenRequest.Oauth2TokenRequestEncoding.APPLICATION_X_WWW_FORM_URLENCODED;

import io.serverlessworkflow.api.types.OAuth2AutenthicationData;
import io.serverlessworkflow.api.types.OAuth2AuthenticationData;
import io.serverlessworkflow.api.types.OAuth2TokenRequest;
import io.serverlessworkflow.impl.TaskContext;
import io.serverlessworkflow.impl.WorkflowApplication;
Expand Down Expand Up @@ -48,7 +48,7 @@ class HttpRequestBuilder {

private URI uri;

private OAuth2AutenthicationData.OAuth2AutenthicationDataGrant grantType;
private OAuth2AuthenticationData.OAuth2AuthenticationDataGrant grantType;

private Oauth2TokenRequestEncoding requestContentType = APPLICATION_X_WWW_FORM_URLENCODED;

Expand Down Expand Up @@ -81,7 +81,7 @@ HttpRequestBuilder withRequestContentType(OAuth2TokenRequest oAuth2TokenRequest)
}

HttpRequestBuilder withGrantType(
OAuth2AutenthicationData.OAuth2AutenthicationDataGrant grantType) {
OAuth2AuthenticationData.OAuth2AuthenticationDataGrant grantType) {
this.grantType = grantType;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*/
package io.serverlessworkflow.impl.executors.http.oauth;

import static io.serverlessworkflow.api.types.OAuth2AutenthicationDataClient.ClientAuthentication.CLIENT_SECRET_POST;
import static io.serverlessworkflow.api.types.OAuth2AuthenticationDataClient.ClientAuthentication.CLIENT_SECRET_POST;

import io.serverlessworkflow.api.types.OAuth2AutenthicationData;
import io.serverlessworkflow.api.types.OAuth2AutenthicationDataClient;
import io.serverlessworkflow.api.types.OAuth2AuthenticationData;
import io.serverlessworkflow.api.types.OAuth2AuthenticationDataClient;
import io.serverlessworkflow.api.types.OAuth2AuthenticationPropertiesEndpoints;
import io.serverlessworkflow.api.types.Oauth2;
import io.serverlessworkflow.impl.TaskContext;
Expand All @@ -36,7 +36,7 @@ public class OAuthRequestBuilder {

private final Oauth2 oauth2;

private final OAuth2AutenthicationData authenticationData;
private final OAuth2AuthenticationData authenticationData;

private final WorkflowApplication application;

Expand All @@ -51,7 +51,7 @@ public class OAuthRequestBuilder {
public OAuthRequestBuilder(WorkflowApplication application, Oauth2 oauth2) {
this.oauth2 = oauth2;
this.authenticationData =
oauth2.getOAuth2ConnectAuthenticationProperties().getOAuth2AutenthicationData();
oauth2.getOAuth2ConnectAuthenticationProperties().getOAuth2AuthenticationData();
this.application = application;
}

Expand Down Expand Up @@ -90,7 +90,7 @@ private void clientSecretPost(HttpRequestBuilder requestBuilder) {
new ClientSecretPostStep(oauth2).execute(requestBuilder);
}

private OAuth2AutenthicationDataClient.ClientAuthentication getClientAuthentication() {
private OAuth2AuthenticationDataClient.ClientAuthentication getClientAuthentication() {
if (authenticationData.getClient() == null
|| authenticationData.getClient().getAuthentication() == null) {
return CLIENT_SECRET_POST;
Expand All @@ -102,7 +102,7 @@ private void issuers() {
issuers =
oauth2
.getOAuth2ConnectAuthenticationProperties()
.getOAuth2AutenthicationData()
.getOAuth2AuthenticationData()
.getIssuers();
}

Expand Down Expand Up @@ -142,7 +142,7 @@ private void authenticationURI(HttpRequestBuilder requestBuilder) {
String baseUri =
oauth2
.getOAuth2ConnectAuthenticationProperties()
.getOAuth2AutenthicationData()
.getOAuth2AuthenticationData()
.getAuthority()
.getLiteralUri()
.toString()
Expand Down
20 changes: 10 additions & 10 deletions types/src/main/resources/schema/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1055,21 +1055,21 @@ $defs:
required: [ oidc ]
oauth2AuthenticationProperties:
type: object
title: OAuth2AutenthicationData
title: OAuth2AuthenticationData
description: Inline configuration of the OAuth2 authentication policy.
properties:
authority:
$ref: '#/$defs/uriTemplate'
title: OAuth2AutenthicationDataAuthority
title: OAuth2AuthenticationDataAuthority
description: The URI that references the OAuth2 authority to use.
grant:
type: string
enum: [ authorization_code, client_credentials, password, refresh_token, 'urn:ietf:params:oauth:grant-type:token-exchange']
title: OAuth2AutenthicationDataGrant
title: OAuth2AuthenticationDataGrant
description: The grant type to use.
client:
type: object
title: OAuth2AutenthicationDataClient
title: OAuth2AuthenticationDataClient
description: The definition of an OAuth2 client.
unevaluatedProperties: false
properties:
Expand Down Expand Up @@ -1109,31 +1109,31 @@ $defs:
type: string
scopes:
type: array
title: OAuth2AutenthicationDataScopes
title: OAuth2AuthenticationDataScopes
description: The scopes, if any, to request the token for.
items:
type: string
audiences:
type: array
title: OAuth2AutenthicationDataAudiences
title: OAuth2AuthenticationDataAudiences
description: The audiences, if any, to request the token for.
items:
type: string
username:
type: string
title: OAuth2AutenthicationDataUsername
title: OAuth2AuthenticationDataUsername
description: The username to use. Used only if the grant type is Password.
password:
type: string
title: OAuth2AutenthicationDataPassword
title: OAuth2AuthenticationDataPassword
description: The password to use. Used only if the grant type is Password.
subject:
$ref: '#/$defs/oauth2Token'
title: OAuth2AutenthicationDataSubject
title: OAuth2AuthenticationDataSubject
description: The security token that represents the identity of the party on behalf of whom the request is being made.
actor:
$ref: '#/$defs/oauth2Token'
title: OAuth2AutenthicationDataActor
title: OAuth2AuthenticationDataActor
description: The security token that represents the identity of the acting party.
oauth2Token:
type: object
Expand Down