Authorization control library

From Gcube Wiki
Revision as of 16:36, 14 September 2022 by Lucio.lelii (Talk | contribs)

Jump to: navigation, search

Contents

Authorization Control Library allows gcube services to automatically filter methods using specific rules based on user roles

How To

To enable authorization control on your gcube service the pom.xml must be modified in the following way:

  • add the authorization control library dependency
<dependency>
	<groupId>org.gcube.common</groupId>
        <artifactId>authorization-control-library</artifactId>
</dependency>
  • since this library use aspectJ this dependency must be added to the dependecy management
<dependency>
	<groupId>org.aspectj</groupId>
	<artifactId>aspectjrt</artifactId>
	<version>1.8.2</version>
</dependency>
  • the plugin must be declared in the plugins block
<plugins>
	<plugin>
		<groupId>org.codehaus.mojo</groupId>
		<artifactId>aspectj-maven-plugin</artifactId>
	</plugin>
...
  • and execution added in the build block
<build>
      ...
      <pluginManagement>
        <plugin>
		<groupId>org.codehaus.mojo</groupId>
		<artifactId>aspectj-maven-plugin</artifactId>
			<version>1.7</version>
					<configuration>
				<complianceLevel>1.8</complianceLevel>
				<source>1.8</source>
				<target>1.8</target>
				<aspectLibraries>
					<aspectLibrary>
						<groupId>org.gcube.common</groupId>
						<artifactId>authorization-control-library</artifactId>
					</aspectLibrary>
				</aspectLibraries>
			</configuration>
			<executions>
				<execution>
					<goals>
						<goal>compile</goal>
					</goals>
				</execution>
			</executions>
	</plugin>
...