Loading gms-ui/src/App.vue +1 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ export default { } #loading { position: absolute; position: fixed; top: 0; bottom: 0; right: 0; Loading gms/pom.xml +5 −10 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.6.RELEASE</version> <version>2.1.7.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>it.inaf.ia2</groupId> Loading @@ -23,15 +23,15 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>org.springframework.security.oauth.boot</groupId> <artifactId>spring-security-oauth2-autoconfigure</artifactId> <version>${project.parent.version}</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-oauth2-client</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> Loading @@ -52,11 +52,6 @@ <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-test</artifactId> <scope>test</scope> </dependency> <!-- Embedded PostgreSQL: --> <dependency> <groupId>com.opentable.components</groupId> Loading gms/src/main/java/it/inaf/ia2/gms/authn/CustomAuthenticationData.java +3 −4 Original line number Diff line number Diff line Loading @@ -5,17 +5,16 @@ import java.util.Map; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.oauth2.common.OAuth2AccessToken; import org.springframework.security.oauth2.common.OAuth2RefreshToken; public class CustomAuthenticationData extends UsernamePasswordAuthenticationToken { private final Map<String, Object> attributes; private final OAuth2AccessToken accessToken; private final OAuth2RefreshToken refreshToken; private final String refreshToken; public CustomAuthenticationData(String username, Map<String, Object> attributes, Collection<? extends GrantedAuthority> authorities, OAuth2AccessToken accessToken, OAuth2RefreshToken refreshToken) { OAuth2AccessToken accessToken, String refreshToken) { super(username, "N/A", authorities); this.attributes = attributes; this.accessToken = accessToken; Loading @@ -30,7 +29,7 @@ public class CustomAuthenticationData extends UsernamePasswordAuthenticationToke return accessToken; } public OAuth2RefreshToken getRefreshToken() { public String getRefreshToken() { return refreshToken; } } gms/src/main/java/it/inaf/ia2/gms/authn/CustomIdTokenConverter.java +2 −2 Original line number Diff line number Diff line Loading @@ -6,7 +6,6 @@ import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.oauth2.common.OAuth2AccessToken; import org.springframework.security.oauth2.common.OAuth2RefreshToken; import org.springframework.security.oauth2.provider.token.DefaultUserAuthenticationConverter; import org.springframework.security.oauth2.provider.token.store.jwk.JwkTokenStore; Loading @@ -25,8 +24,9 @@ public class CustomIdTokenConverter extends DefaultUserAuthenticationConverter { OAuth2AccessToken token = jwkTokenStore.readAccessToken(idToken); String refreshToken = (String) map.get("refresh_token"); Map<String, Object> claims = token.getAdditionalInformation(); OAuth2RefreshToken refreshToken = token.getRefreshToken(); String principal = (String) claims.get("sub"); Loading gms/src/main/java/it/inaf/ia2/gms/authn/SessionData.java +14 −0 Original line number Diff line number Diff line Loading @@ -16,12 +16,14 @@ public class SessionData { private String userId; private String accessToken; private String refreshToken; @PostConstruct public void init() { CustomAuthenticationData authn = (CustomAuthenticationData) ((OAuth2Authentication) request.getUserPrincipal()).getUserAuthentication(); userId = (String) authn.getPrincipal(); accessToken = (String) authn.getAccessToken().getValue(); refreshToken = authn.getRefreshToken(); } public String getUserId() { Loading @@ -31,4 +33,16 @@ public class SessionData { public String getAccessToken() { return accessToken; } public void setAccessToken(String accessToken) { this.accessToken = accessToken; } public String getRefreshToken() { return refreshToken; } public void setRefreshToken(String refreshToken) { this.refreshToken = refreshToken; } } Loading
gms-ui/src/App.vue +1 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ export default { } #loading { position: absolute; position: fixed; top: 0; bottom: 0; right: 0; Loading
gms/pom.xml +5 −10 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.6.RELEASE</version> <version>2.1.7.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>it.inaf.ia2</groupId> Loading @@ -23,15 +23,15 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>org.springframework.security.oauth.boot</groupId> <artifactId>spring-security-oauth2-autoconfigure</artifactId> <version>${project.parent.version}</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-oauth2-client</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> Loading @@ -52,11 +52,6 @@ <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-test</artifactId> <scope>test</scope> </dependency> <!-- Embedded PostgreSQL: --> <dependency> <groupId>com.opentable.components</groupId> Loading
gms/src/main/java/it/inaf/ia2/gms/authn/CustomAuthenticationData.java +3 −4 Original line number Diff line number Diff line Loading @@ -5,17 +5,16 @@ import java.util.Map; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.oauth2.common.OAuth2AccessToken; import org.springframework.security.oauth2.common.OAuth2RefreshToken; public class CustomAuthenticationData extends UsernamePasswordAuthenticationToken { private final Map<String, Object> attributes; private final OAuth2AccessToken accessToken; private final OAuth2RefreshToken refreshToken; private final String refreshToken; public CustomAuthenticationData(String username, Map<String, Object> attributes, Collection<? extends GrantedAuthority> authorities, OAuth2AccessToken accessToken, OAuth2RefreshToken refreshToken) { OAuth2AccessToken accessToken, String refreshToken) { super(username, "N/A", authorities); this.attributes = attributes; this.accessToken = accessToken; Loading @@ -30,7 +29,7 @@ public class CustomAuthenticationData extends UsernamePasswordAuthenticationToke return accessToken; } public OAuth2RefreshToken getRefreshToken() { public String getRefreshToken() { return refreshToken; } }
gms/src/main/java/it/inaf/ia2/gms/authn/CustomIdTokenConverter.java +2 −2 Original line number Diff line number Diff line Loading @@ -6,7 +6,6 @@ import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.oauth2.common.OAuth2AccessToken; import org.springframework.security.oauth2.common.OAuth2RefreshToken; import org.springframework.security.oauth2.provider.token.DefaultUserAuthenticationConverter; import org.springframework.security.oauth2.provider.token.store.jwk.JwkTokenStore; Loading @@ -25,8 +24,9 @@ public class CustomIdTokenConverter extends DefaultUserAuthenticationConverter { OAuth2AccessToken token = jwkTokenStore.readAccessToken(idToken); String refreshToken = (String) map.get("refresh_token"); Map<String, Object> claims = token.getAdditionalInformation(); OAuth2RefreshToken refreshToken = token.getRefreshToken(); String principal = (String) claims.get("sub"); Loading
gms/src/main/java/it/inaf/ia2/gms/authn/SessionData.java +14 −0 Original line number Diff line number Diff line Loading @@ -16,12 +16,14 @@ public class SessionData { private String userId; private String accessToken; private String refreshToken; @PostConstruct public void init() { CustomAuthenticationData authn = (CustomAuthenticationData) ((OAuth2Authentication) request.getUserPrincipal()).getUserAuthentication(); userId = (String) authn.getPrincipal(); accessToken = (String) authn.getAccessToken().getValue(); refreshToken = authn.getRefreshToken(); } public String getUserId() { Loading @@ -31,4 +33,16 @@ public class SessionData { public String getAccessToken() { return accessToken; } public void setAccessToken(String accessToken) { this.accessToken = accessToken; } public String getRefreshToken() { return refreshToken; } public void setRefreshToken(String refreshToken) { this.refreshToken = refreshToken; } }