Compare commits

..

15 Commits

Author SHA1 Message Date
Luca Frosini 08914cd887 removed eclipse project files 2024-11-22 12:07:38 +01:00
Luca Frosini 5ec975a2d2 removed eclipse project files 2024-11-22 12:07:03 +01:00
lucio 47ccbfc245 commit for release 2024-10-28 14:31:44 +01:00
lucio 56dbca5a9a Merge branch 'master' of
https://code-repo.d4science.org/gCubeSystem/common-security.git
2024-10-28 13:49:31 +01:00
lucio 4aca393905 validation and expiration splitted 2024-10-28 13:48:31 +01:00
Giancarlo Panichi 13b1496f83 Update CHANGELOG.md 2024-10-14 15:43:50 +02:00
lucio ab22bc3958 updated for release 2024-10-02 11:41:54 +02:00
lucio 57dc3583d5 updated 2024-10-02 11:40:19 +02:00
lucio b7d717e499 updated 2024-10-02 11:38:46 +02:00
lucio 655e90a175 added factories 2024-10-02 11:38:06 +02:00
lucio 4da184a5f8 commit for release 2024-10-01 10:08:38 +02:00
lucio 1eefb94589 updated 2024-10-01 10:07:47 +02:00
lucio 430239c239 added global roles 2024-05-08 11:41:35 +02:00
lucio 5a67408ad0 added FUNDING file 2024-05-08 11:24:18 +02:00
lucio 6a994486cd added isValid method to secret interface 2024-04-30 16:56:15 +02:00
14 changed files with 261 additions and 123 deletions

View File

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

184
.gitignore vendored
View File

@ -1 +1,183 @@
/target/ # Created by https://www.toptal.com/developers/gitignore/api/eclipse,visualstudiocode,linux,macos,java,maven
# Edit at https://www.toptal.com/developers/gitignore?templates=eclipse,visualstudiocode,linux,macos,java,maven
### Eclipse ###
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# PyDev specific (Python IDE for Eclipse)
*.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# CDT- autotools
.autotools
# Java annotation processor (APT)
.factorypath
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
# Code Recommenders
.recommenders/
# Annotation Processing
.apt_generated/
.apt_generated_test/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
# Uncomment this line if you wish to ignore the project description file.
# Typically, this file would be tracked if it contains build/dependency configurations:
#.project
### Eclipse Patch ###
# Spring Boot Tooling
.sts4-cache/
### Java ###
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar
# Eclipse m2e generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
# End of https://www.toptal.com/developers/gitignore/api/eclipse,visualstudiocode,linux,macos,java,maven

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gcube-security</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -1,6 +0,0 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View File

@ -1,8 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,4 +0,0 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -2,11 +2,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for Gcube security # Changelog for Gcube security
## [v1.0.1-SNAPSHOT] - 2022-05-23
- modified SecretManagerProvider thread local ## [v1.0.0]
## [v1.0.0] - 2022-05-23
- First Release - First Release

26
FUNDING.md Normal file
View File

@ -0,0 +1,26 @@
# Acknowledgments
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260).
- the Seventh Framework Programme for research, technological development and demonstration
- [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488);
- [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019);
- [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465);
- [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644);
- [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754).
- the H2020 research and innovation programme
- [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024);
- [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119);
- [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142);
- [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182);
- [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680);
- [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610);
- [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001);
- [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194);
- [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914);
- [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091);
- [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650);
- [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409);
- [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042);

View File

@ -31,26 +31,7 @@ open-source software toolkit used for building and operating Hybrid Data
Infrastructures enabling the dynamic deployment of Virtual Research Environments Infrastructures enabling the dynamic deployment of Virtual Research Environments
by favouring the realisation of reuse oriented policies. by favouring the realisation of reuse oriented policies.
The projects leading to this software have received funding from a series of European Union programmes including: The projects leading to this software have received funding from a series of European Union programmes see [FUNDING.md](FUNDING.md)
- the Sixth Framework Programme for Research and Technological Development
- DILIGENT (grant no. 004260).
- the Seventh Framework Programme for research, technological development and demonstration
- D4Science (grant no. 212488);
- D4Science-II (grant no.239019);
- ENVRI (grant no. 283465);
- iMarine(grant no. 283644);
- EUBrazilOpenBio (grant no. 288754).
- the H2020 research and innovation programme
- SoBigData (grant no. 654024);
- PARTHENOS (grant no. 654119);
- EGIEngage (grant no. 654142);
- ENVRIplus (grant no. 654182);
- BlueBRIDGE (grant no. 675680);
- PerformFish (grant no. 727610);
- AGINFRAplus (grant no. 731001);
- DESIRA (grant no. 818194);
- ARIADNEplus (grant no. 823914);
- RISIS2 (grant no. 824091);

View File

@ -11,7 +11,7 @@
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common</groupId>
<artifactId>common-security</artifactId> <artifactId>common-security</artifactId>
<version>1.0.1-SNAPSHOT</version> <version>1.0.0</version>
<name>gcube security</name> <name>gcube security</name>
<scm> <scm>
@ -21,8 +21,8 @@
</scm> </scm>
<properties> <properties>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@ -30,7 +30,7 @@
<dependency> <dependency>
<groupId>org.gcube.distribution</groupId> <groupId>org.gcube.distribution</groupId>
<artifactId>gcube-bom</artifactId> <artifactId>gcube-bom</artifactId>
<version>3.0.1-SNAPSHOT</version> <version>4.0.0</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>

View File

@ -8,7 +8,8 @@ public class Owner {
private String clientId; private String clientId;
private List<String> roles = new ArrayList<String>(); private List<String> roles = new ArrayList<String>();
private List<String> realm_roles = new ArrayList<String>();
private List<String> globalRoles = new ArrayList<String>();
boolean externalClient; boolean externalClient;
@ -35,8 +36,6 @@ public class Owner {
this.application = application; this.application = application;
} }
public Owner(String clientId, List<String> roles, String email, String firstName, String lastName,boolean external, boolean application) { public Owner(String clientId, List<String> roles, String email, String firstName, String lastName,boolean external, boolean application) {
super(); super();
this.clientId = clientId; this.clientId = clientId;
@ -48,9 +47,16 @@ public class Owner {
this.application = application; this.application = application;
} }
public Owner(String clientId, List<String> roles, List<String> realm_roles, String email, String firstName, String lastName,boolean external, boolean application) { public Owner(String clientId, List<String> roles, List<String> globalRoles, String email, String firstName, String lastName,boolean external, boolean application) {
this(clientId, roles, email, firstName, lastName, external, application); super();
this.realm_roles = realm_roles; this.clientId = clientId;
this.roles = roles;
this.globalRoles = globalRoles;
this.email = email;
this.firstName = firstName;
this.lastName = lastName;
this.externalClient = external;
this.application = application;
} }
public boolean isApplication() { public boolean isApplication() {
@ -65,11 +71,10 @@ public class Owner {
return roles; return roles;
} }
public List<String> getRealmRoles() { public List<String> getGlobalRoles() {
return realm_roles; return globalRoles;
} }
public String getEmail() { public String getEmail() {
return email; return email;
} }

View File

@ -0,0 +1,17 @@
package org.gcube.common.security.factories;
import java.util.Set;
import org.gcube.common.security.credentials.Credentials;
import org.gcube.common.security.secrets.Secret;
public interface AuthorizationProvider {
Set<String> getContexts();
Secret getSecretForContext(String context);
@Deprecated
Credentials getCredentials();
}

View File

@ -0,0 +1,9 @@
package org.gcube.common.security.factories;
import org.gcube.common.security.credentials.Credentials;
public interface AuthorizationProviderFactory<T extends AuthorizationProvider> {
T connect(Credentials credentials);
}

View File

@ -15,6 +15,7 @@ public abstract class Secret {
public abstract Map<String,String> getHTTPAuthorizationHeaders(); public abstract Map<String,String> getHTTPAuthorizationHeaders();
public abstract boolean isExpired(); public abstract boolean isValid();
public abstract boolean isExpired();
} }