Difference between revisions of "Authorization control library"

From Gcube Wiki
Jump to: navigation, search
Line 6: Line 6:
 
= How To =
 
= How To =
  
To enable authorization control on your gcube service the following dependency must be added
+
To enable authorization control on your gcube service the ''pom.xml'' must be modified in the following way:
 +
 
 +
* add the authorization control library dependency
  
 
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">
Line 15: Line 17:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
since this library use ''aspectJ'' this dependency must be added to the dependecy management
+
* since this library use ''aspectJ'' this dependency must be added to the dependecy management
  
 
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">
Line 25: Line 27:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
the plugin must be declared in the ''plugins'' block   
+
* the plugin must be declared in the ''plugins'' block   
  
 
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">
Line 36: Line 38:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
and execution added in the ''build'' block
+
* and execution added in the ''build'' block
  
 
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">

Revision as of 16:36, 14 September 2022

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>
...