Skip to content

Commit

Permalink
Merge branch 'version_4.3.0' of https://github.com/GluuFederation/oxT…
Browse files Browse the repository at this point in the history
…rust into version_4.3.0
  • Loading branch information
syntrydy committed Sep 23, 2021
2 parents cd18d4a + 6becbb1 commit 4532b38
Show file tree
Hide file tree
Showing 37 changed files with 638 additions and 579 deletions.
2 changes: 1 addition & 1 deletion api-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.gluu</groupId>
<artifactId>oxtrust</artifactId>
<version>4.3.0-SNAPSHOT</version>
<version>4.3.0.Final</version>
</parent>
<artifactId>oxtrust-api-server</artifactId>
<name>API Server</name>
Expand Down
2 changes: 1 addition & 1 deletion cas-openid-auth-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>org.gluu</groupId>
<artifactId>oxtrust</artifactId>
<version>4.3.0-SNAPSHOT</version>
<version>4.3.0.Final</version>
</parent>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Library usage:
Integration test application usage:

1. Edit client/conf/configuration.properties with your oxTrust server parameters.
2. Run java -cp target/oxtrust-client-4.2.0-SNAPSHOT.jar org.gluu.oxtrust.api.test.TestMain
2. Run java -cp target/oxtrust-client-4.3.0.Final.jar org.gluu.oxtrust.api.test.TestMain

Embedding to automatic tests:

Expand Down
2 changes: 1 addition & 1 deletion client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>org.gluu</groupId>
<artifactId>oxtrust</artifactId>
<version>4.3.0-SNAPSHOT</version>
<version>4.3.0.Final</version>
</parent>
<build>
<plugins>
Expand Down
2 changes: 1 addition & 1 deletion configuration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>org.gluu</groupId>
<artifactId>oxtrust</artifactId>
<version>4.3.0-SNAPSHOT</version>
<version>4.3.0.Final</version>
</parent>

<prerequisites>
Expand Down
2 changes: 1 addition & 1 deletion model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>org.gluu</groupId>
<artifactId>oxtrust</artifactId>
<version>4.3.0-SNAPSHOT</version>
<version>4.3.0.Final</version>
</parent>

<prerequisites>
Expand Down
2 changes: 1 addition & 1 deletion openid-auth-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>org.gluu</groupId>
<artifactId>oxtrust</artifactId>
<version>4.3.0-SNAPSHOT</version>
<version>4.3.0.Final</version>
</parent>

<prerequisites>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,10 @@ protected CommonProfile retrieveUserProfileFromUserInfoResponse(final WebContext
}
profile.setId(id);

String acrResponse = (String) jwt.getClaims().getClaim(JwtClaimName.AUTHENTICATION_CONTEXT_CLASS_REFERENCE);
logger.debug("Authentication ACR: '{}'", acrResponse);
profile.setUsedAcr(acrResponse);

List<ClaimToAttributeMapping> claimMappings = this.appConfiguration.getOpenIdClaimMapping();
if ((claimMappings == null) || (claimMappings.size() == 0)) {
logger.info("Using default claims to attributes mapping");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public class UserProfile implements Serializable {

private String id;

private String usedAcr;

private final Map<String, Object> attributes = new HashMap<String, Object>();

public String getId() {
Expand All @@ -32,6 +34,14 @@ public void setId(final String id) {
this.id = id;
}

public String getUsedAcr() {
return usedAcr;
}

public void setUsedAcr(String usedAcr) {
this.usedAcr = usedAcr;
}

public Map<String, Object> getAttributes() {
return Collections.unmodifiableMap(this.attributes);
}
Expand Down
2 changes: 1 addition & 1 deletion oxtrust-qa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<url>http://maven.apache.org</url>
<groupId>org.gluu</groupId>
<artifactId>oxtrust-qa</artifactId>
<version>4.3.0-SNAPSHOT</version>
<version>4.3.0.Final</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
17 changes: 12 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
<groupId>org.gluu</groupId>
<artifactId>oxtrust</artifactId>
<packaging>pom</packaging>
<version>4.3.0-SNAPSHOT</version>
<version>4.3.0.Final</version>
<name>oxTrust</name>
<url>http://www.gluu.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.min-version>3.3.9</maven.min-version>

<gluu.parent.version>4.3.0-SNAPSHOT</gluu.parent.version>
<oxcore.version>4.3.0-SNAPSHOT</oxcore.version>
<oxauth.version>4.3.0-SNAPSHOT</oxauth.version>
<gluu.parent.version>4.3.0.Final</gluu.parent.version>
<oxcore.version>4.3.0.Final</oxcore.version>
<oxauth.version>4.3.0.Final</oxauth.version>

<jettison.version>1.3.8</jettison.version>

Expand Down Expand Up @@ -191,7 +191,7 @@
<dependency>
<groupId>org.gluu</groupId>
<artifactId>uma-rs-resteasy</artifactId>
<version>4.3.0-SNAPSHOT</version>
<version>4.3.0.Final</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
Expand Down Expand Up @@ -625,6 +625,13 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<failOnError>false</failOnError>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand Down
2 changes: 1 addition & 1 deletion saml-openid-auth-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>org.gluu</groupId>
<artifactId>oxtrust</artifactId>
<version>4.3.0-SNAPSHOT</version>
<version>4.3.0.Final</version>
</parent>

<prerequisites>
Expand Down
4 changes: 2 additions & 2 deletions server-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>org.gluu</groupId>
<artifactId>oxtrust</artifactId>
<version>4.3.0-SNAPSHOT</version>
<version>4.3.0.Final</version>
</parent>

<prerequisites>
Expand All @@ -33,7 +33,7 @@
<phase>process-sources</phase>
<configuration>
<target>
<property name="oxtrust.server.basedir" value="${project.build.directory}/oxtrust-server-4.3.0-SNAPSHOT"/>
<property name="oxtrust.server.basedir" value="${project.build.directory}/oxtrust-server-4.3.0.Final"/>
<unwar dest="${project.build.directory}/${project.build.finalName}" src="${oxtrust.server.basedir}/target/${project.build.finalName}.war" />
</target>
</configuration>
Expand Down
2 changes: 1 addition & 1 deletion server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>org.gluu</groupId>
<artifactId>oxtrust</artifactId>
<version>4.3.0-SNAPSHOT</version>
<version>4.3.0.Final</version>
</parent>

<properties>
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>org.gluu</groupId>
<artifactId>oxtrust</artifactId>
<version>4.3.0-SNAPSHOT</version>
<version>4.3.0.Final</version>
</parent>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
*
* Copyright (c) 2018, Gluu
*/
package org.gluu.oxtrust.auth.uma;
package org.gluu.oxtrust.auth;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Created by jgomer on 2018-02-13.
* Use this annotation to annotate classes implementing GluuRestService interface
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.gluu.oxtrust.auth;

public interface GluuRestService {

String getName();
boolean isEnabled();
IProtectionService getProtectionService();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.gluu.oxtrust.auth;

import javax.ws.rs.container.ResourceInfo;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;

public interface IProtectionService {

Response processAuthorization(HttpHeaders httpHeaders, ResourceInfo resourceInfo);

public static Response simpleResponse(Response.Status status, String detail) {
return Response.status(status).entity(detail).build();
}

}
46 changes: 46 additions & 0 deletions service/src/main/java/org/gluu/oxtrust/auth/OxTrustApiService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.gluu.oxtrust.auth;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;

import org.gluu.config.oxtrust.AppConfiguration;
import org.gluu.oxtrust.auth.oauth.DefaultTestModeProtectionService;
import org.gluu.oxtrust.auth.uma.ApiUmaProtectionService;

import org.slf4j.Logger;

@ApplicationScoped
@BindingUrls({ "/api/v1" })
public class OxTrustApiService implements GluuRestService {

@Inject
private Logger log;

@Inject
private AppConfiguration appConfiguration;

@Inject
private ApiUmaProtectionService apiUmaProtectionService;

@Inject
private DefaultTestModeProtectionService testModeProtectionService;

@Override
public String getName() {
return "oxTrust API";
}

@Override
public boolean isEnabled() {
return true;
}

@Override
public IProtectionService getProtectionService() {
boolean testMode = appConfiguration.isOxTrustApiTestMode();
log.info("oxTrust API protection mode is {}", testMode ? "TEST" : "UMA");

return testMode ? testModeProtectionService : apiUmaProtectionService;
}

}
Loading

0 comments on commit 4532b38

Please sign in to comment.