Added avatar URL setting (#19726)

This commit is contained in:
Mauro Mugnaini 2020-08-12 20:14:04 +02:00
parent 06f1a551e7
commit 58f154f6d8
6 changed files with 15 additions and 48 deletions

View File

@ -1,7 +1,9 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for "oidc-library-portal"
## [v1.0.1-SNAPSHOT]
- Added configuration for avatar URL (#19726)
## [v1.0.0-SNAPSHOT]
- First release (#19143) (#19225) (#19226) (#19227) (#19228)
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View File

@ -11,7 +11,7 @@
</parent>
<groupId>org.gcube.portal</groupId>
<artifactId>oidc-library-portal</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<dependencyManagement>
<dependencies>
<dependency>

View File

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

View File

@ -1,18 +0,0 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>descriptor.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>servicearchive</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

View File

@ -29,6 +29,7 @@ public class LiferayOpenIdConnectConfiguration implements OpenIdConnectConfigura
private URL tokenURL;
private URL logoutURL;
private URL issuerURL;
private URL avatarURL;
private String portalClientId;
private String portalClientSecret;
private String scope;
@ -61,6 +62,7 @@ public class LiferayOpenIdConnectConfiguration implements OpenIdConnectConfigura
this.tokenURL = new URL(PrefsPropsUtil.getString(companyId, "d4science.oidc-token"));
this.logoutURL = new URL(PrefsPropsUtil.getString(companyId, "d4science.oidc-logout"));
this.issuerURL = new URL(PrefsPropsUtil.getString(companyId, "d4science.oidc-issuer"));
this.avatarURL = new URL(PrefsPropsUtil.getString(companyId, "d4science.oidc-keycloak_avatar"));
this.portalClientId = PrefsPropsUtil.getString(companyId, "d4science.oidc-portal-client-id");
this.portalClientSecret = PrefsPropsUtil.getString(companyId, "d4science.oidc-portal-client-secret");
this.scope = PrefsPropsUtil.getString(companyId, "d4science.oidc-scope");
@ -73,6 +75,7 @@ public class LiferayOpenIdConnectConfiguration implements OpenIdConnectConfigura
log.info("tokenURL=" + getTokenURL());
log.info("logoutURL=" + getLogoutURL());
log.info("issuerURL=" + getIssuerURL());
log.info("avatarURL=" + getAvatarURL());
log.info("portalClientId=" + getPortalClientId());
log.info("portalClientSecret=" + getPortalClientSecret());
log.info("scope=" + getScope());
@ -126,4 +129,9 @@ public class LiferayOpenIdConnectConfiguration implements OpenIdConnectConfigura
return this.createUnexistingUser;
}
@Override
public URL getAvatarURL() {
return avatarURL;
}
}

View File

@ -29,7 +29,7 @@ public class OIDCUmaUtil {
try {
log.debug("Getting client token from server");
JWTToken clientToken = OpenIdConnectRESTHelper.queryClientToken(clientId, clientSecret, tokenURL);
provideClientUMATokenInThreadLocal(clientToken.getAsBearer(), tokenURL, infraContext);
provideClientUMATokenInThreadLocal(clientToken.getAccessTokenAsBearer(), tokenURL, infraContext);
} catch (Exception e) {
log.error("Cannot retrieve client OIDC token", e);
return;