Class AuthorizationPolicyDeployer
- java.lang.Object
-
- org.uberfire.backend.server.authz.AuthorizationPolicyDeployer
-
@Startup @ApplicationScoped public class AuthorizationPolicyDeployer extends Object
An Uberfire's startup bean that scans the classpath looking for an authorization policy to deploy (a file named security-policy.properties).If located, the policy file is loaded and passed along the
AuthorizationPolicyStorage. The deployment process is only executed once, so if a policy instance has been already stored then the deployment is left out. TheAuthorizationPolicyMarshallerclass is used to read and convert the entries defined at the security-policy.properties file into anAuthorizationPolicyinstance.It is also possible to split the policy into multiple files. The security-policy.properties file is always mandatory as it serves as a marker file. Alongside that file, several security-module-?.properties files can be created. The split mechanism allows either for the provision of just a single full standalone policy file or multiple module files each of them containing different entries. The way those files are defined is always up to the application developer.
-
-
Constructor Summary
Constructors Constructor Description AuthorizationPolicyDeployer()AuthorizationPolicyDeployer(org.uberfire.backend.authz.AuthorizationPolicyStorage authzPolicyStorage, org.uberfire.security.authz.PermissionManager permissionManager, javax.enterprise.event.Event<org.uberfire.backend.events.AuthorizationPolicyDeployedEvent> deployedEvent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeployPolicy()voiddeployPolicy(Path policyDir)PathgetPolicyDir()voidinit()booleanisPolicyFile(Path p)org.uberfire.security.authz.AuthorizationPolicyloadPolicy(Path policyDir)voidloadPolicyFile(NonEscapedProperties properties, Path path)NonEscapedPropertiesreadPolicyProperties(Path policyDir)Put all the policy files together into a single properties instance.
-
-
-
Constructor Detail
-
AuthorizationPolicyDeployer
public AuthorizationPolicyDeployer()
-
AuthorizationPolicyDeployer
@Inject public AuthorizationPolicyDeployer(org.uberfire.backend.authz.AuthorizationPolicyStorage authzPolicyStorage, org.uberfire.security.authz.PermissionManager permissionManager, javax.enterprise.event.Event<org.uberfire.backend.events.AuthorizationPolicyDeployedEvent> deployedEvent)
-
-
Method Detail
-
init
@PostConstruct public void init()
-
deployPolicy
public void deployPolicy()
-
getPolicyDir
public Path getPolicyDir()
-
deployPolicy
public void deployPolicy(Path policyDir)
-
loadPolicy
public org.uberfire.security.authz.AuthorizationPolicy loadPolicy(Path policyDir)
-
readPolicyProperties
public NonEscapedProperties readPolicyProperties(Path policyDir) throws IOException
Put all the policy files together into a single properties instance.- Parameters:
policyDir- The source directory where to read the policy files from.- Returns:
- An
NonEscapedPropertiesinstance containing all the properties read from the policy files found - Throws:
IOException- When an IO error occurs reading any of the policy files
-
isPolicyFile
public boolean isPolicyFile(Path p)
-
loadPolicyFile
public void loadPolicyFile(NonEscapedProperties properties, Path path)
-
-