Skip to content

Commit 14c920d

Browse files
yingbullsebastian-j-ibanez
authored andcommitted
Merge pull request #45 from cc-ar-emr/java17-upg
2 parents dac693f + 56b737f commit 14c920d

3 files changed

Lines changed: 36 additions & 18 deletions

File tree

.devcontainer/development/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
FROM openjdk:11-jdk-slim
1+
FROM openjdk:21-jdk-slim
22

33
# Set environment variables for Tomcat
44
ENV CATALINA_HOME /usr/local/tomcat
55
ENV PATH $CATALINA_HOME/bin:$PATH
6+
ENV CATALINA_OPTS="--add-opens java.base/java.net=ALL-UNNAMED"
67

78
# Copy Tomcat installation from the official Tomcat image
89
COPY --from=tomcat:9.0.97 /usr/local/tomcat $CATALINA_HOME

src/main/java/oscar/login/jaas/BaseLoginModule.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import java.io.IOException;
2828
import java.security.Principal;
29-
import java.security.acl.Group;
3029
import java.util.ArrayList;
3130
import java.util.Arrays;
3231
import java.util.List;
@@ -66,11 +65,11 @@ public class BaseLoginModule implements LoginModule {
6665

6766
private OscarPrincipal principal;
6867

69-
private Group rolesGroup;
68+
private OscarGroup rolesGroup;
7069

71-
private Group callerPrincipal;
70+
private OscarGroup callerPrincipal;
7271

73-
private Group authPrincipal;
72+
private OscarGroup authPrincipal;
7473

7574
private boolean authorizationEnabled = false;
7675

@@ -164,7 +163,7 @@ public boolean login() throws LoginException {
164163
authPrincipal.addMember(getPrincipal());
165164
setAuthPrincipal(authPrincipal);
166165

167-
Group rolesGroup = new OscarGroup("Roles");
166+
OscarGroup rolesGroup = new OscarGroup("Roles");
168167
for (OscarRole role : getRoles(loginName)) {
169168
rolesGroup.addMember(role);
170169
}
@@ -278,27 +277,27 @@ public void setSharedState(Map<String, ?> sharedState) {
278277
this.sharedState = sharedState;
279278
}
280279

281-
public Group getRolesGroup() {
280+
public OscarGroup getRolesGroup() {
282281
return rolesGroup;
283282
}
284283

285-
public void setRolesGroup(Group rolesGroup) {
284+
public void setRolesGroup(OscarGroup rolesGroup) {
286285
this.rolesGroup = rolesGroup;
287286
}
288287

289-
public Group getCallerPrincipal() {
288+
public OscarGroup getCallerPrincipal() {
290289
return callerPrincipal;
291290
}
292291

293-
public void setCallerPrincipal(Group callerPrincipal) {
292+
public void setCallerPrincipal(OscarGroup callerPrincipal) {
294293
this.callerPrincipal = callerPrincipal;
295294
}
296295

297-
public Group getAuthPrincipal() {
296+
public OscarGroup getAuthPrincipal() {
298297
return authPrincipal;
299298
}
300299

301-
public void setAuthPrincipal(Group authPrincipal) {
300+
public void setAuthPrincipal(OscarGroup authPrincipal) {
302301
this.authPrincipal = authPrincipal;
303302
}
304303

src/main/java/oscar/login/jaas/OscarGroup.java

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,12 @@
2626

2727
import java.io.Serializable;
2828
import java.security.Principal;
29-
import java.security.acl.Group;
3029
import java.util.ArrayList;
3130
import java.util.Collections;
3231
import java.util.Enumeration;
3332
import java.util.List;
3433

35-
public class OscarGroup implements Group, Serializable {
34+
public class OscarGroup implements Principal, Serializable {
3635

3736
private static final long serialVersionUID = 1L;
3837

@@ -56,25 +55,44 @@ public void setName(String name) {
5655
this.name = name;
5756
}
5857

59-
@Override
58+
/**
59+
* Adds a member to the group.
60+
*
61+
* @param user the Principal to be added
62+
* @return true whether the member was added
63+
*/
6064
public boolean addMember(Principal user) {
6165
if (!principals.contains(user))
6266
principals.add(user);
6367
return true;
6468
}
6569

66-
@Override
70+
/**
71+
* Removes a member from the group.
72+
*
73+
* @param user the Principal to be removed
74+
* @return true whether the member was removed
75+
*/
6776
public boolean removeMember(Principal user) {
6877
principals.remove(user);
6978
return true;
7079
}
7180

72-
@Override
81+
/**
82+
* Checks if a Principal is a member of the group.
83+
*
84+
* @param member the Principal to be checked
85+
* @return true if the member exists in the group
86+
*/
7387
public boolean isMember(Principal member) {
7488
return principals.contains(member);
7589
}
7690

77-
@Override
91+
/**
92+
* Returns an enumeration of the group's members.
93+
*
94+
* @return an Enumeration of the members
95+
*/
7896
public Enumeration<? extends Principal> members() {
7997
return Collections.enumeration(principals);
8098
}

0 commit comments

Comments
 (0)