JWTUmaTokenProvider changed to AccessTokenProvider

This commit is contained in:
lucio.lelii 2021-05-24 16:30:18 +02:00
parent 131cee828d
commit 279bce0575
5 changed files with 12 additions and 71 deletions

View File

@ -4,6 +4,9 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.4.0-SNAPSHOT] - [2021-05-21]
JWTUmaTokenProvider changed to AccessTokenProvider
## [v2.3.1] - [2021-03-30]

38
pom.xml
View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.common</groupId>
<artifactId>common-authorization</artifactId>
<version>2.3.1-SNAPSHOT</version>
<version>2.4.0</version>
<name>authorization service common library</name>
<parent>
@ -38,40 +38,4 @@
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-profile</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>target</outputDirectory>
<resources>
<resource>
<directory>.</directory>
<filtering>true</filtering>
<includes>
<include>profile.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ID />
<Type>Service</Type>
<Profile>
<Description>${description}</Description>
<Class>Common</Class>
<Name>${artifactId}</Name>
<Version>1.0.0</Version>
<Packages>
<Software>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<MavenCoordinates>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
</MavenCoordinates>
<Files>
<File>${build.finalName}.jar</File>
</Files>
</Software>
</Packages>
</Profile>
</Resource>

View File

@ -2,9 +2,9 @@ package org.gcube.common.authorization.library;
import java.util.concurrent.Callable;
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
import org.gcube.common.authorization.library.provider.AuthorizationProvider;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.authorization.library.provider.UmaJWTProvider;
import org.gcube.common.authorization.library.utils.Caller;
import org.gcube.common.scope.api.ScopeProvider;
import org.slf4j.Logger;
@ -29,7 +29,7 @@ public class AuthorizedTasks {
final String scope = ScopeProvider.instance.get();
final String umaToken = UmaJWTProvider.instance.get();
final String accessToken = AccessTokenProvider.instance.get();
return new Callable<V>() {
@Override
@ -39,7 +39,7 @@ public class AuthorizedTasks {
AuthorizationProvider.instance.set(userCall);
SecurityTokenProvider.instance.set(token);
ScopeProvider.instance.set(scope);
UmaJWTProvider.instance.set(umaToken);
AccessTokenProvider.instance.set(accessToken);
try {
logger.info("setting on authorized task scope {} and token {}", scope, token);
@ -69,7 +69,7 @@ public class AuthorizedTasks {
final String scope = ScopeProvider.instance.get();
final String umaToken = UmaJWTProvider.instance.get();
final String accessToken = AccessTokenProvider.instance.get();
return new Runnable() {
@Override
@ -77,7 +77,7 @@ public class AuthorizedTasks {
AuthorizationProvider.instance.set(userCall);
SecurityTokenProvider.instance.set(token);
ScopeProvider.instance.set(scope);
UmaJWTProvider.instance.set(umaToken);
AccessTokenProvider.instance.set(accessToken);
try {
logger.info("setting on authorized task scope {} and token {}", scope, token);

View File

@ -1,8 +1,8 @@
package org.gcube.common.authorization.library.provider;
public class UmaJWTProvider {
public class AccessTokenProvider {
public static UmaJWTProvider instance = new UmaJWTProvider();
public static AccessTokenProvider instance = new AccessTokenProvider();
private static final InheritableThreadLocal<String> threadToken = new InheritableThreadLocal<String>() {
@ -13,7 +13,7 @@ public class UmaJWTProvider {
};
private UmaJWTProvider() {
private AccessTokenProvider() {
}
public String get() {