Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare staging for 2.0.0 #293

Merged
merged 5 commits into from
Nov 9, 2020
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ env:
- SERVER=wildfly,weld-decorator-bundled,bundled
- SERVER=tomee,bundled
- SERVER=openliberty,bundled
script: mvn clean package -P $SERVER
script: mvn clean package -P $SERVER,staging

2 changes: 1 addition & 1 deletion impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>4.2.1</version>
<version>5.1.1</version>
<extensions>true</extensions>
<configuration>
<instructions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.security.Principal;
import java.security.acl.Group;
// import java.security.acl.Group;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
Expand All @@ -38,16 +38,17 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

import jakarta.ejb.EJBContext;
import javax.security.auth.Subject;

import org.glassfish.soteria.authorization.EJB;
import org.glassfish.soteria.authorization.JACC;

import jakarta.ejb.EJBContext;
import jakarta.security.enterprise.CallerPrincipal;
import jakarta.security.jacc.PolicyContext;
import jakarta.security.jacc.PolicyContextException;
import jakarta.servlet.http.HttpServletRequest;

import org.glassfish.soteria.authorization.EJB;
import org.glassfish.soteria.authorization.JACC;

public class SubjectParser {

private static Object geronimoPolicyConfigurationFactoryInstance;
Expand Down Expand Up @@ -468,6 +469,7 @@ private Principal doGetCallerPrincipalFromPrincipals(Iterable<Principal> princip
* @param principal
* @return
*/
@SuppressWarnings("unchecked")
private Principal getVendorCallerPrincipal(Principal principal, boolean isEjb) {
switch (principal.getClass().getName()) {
case "org.glassfish.security.common.PrincipalImpl": // GlassFish/Payara
Expand All @@ -481,18 +483,24 @@ private Principal getVendorCallerPrincipal(Principal principal, boolean isEjb) {
return getAuthenticatedPrincipal(principal, "anonymous", isEjb);
// JBoss EAP/WildFly convention 2 - the one and only principal in group called CallerPrincipal
case "org.jboss.security.SimpleGroup":
if (principal.getName().equals("CallerPrincipal") && principal instanceof Group) {
if (principal.getName().equals("CallerPrincipal") && principal.getClass().getName().equals("org.jboss.security.SimpleGroup")) {
Enumeration<? extends Principal> groupMembers = null;
try {
groupMembers = (Enumeration<? extends Principal>) Class.forName(className("org.jboss.security.SimpleGroup"))
.getMethod("members")
.invoke(principal);
} catch (Exception e) {

Enumeration<? extends Principal> groupMembers = ((Group) principal).members();
}

if (groupMembers.hasMoreElements()) {
if (groupMembers != null && groupMembers.hasMoreElements()) {
return getAuthenticatedPrincipal(groupMembers.nextElement(), "anonymous", isEjb);
}
}
break;
case "org.apache.tomee.catalina.TomcatSecurityService$TomcatUser": // TomEE
try {
Principal tomeePrincipal = (Principal) Class.forName("org.apache.catalina.realm.GenericPrincipal")
Principal tomeePrincipal = (Principal) Class.forName(className("org.apache.catalina.realm.GenericPrincipal"))
.getMethod("getUserPrincipal")
.invoke(
Class.forName(className("org.apache.tomee.catalina.TomcatSecurityService$TomcatUser"))
Expand Down Expand Up @@ -521,6 +529,7 @@ private Principal getAuthenticatedPrincipal(Principal principal, String anonymou

}

@SuppressWarnings("unchecked")
public boolean principalToGroups(Principal principal, List<String> groups) {
switch (principal.getClass().getName()) {

Expand All @@ -532,10 +541,19 @@ public boolean principalToGroups(Principal principal, List<String> groups) {
break;

case "org.jboss.security.SimpleGroup": // JBoss EAP/WildFly
if (principal.getName().equals("Roles") && principal instanceof Group) {
Group rolesGroup = (Group) principal;
for (Principal groupPrincipal : list(rolesGroup.members())) {
groups.add(groupPrincipal.getName());
if (principal.getName().equals("Roles") && principal.getClass().getName().equals("org.jboss.security.SimpleGroup")) {

try {
Enumeration<? extends Principal> groupMembers = (Enumeration<? extends Principal>)
Class.forName(className("org.jboss.security.SimpleGroup"))
.getMethod("members")
.invoke(principal);

for (Principal groupPrincipal : list(groupMembers)) {
groups.add(groupPrincipal.getName());
}
} catch (Exception e) {

}

// Should only be one group holding the roles, so can exit the loop
Expand Down
26 changes: 13 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
</scm>

<properties>
<api_dependency_version>2.0.0-RC2</api_dependency_version>
<api_dependency_version>2.0.0</api_dependency_version>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
Expand All @@ -90,59 +90,59 @@
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>5.0.0-M1</version>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.interceptor</groupId>
<artifactId>jakarta.interceptor-api</artifactId>
<version>2.0.0-RC2</version>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
<version>4.0.0-RC1</version>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<version>3.0.0-M4</version>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>2.0.0-RC1</version>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>jakarta.security.auth.message</groupId>
<artifactId>jakarta.security.auth.message-api</artifactId>
<version>2.0.0-RC1</version>
<groupId>jakarta.authentication</groupId>
<artifactId>jakarta.authentication-api</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.authorization</groupId>
<artifactId>jakarta.authorization-api</artifactId>
<version>2.0.0-RC1</version>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.ejb</groupId>
<artifactId>jakarta.ejb-api</artifactId>
<version>4.0.0-RC1</version>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>3.0.0-RC3</version>
<version>3.0.0</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<version>4.13.1</version>
<scope>test</scope>
</dependency>

Expand Down
12 changes: 6 additions & 6 deletions spi/bean-decorator/weld/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>soteria-bean-decorator-weld</artifactId>
<artifactId>soteria.spi.bean.decorator.weld</artifactId>

<name>Soteria SPI : Bean Decorator : Weld</name>

<dependencies>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-osgi-bundle</artifactId>
<version>4.0.0.Alpha3</version>
<version>4.0.0.Beta5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.soteria</groupId>
<artifactId>jakarta.security.enterprise</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
<scope>provided</scope>
</dependency>
</dependencies>

Expand All @@ -55,7 +55,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>4.2.1</version>
<version>5.1.1</version>
<extensions>true</extensions>
<executions>
<execution>
Expand All @@ -77,7 +77,7 @@
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Automatic-Module-Name>org.glassfish.soteria.bean.decorator.weld</Automatic-Module-Name>
<Automatic-Module-Name>org.glassfish.soteria.spi.bean.decorator.weld.weld</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
Expand All @@ -90,7 +90,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-api-javadocs</id>
Expand Down
Loading