Skip to content

Commit

Permalink
Merge pull request #23 from avpinchuk/ccx-fix-authorization-service
Browse files Browse the repository at this point in the history
Fixes policy configuration state transitions in `AuthorizationService`
  • Loading branch information
arjantijms authored Sep 19, 2023
2 parents 399e690 + 93af0f2 commit 7c21502
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation.
* Copyright (c) 2019, 2021 OmniFaces. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -69,7 +70,7 @@ public class AuthorizationService {

static final Logger logger = Logger.getLogger(AuthorizationService.class.getName());

private static boolean isSecMgrOff = System.getSecurityManager() == null;
private static final boolean isSecMgrOff = System.getSecurityManager() == null;

public static final String HTTP_SERVLET_REQUEST = "jakarta.servlet.http.HttpServletRequest";
public static final String SUBJECT = "javax.security.auth.Subject.container";
Expand All @@ -81,7 +82,7 @@ public class AuthorizationService {

private final String contextId;

private Function<Set<Principal>, ProtectionDomain> protectionDomainCreator = e -> newProtectionDomain(e);
private Function<Set<Principal>, ProtectionDomain> protectionDomainCreator = this::newProtectionDomain;

/**
* The authorization policy. This is the class that makes the actual decision for a permission
Expand Down Expand Up @@ -263,6 +264,9 @@ public void removeStatementsFromPolicy(Set<String> declaredRoles) {
try {
boolean inService = factory.inService(contextId);

// Open policy configuration
PolicyConfiguration policyConfiguration = factory.getPolicyConfiguration(contextId, false);

policyConfiguration.removeUncheckedPolicy();
policyConfiguration.removeExcludedPolicy();

Expand Down

0 comments on commit 7c21502

Please sign in to comment.