Introduction to WSO2 Balana
WSO2 Balana is an open-source project implementing the XACML (eXtensible Access Control Markup Language) specification, building on the groundwork laid by Sun's XACML implementation. Its name "Balana", which means "fortress", aptly describes its role as a robust entitlement engine designed to manage authorization policies external to applications. With its modular framework, Balana assists developers in crafting comprehensive entitlement solutions swiftly and efficiently.
Supported Specifications
Balana boasts support for multiple versions of the XACML specification:
Installation
To incorporate Balana into a project, one must add the following Maven dependency in the project's pom.xml
file:
<dependency>
<groupId>org.wso2.balana</groupId>
<artifactId>org.wso2.balana</artifactId>
<version>1.1.12</version>
</dependency>
Getting Started
Creating a default instance of Balana involves setting up a file-based policy repository. Developers can establish this environment using the snippet below:
private static Balana balana;
private static void initBalana() {
try {
// Using file based policy repository, setting policy location as a system property
String policyLocation = (new File(".")).getCanonicalPath() + File.separator + "resources";
System.setProperty(FileBasedPolicyFinderModule.POLICY_DIR_PROPERTY, policyLocation);
} catch (IOException e) {
System.err.println("Cannot locate policy repository");
}
// Create default instance of Balana
balana = Balana.getInstance();
}
Running Samples
To explore Balana through practical examples, users need to:
- Install Java SE Development Kit 1.8.
- Install Apache Maven 3.x.x, downloadable here.
- Clone the repository from Github or download the source.
- Execute
mvn clean install
in the Balana directory. - Navigate to
balana/modules/balana-samples/<selected sample>
. - Run the sample using the provided script.
The samples available include:
Licensing
While Sun's XACML implementation is available under a specific license which can be viewed here, WSO2's implementation of Balana is released under the Apache2 license.