Skip to content

Commit

Permalink
Merge pull request #35 from nicholasM95/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
nicholasM95 authored Oct 6, 2024
2 parents 36725f4 + 6cede0a commit aad8e7a
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 31 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Set up JDK
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'liberica'
cache: 'maven'

- name: Setup Node.js environment
uses: actions/setup-node@v4.0.3
uses: actions/setup-node@v4.0.4
with:
node-version: 20

Expand Down
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.1
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.8/apache-maven-3.9.8-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Add the Maven Dependency to your `pom.xml`
<dependency>
<groupId>be.nicholasmeyers.vwgroup-connector</groupId>
<artifactId>vwgroup-connector</artifactId>
<version>1.2.0</version>
<version>1.2.2</version>
</dependency>
```

Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

<groupId>be.nicholasmeyers.vwgroup-connector</groupId>
<artifactId>vwgroup-connector</artifactId>
<version>1.2.1</version>
<version>1.2.2-SNAPSHOT</version>

<name>vwgroup-connector</name>
<description>vwgroup-connector</description>

<properties>
<java.version>21</java.version>
<feign.version>13.3</feign.version>
<feign.version>13.4</feign.version>
<jose4j.version>0.9.6</jose4j.version>
</properties>

Expand Down Expand Up @@ -74,7 +74,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.3</version>
<version>5.11.2</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -106,7 +106,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.8.0</version>
<version>3.10.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -119,7 +119,7 @@
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.5.0</version>
<version>0.6.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static be.nicholasmeyers.vwgroupconnector.util.UserUtils.getEmail;
import static be.nicholasmeyers.vwgroupconnector.util.UserUtils.getPassword;

public class ConnectorServiceTest {

private ConnectorService connectorService;
Expand All @@ -17,28 +20,28 @@ public void setup() {

@Test
public void testConnect() {
Tokens tokens = connectorService.getTokens(Client.CONNECT, "", "");
Tokens tokens = connectorService.getTokens(Client.CONNECT, getEmail(), getPassword());
Assertions.assertNotNull(tokens.getAccessToken());
Assertions.assertNotNull(tokens.getIdToken());
}

@Test
public void testSkoda() {
Tokens tokens = connectorService.getTokens(Client.SKODA, "", "");
Tokens tokens = connectorService.getTokens(Client.SKODA, getEmail(), getPassword());
Assertions.assertNotNull(tokens.getAccessToken());
Assertions.assertNotNull(tokens.getIdToken());
}

@Test
public void testSmartlink() {
Tokens tokens = connectorService.getTokens(Client.SMARTLINK, "", "");
Tokens tokens = connectorService.getTokens(Client.SMARTLINK, getEmail(), getPassword());
Assertions.assertNotNull(tokens.getAccessToken());
Assertions.assertNotNull(tokens.getIdToken());
}

@Test
public void testVWG() {
Tokens tokens = connectorService.getTokens(Client.VWG, "", "");
Tokens tokens = connectorService.getTokens(Client.VWG, getEmail(), getPassword());
Assertions.assertNotNull(tokens.getAccessToken());
Assertions.assertNotNull(tokens.getIdToken());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package be.nicholasmeyers.vwgroupconnector.util;

public class UserUtils {
private UserUtils() {
}

public static String getEmail() {
return System.getProperty("VWGROUP_USERNAME");
}

public static String getPassword() {
return System.getProperty("VWGROUP_PASSWORD");
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
package be.nicholasmeyers.vwgroupconnector.web.out;

import be.nicholasmeyers.vwgroupconnector.resource.*;
import be.nicholasmeyers.vwgroupconnector.resource.AuthorizationInfo;
import be.nicholasmeyers.vwgroupconnector.resource.ConsentInfo;
import be.nicholasmeyers.vwgroupconnector.resource.FinalAuthorizationInfo;
import be.nicholasmeyers.vwgroupconnector.resource.SsoLogin;
import be.nicholasmeyers.vwgroupconnector.resource.StartAuthorization;
import be.nicholasmeyers.vwgroupconnector.resource.SuccessInfo;
import be.nicholasmeyers.vwgroupconnector.resource.TokenInfo;

import static be.nicholasmeyers.vwgroupconnector.util.UserUtils.getEmail;
import static be.nicholasmeyers.vwgroupconnector.util.UserUtils.getPassword;

public class IdentityClientHelper {

private static final String CLIENT = "7f045eee-7003-4379-9968-9355ed2adb06@apps_vw-dilab_com";
private static final String EMAIL = "";
private static final String PASSWORD = "";
private final IdentityClientImpl identityClient;

public IdentityClientHelper(IdentityClientImpl identityClient) {
Expand All @@ -25,15 +32,15 @@ public AuthorizationInfo getAuthorizationInfo(StartAuthorization startAuthorizat
}

public void postEmail(StartAuthorization startAuthorization, AuthorizationInfo authorizationInfo) {
identityClient.postEmail(CLIENT, startAuthorization, authorizationInfo, EMAIL);
identityClient.postEmail(CLIENT, startAuthorization, authorizationInfo, getEmail());
}

public FinalAuthorizationInfo getFinalAuthorizationInfo(StartAuthorization startAuthorization, AuthorizationInfo authorizationInfo) {
return identityClient.getFinalAuthorizationInfo(CLIENT, startAuthorization, authorizationInfo);
}

public SsoLogin postEmailPassword(StartAuthorization startAuthorization, AuthorizationInfo authorizationInfo, FinalAuthorizationInfo finalAuthorizationInfo) {
return identityClient.postEmailPassword(CLIENT, startAuthorization, authorizationInfo, finalAuthorizationInfo, EMAIL, PASSWORD);
return identityClient.postEmailPassword(CLIENT, startAuthorization, authorizationInfo, finalAuthorizationInfo, getEmail(), getPassword());
}

public ConsentInfo ssoLogin(StartAuthorization startAuthorization, AuthorizationInfo authorizationInfo, SsoLogin ssoLogin) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
package be.nicholasmeyers.vwgroupconnector.web.out;

import be.nicholasmeyers.vwgroupconnector.resource.*;
import be.nicholasmeyers.vwgroupconnector.resource.AuthorizationInfo;
import be.nicholasmeyers.vwgroupconnector.resource.ConsentInfo;
import be.nicholasmeyers.vwgroupconnector.resource.FinalAuthorizationInfo;
import be.nicholasmeyers.vwgroupconnector.resource.OpenidConfiguration;
import be.nicholasmeyers.vwgroupconnector.resource.SsoLogin;
import be.nicholasmeyers.vwgroupconnector.resource.StartAuthorization;
import be.nicholasmeyers.vwgroupconnector.resource.SuccessInfo;
import be.nicholasmeyers.vwgroupconnector.resource.TokenInfo;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static be.nicholasmeyers.vwgroupconnector.util.UserUtils.getEmail;

public class IdentityClientImplTest {
private static final String CLIENT = "7f045eee-7003-4379-9968-9355ed2adb06@apps_vw-dilab_com";
private IdentityClientImpl identityClient;
Expand Down Expand Up @@ -41,14 +50,14 @@ public void getAuthorizationInfo() {
@Test
public void postEmail() {
StartAuthorization startAuthorization = identityClientHelper.getStartAuthorization();
identityClient.postEmail(CLIENT, startAuthorization, identityClientHelper.getAuthorizationInfo(startAuthorization), "");
identityClient.postEmail(CLIENT, startAuthorization, identityClientHelper.getAuthorizationInfo(startAuthorization), getEmail());
}

@Test
public void getFinalAuthorizationInfo() {
StartAuthorization startAuthorization = identityClientHelper.getStartAuthorization();
AuthorizationInfo authorizationInfo = identityClientHelper.getAuthorizationInfo(startAuthorization);
identityClient.postEmail(CLIENT, startAuthorization, authorizationInfo, "");
identityClient.postEmail(CLIENT, startAuthorization, authorizationInfo, getEmail());

FinalAuthorizationInfo finalAuthorizationInfo = identityClientHelper.getFinalAuthorizationInfo(startAuthorization, authorizationInfo);
Assertions.assertNotNull(finalAuthorizationInfo.getHmac());
Expand All @@ -59,7 +68,7 @@ public void getFinalAuthorizationInfo() {
public void postEmailPassword() {
StartAuthorization startAuthorization = identityClientHelper.getStartAuthorization();
AuthorizationInfo authorizationInfo = identityClientHelper.getAuthorizationInfo(startAuthorization);
identityClient.postEmail(CLIENT, startAuthorization, authorizationInfo, "");
identityClient.postEmail(CLIENT, startAuthorization, authorizationInfo, getEmail());

FinalAuthorizationInfo finalAuthorizationInfo = identityClientHelper.getFinalAuthorizationInfo(startAuthorization, authorizationInfo);

Expand All @@ -72,7 +81,7 @@ public void postEmailPassword() {
public void ssoLogin() {
StartAuthorization startAuthorization = identityClientHelper.getStartAuthorization();
AuthorizationInfo authorizationInfo = identityClientHelper.getAuthorizationInfo(startAuthorization);
identityClient.postEmail(CLIENT, startAuthorization, authorizationInfo, "");
identityClient.postEmail(CLIENT, startAuthorization, authorizationInfo, getEmail());

FinalAuthorizationInfo finalAuthorizationInfo = identityClientHelper.getFinalAuthorizationInfo(startAuthorization, authorizationInfo);

Expand All @@ -85,7 +94,7 @@ public void ssoLogin() {
public void checkConsent() {
StartAuthorization startAuthorization = identityClientHelper.getStartAuthorization();
AuthorizationInfo authorizationInfo = identityClientHelper.getAuthorizationInfo(startAuthorization);
identityClient.postEmail(CLIENT, startAuthorization, authorizationInfo, "");
identityClient.postEmail(CLIENT, startAuthorization, authorizationInfo, getEmail());

FinalAuthorizationInfo finalAuthorizationInfo = identityClientHelper.getFinalAuthorizationInfo(startAuthorization, authorizationInfo);

Expand All @@ -99,7 +108,7 @@ public void checkConsent() {
public void handleSuccess() {
StartAuthorization startAuthorization = identityClientHelper.getStartAuthorization();
AuthorizationInfo authorizationInfo = identityClientHelper.getAuthorizationInfo(startAuthorization);
identityClient.postEmail(CLIENT, startAuthorization, authorizationInfo, "");
identityClient.postEmail(CLIENT, startAuthorization, authorizationInfo, getEmail());

FinalAuthorizationInfo finalAuthorizationInfo = identityClientHelper.getFinalAuthorizationInfo(startAuthorization, authorizationInfo);

Expand All @@ -111,6 +120,4 @@ public void handleSuccess() {
Assertions.assertNotNull(tokenInfo.getAuthCode());
Assertions.assertNotNull(tokenInfo.getIdToken());
}


}
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
package be.nicholasmeyers.vwgroupconnector.web.out;

import be.nicholasmeyers.vwgroupconnector.resource.*;
import be.nicholasmeyers.vwgroupconnector.resource.AuthorizationInfo;
import be.nicholasmeyers.vwgroupconnector.resource.ConsentInfo;
import be.nicholasmeyers.vwgroupconnector.resource.FinalAuthorizationInfo;
import be.nicholasmeyers.vwgroupconnector.resource.SsoLogin;
import be.nicholasmeyers.vwgroupconnector.resource.StartAuthorization;
import be.nicholasmeyers.vwgroupconnector.resource.SuccessInfo;
import be.nicholasmeyers.vwgroupconnector.resource.TokenInfo;
import be.nicholasmeyers.vwgroupconnector.resource.Tokens;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
package be.nicholasmeyers.vwgroupconnector.web.out;

import be.nicholasmeyers.vwgroupconnector.resource.*;
import be.nicholasmeyers.vwgroupconnector.resource.AuthorizationInfo;
import be.nicholasmeyers.vwgroupconnector.resource.ConsentInfo;
import be.nicholasmeyers.vwgroupconnector.resource.FinalAuthorizationInfo;
import be.nicholasmeyers.vwgroupconnector.resource.SsoLogin;
import be.nicholasmeyers.vwgroupconnector.resource.StartAuthorization;
import be.nicholasmeyers.vwgroupconnector.resource.SuccessInfo;
import be.nicholasmeyers.vwgroupconnector.resource.TokenInfo;
import be.nicholasmeyers.vwgroupconnector.resource.Tokens;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -24,7 +31,6 @@ public void getAccessToken() {
Assertions.assertNotNull(accessToken);
}


private TokenInfo getTokenInfo() {
StartAuthorization startAuthorization = identityClientHelper.getStartAuthorization();
AuthorizationInfo authorizationInfo = identityClientHelper.getAuthorizationInfo(startAuthorization);
Expand Down

0 comments on commit aad8e7a

Please sign in to comment.