Skip to content

Commit

Permalink
feat(email connector): first checkpoint on email connector 6
Browse files Browse the repository at this point in the history
  • Loading branch information
mathias-vandaele committed Aug 26, 2024
1 parent 1e6bf0a commit 857d2d3
Show file tree
Hide file tree
Showing 25 changed files with 941 additions and 314 deletions.
220 changes: 142 additions & 78 deletions connectors/email/element-templates/email-outbound-connector.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ public class EmailConnectorFunction implements OutboundConnectorFunction {
@Override
public Object execute(OutboundConnectorContext context) {
EmailRequest emailRequest = context.bindVariables(EmailRequest.class);
return JakartaExecutor.execute(emailRequest);
return JakartaExecutor.create().execute(emailRequest);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,28 @@
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.camunda.connector.generator.java.annotation.TemplateDiscriminatorProperty;
import java.util.Optional;

@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
property = "type",
defaultImpl = OauthAuthentication.class)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", defaultImpl = NoAuthentication.class)
@JsonSubTypes({
@JsonSubTypes.Type(value = SimpleAuthentication.class, name = "simple"),
@JsonSubTypes.Type(value = OauthAuthentication.class, name = "oauth"),
@JsonSubTypes.Type(value = NoAuthentication.class, name = "oauth"),
})
@TemplateDiscriminatorProperty(
label = "Authentication",
group = "authentication",
name = "type",
defaultValue = "oauth",
defaultValue = "simple",
description = "")
public sealed interface Authentication permits OauthAuthentication, SimpleAuthentication {
public sealed interface Authentication permits NoAuthentication, SimpleAuthentication {

String getSender();

String getSecret();
Optional<String> getUser();

Optional<String> getSecret();

default boolean isSecuredAuth() {
return getUser().isPresent() && getSecret().isPresent();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,37 @@
import io.camunda.connector.generator.java.annotation.TemplateProperty;
import io.camunda.connector.generator.java.annotation.TemplateSubType;
import jakarta.validation.constraints.NotBlank;
import java.util.Optional;

@TemplateSubType(id = "oauth", label = "Oauth")
public final class OauthAuthentication implements Authentication {
@TemplateSubType(id = "none", label = "No authentication")
public final class NoAuthentication implements Authentication {
@TemplateProperty(
group = "authentication",
label = "Email address",
description = "Provide email")
@NotBlank
private String mailOauth2;

@TemplateProperty(group = "authentication", label = "Oauth2 token", description = "Give token")
@NotBlank
private String tokenOauth2;
private String noAuthenticationMail;

public @NotBlank String getMailOauth2() {
return mailOauth2;
}

public void setMailOauth2(@NotBlank String mailOauth2) {
this.mailOauth2 = mailOauth2;
return noAuthenticationMail;
}

public @NotBlank String getTokenOauth2() {
return tokenOauth2;
public void setMailOauth2(@NotBlank String noAuthenticationMail) {
this.noAuthenticationMail = noAuthenticationMail;
}

public void setTokenOauth2(@NotBlank String tokenOauth2) {
this.tokenOauth2 = tokenOauth2;
@Override
public String getSender() {
return this.noAuthenticationMail;
}

@Override
public String getSender() {
return this.mailOauth2;
public Optional<String> getUser() {
return Optional.empty();
}

@Override
public String getSecret() {
return this.tokenOauth2;
public Optional<String> getSecret() {
return Optional.empty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.camunda.connector.generator.java.annotation.TemplateProperty;
import io.camunda.connector.generator.java.annotation.TemplateSubType;
import jakarta.validation.constraints.NotBlank;
import java.util.Optional;

@TemplateSubType(id = "simple", label = "Simple")
public final class SimpleAuthentication implements Authentication {
Expand All @@ -17,38 +18,43 @@ public final class SimpleAuthentication implements Authentication {
label = "Email address",
description = "Provide email")
@NotBlank
private String mail;
private String simpleAuthenticationMail;

@TemplateProperty(
group = "authentication",
label = "Email password",
description = "Provide password")
@NotBlank
private String password;
private String simpleAuthenticationPassword;

public @NotBlank String getMail() {
return mail;
public @NotBlank String getSimpleAuthenticationMail() {
return simpleAuthenticationMail;
}

public void setMail(@NotBlank String mail) {
this.mail = mail;
public void setSimpleAuthenticationMail(@NotBlank String simpleAuthenticationMail) {
this.simpleAuthenticationMail = simpleAuthenticationMail;
}

public @NotBlank String getPassword() {
return password;
public @NotBlank String getSimpleAuthenticationPassword() {
return simpleAuthenticationPassword;
}

public void setPassword(@NotBlank String password) {
this.password = password;
public void setSimpleAuthenticationPassword(@NotBlank String simpleAuthenticationPassword) {
this.simpleAuthenticationPassword = simpleAuthenticationPassword;
}

@Override
public String getSender() {
return this.mail;
return this.simpleAuthenticationMail;
}

@Override
public String getSecret() {
return this.password;
public Optional<String> getUser() {
return Optional.of(this.simpleAuthenticationMail);
}

@Override
public Optional<String> getSecret() {
return Optional.of(this.simpleAuthenticationPassword);
}
}
Loading

0 comments on commit 857d2d3

Please sign in to comment.