Difference between revisions of "Authorization control library"

From Gcube Wiki
Jump to: navigation, search
Line 8: Line 8:
 
To enable authorization control on your gcube service the following dependency must be added
 
To enable authorization control on your gcube service the following dependency must be added
  
<code>
+
<syntaxhighlight lang="xml">
 
<dependency>
 
<dependency>
 
<groupId>org.gcube.common</groupId>
 
<groupId>org.gcube.common</groupId>
 
         <artifactId>authorization-control-library</artifactId>
 
         <artifactId>authorization-control-library</artifactId>
 
</dependency>
 
</dependency>
</code>
+
</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
Line 27: Line 27:
 
the plugin must be declared in the ''plugins'' block   
 
the plugin must be declared in the ''plugins'' block   
  
<code>
+
<syntaxhighlight lang="xml">
 
<plugins>
 
<plugins>
 
<plugin>
 
<plugin>
Line 34: Line 34:
 
</plugin>
 
</plugin>
 
...
 
...
</code>
+
</syntaxhighlight>
  
 
and execution added in the ''build'' block
 
and execution added in the ''build'' block
  
<code>
+
<syntaxhighlight lang="xml">
 
<build>
 
<build>
 
       ...
 
       ...
Line 66: Line 66:
 
</plugin>
 
</plugin>
 
...
 
...
</code>
+
</syntaxhighlight>

Revision as of 16:35, 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 following dependency must be added

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