Skip to content

Commit

Permalink
fix(config-api): asset upload config and saml document store changes (#…
Browse files Browse the repository at this point in the history
…10734)

* feat(config-api): testng framework changes

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework - wip

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework wip

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework wip

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework wip

Signed-off-by: pujavs <[email protected]>

* feat(config-api): sync with main

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api) testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api) testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api) testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api) testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api) testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api) testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api) testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api) testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api) testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api) testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api) testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framwork

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framwork

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framwork

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framwork

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framwork

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framwork

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framework

Signed-off-by: pujavs <[email protected]>

* feat(config-api): testng framwork

Signed-off-by: pujavs <[email protected]>

---------

Signed-off-by: pujavs <[email protected]>
  • Loading branch information
pujavs authored Jan 24, 2025
1 parent 2c0cc62 commit 8e9d43e
Show file tree
Hide file tree
Showing 263 changed files with 4,311 additions and 2,816 deletions.
6 changes: 0 additions & 6 deletions jans-config-api/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
<systemProperties>
<karate.options>--tags ~@ignore</karate.options>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
24 changes: 13 additions & 11 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9335,22 +9335,22 @@ components:
$ref: '#/components/schemas/AttributeValidation'
tooltip:
type: string
selected:
whitePagesCanView:
type: boolean
userCanAccess:
type: boolean
adminCanAccess:
type: boolean
whitePagesCanView:
type: boolean
adminCanView:
type: boolean
userCanEdit:
type: boolean
adminCanEdit:
type: boolean
userCanEdit:
type: boolean
userCanView:
type: boolean
selected:
type: boolean
baseDn:
type: string
PatchRequest:
Expand Down Expand Up @@ -10351,8 +10351,10 @@ components:
type: string
finishedFlowPage:
type: string
bridgeScriptPage:
type: string
startEndUrlMapping:
type: object
additionalProperties:
type: string
serializeRules:
type: object
additionalProperties:
Expand Down Expand Up @@ -10988,10 +10990,10 @@ components:
type: array
items:
type: object
value:
type: object
displayValue:
type: string
value:
type: object
LocalizedString:
type: object
properties:
Expand Down Expand Up @@ -11331,14 +11333,14 @@ components:
type: boolean
internal:
type: boolean
locationPath:
type: string
locationType:
type: string
enum:
- ldap
- db
- file
locationPath:
type: string
baseDn:
type: string
ScriptError:
Expand Down
74 changes: 19 additions & 55 deletions jans-config-api/plugins/admin-ui-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,42 +31,18 @@
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>

<!-- Testing -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-apache</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<!-- API, java.xml.bind module -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
Expand All @@ -90,15 +66,19 @@

<build>
<finalName>admin-ui-plugin</finalName>

<filters>
<filter>../../profiles/${cfg}/config-build.properties</filter>
<filter>../../profiles/${cfg}/config-api-test.properties</filter>
</filters>

<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
<includes>
<include>*.*</include>
</includes>
</testResource>
</testResources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -118,29 +98,13 @@
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
</systemPropertyVariables>
<excludedGroups>integration</excludedGroups>
<systemProperties>
<karate.options>--tags ~@ignore</karate.options>
</systemProperties>
</configuration>
<executions>
<execution>
<id>integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<failIfNoTests>false</failIfNoTests>
<excludedGroups>!integration</excludedGroups>
<groups>integration</groups>
</configuration>
</execution>
</executions>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>target/test-classes/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class AuditLoggerResource {

@Inject
Logger log;

@POST
@Path(AUDIT)
@ProtectedApi(scopes = {AUDIT_LOGGING_WRITE_SCOPE})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
*
* Copyright (c) 2020, Janssen Project
*/

package io.jans.ca.plugin.adminui;

import io.jans.configapi.core.test.BaseTest;

import java.io.UnsupportedEncodingException;
import java.util.Map;
import java.util.HashMap;
import jakarta.ws.rs.core.Response;

import org.apache.http.entity.ContentType;
import org.testng.SkipException;
import org.testng.annotations.BeforeMethod;

public class AdminUIBaseTest extends BaseTest {

// Execute before each test is run
@BeforeMethod
protected void before() {
boolean isAvailable = isEndpointAvailable(propertiesMap.get("auditLoggingURL"), accessToken);
log.error("\n\n\n *********************** ADMIN-UI Plugin isAvailable:{} {}", isAvailable, "\n\n\n");
// check condition, note once you condition is met the rest of the tests will be

// skipped as well
if (!isAvailable) {
throw new SkipException("ADMIN-UI Plugin Not deployed");
} else {
log.info("\n\n\n *** ADMIN-UI Plugin is Deployed {}", "\n\n");
}
}

public void authorize() {
log.info("AdminUI - getAccessToken - propertiesMap:{}", propertiesMap);

String authzurl = propertiesMap.get("test.authzurl");
String strGrantType = propertiesMap.get("test.grant.type");
String clientId = propertiesMap.get("test.client.id");
String clientSecret = propertiesMap.get("test.client.secret");
String scopes = propertiesMap.get("test.scopes");
String responseType = propertiesMap.get("test.response.type");
String redirectUri = propertiesMap.get("test.redirect.uri");
log.info(
"\n\n\n\n ************ AdminUI- authzurl:{}, strGrantType:{}, clientId:{}, clientSecret:{}, scopes:{}, responseType:{}, propertiesMap.get(auditLoggingURL)",
authzurl, strGrantType, clientId, clientSecret, scopes, responseType,
propertiesMap.get("auditLoggingURL"));
Map<String, String> params = new HashMap<>();
params.put("client_id", clientId);
params.put("scope", scopes);
params.put("grant_type", strGrantType);
params.put("response_type", responseType);
params.put("redirect_uri", redirectUri);
Response response = authorize(authzurl, clientId, clientSecret, null, getAuthCode(clientId, clientSecret),
params, null);
log.info("\n\n\n\n AdminUI- response:{} :{}", response, "**********");
}

private String getAuthCode(final String clientId, final String clientSecret) {
String code = null;
try {
code = getCredentials(clientId, clientSecret);
} catch (UnsupportedEncodingException ex) {
log.error("Error while encoding credentials is ", ex);
}
return code;
}

private Response authorize(final String authzurl, final Map<String, String> parameters,
ContentType contentType) {
return executePost(authzurl, clientId, clientSecret, authType, authCode, parameters, contentType);
}

}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
*
* Copyright (c) 2020, Janssen Project
*/

package io.jans.ca.plugin.adminui.test;

import io.jans.ca.plugin.adminui.AdminUIBaseTest;

import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.client.Invocation.Builder;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;

import jakarta.ws.rs.core.Response.Status;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;

import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

public class AuditLoggingResourceTest extends AdminUIBaseTest {

/**
* Testing Audit Logging endpoint
*/
@Parameters({ "test.issuer", "auditLoggingURL", "audit_post_1" })
@Test
public void postAuditLoggingData(final String issuer, final String auditLoggingURL, final String json) {
log.info("\n\n postAuditLoggingData() - accessToken:{}, issuer:{}, auditLoggingURL:{}, json:{}", accessToken,
issuer, auditLoggingURL, json);

Builder request = getResteasyService().getClientBuilder(issuer + auditLoggingURL);
request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken);
request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON);

Response response = request.post(Entity.entity(json, MediaType.APPLICATION_JSON));
assertEquals(response.getStatus(), Status.OK.getStatusCode());
log.info("\n\n Response for postAuditLoggingData - response:{}, response.getStatus():{}", response,
response.getStatus());

}

}
Loading

0 comments on commit 8e9d43e

Please sign in to comment.