Skip to content

Commit

Permalink
Merge from 4.3.0 (#15)
Browse files Browse the repository at this point in the history
* Version 4.2.0.Final

* Version 4.2.1.Final

* Remove uncrypter redis password

* Simple test to check session ttl.

(cherry picked from commit 4027666)

* Simple test to check session ttl.

(cherry picked from commit 59bedca)

* (4.2.1) During CB entry update make sure TTL is updated too.

GluuFederation/oxCore#199

(cherry picked from commit 956a06f)

* Update to conform Couchbase 6.5

* Don't load entry from DB afte merge #200

* Sample for session replacement

* Store issued tokens count metrics #1436

* disabled manual tests

* Add uniq identifier for each metric entry to allow find whcih node
addded this record oxAuth #1438

* Change javax.faces with jakarta.faces

* Injection: Cross-Site Scripting oxTrust #2012

* Move some log from DEBUG to TRACE #201

* Update methods to store oxExternalUid as multivalued by default oxAuth
#1442

* Update sample to add user with oxExternalUid and search by this
attribute

* Added new methods related to software_statement validation.

GluuFederation/oxAuth#1444

* Renamed new methods related to software_statement validation.

GluuFederation/oxAuth#1444

* Corrected DummyClientRegistrationType.

GluuFederation/oxAuth#1444

* Fix variable name spelling

* Use CustomObjectAttribute instead of CustomAttribute in user services to
use JSON data types #1445

* Rename method to get value as object

* JAXB-API implementation error oxTrust #2005

* Add new utility methods to xml service

* Add ScriptService in oxCore

* Add scope to ScriptService

* Add methods

* Fix dependecy issue

* Merge ScriptService into AbstractCustomScriptService

* Merge ScriptService into AbstractCustomScriptService

* Default custom ScriptService

* Version 4.2.1.Final

* Load scripts during startup instead of send async even to load them
after startup oxCore #202

* Add property to specify when exernal service is loaded

* Override default timeout in bucket infor request

* Fail isConnected method check if at least one bucket is not online

* Version 4.2.2-SNAPSHOT

* Add additional methods

* Added CouchbaseConnectionConfiguration (config api)

https://github.com/GluuFederation/oxauth-config/issues/136

* Added config id

https://github.com/GluuFederation/oxauth-config/issues/136

* During CB entry update make sure TTL is updated too.  #199

* Turn off metric reported by default if there is no configuration

* Simple test to check session ttl.

* disabled manual test

* Simple test to check session ttl.

* Revert " During CB entry update make sure TTL is updated too.  #199"

This reverts commit d2f8041

* Moving noisy log lines to trace

* oxAuth reloads custom scripts (file method)

* (4.2.2) Avoid race condition during saving grant object in cache

GluuFederation/oxAuth#1478

* (4.2.2) oxcore : added revoke token custom script

GluuFederation/oxAuth#1502

* Destroy CouchbaseEnvironment object on container restart #207

* Destroy CouchbaseEnvironment object on container restart #207

* Fix typo in method name

* Metric Service clean all entries when DB is Couchbase #206

* Metric Service clean all entries when DB is Couchbase #206

* Fix method to update log level #204

* Don't fail in javadocs error

* Add boolean switcher for id token in logout uri #2046

* Persistence extension script still running after disabled oxAuth #1514

* Version 4.2.2.Final

* Version 4.2.3-SNAPSHOT

* (4.2.2) oxcore : removed printing password from JcaDocumentStoreConfiguration and WebDavDocumentStoreConfiguration

* Use UTF-8 encodeing during convertion base64 to XML

* Fix XML doc reading and signature validation

* Commented updateAppendersAndLogLevel() method which cause memory leak

GluuFederation/oxCore#204

* Temporary enabled back old solution.

GluuFederation/oxCore#204

* Version 4.2.3.Final

* Version 4.3.0.Final

* New interceptions script to modify id_token oxAuth #1523

* Add license

* Convert decrypted data to UTF-8 string

* Add keepAliveInterval CB SDK support

* (4.2.3) ORM : allow to ignore TTL update on merging.

GluuFederation/oxAuth#1528

* Revert "(4.2.3) ORM : allow to ignore TTL update on merging."

This reverts commit 478a71b

* Allow to skip TTL set on Couchbase document update Jans ORM #6

* Don't update ttl on docuemnt update by default

* (4.2.3) Avoid NPE in BaseEntryManager.getExpirationValue()

GluuFederation/oxAuth#1528

* Revert "Don't update ttl on docuemnt update by default"

This reverts commit 8707a19

* fix: issue #216

* feat: merge from jans-orm

* feat: merge from jans-orm

* feat: merge ORM from Jans

* feat: merge ORM from Jans

* feat: merge ORM from Jans

* feat: merge ORM from Jans

* fix: move schema bean to right location

* fix: Fix license and config prefix

* fix: fix test failues

* fix: fix test failures

* fix: fix compilation issues

* fix: fix tests failures

* feat: merge ORM from Jans

* fix: issue #216

* fix: fix eq conversion if table column is JSON

* feat: update tests to conform SQL ORM API

* feat: add sample to search if user belong to group

* feat: throw exception when objectClass used in filter is unknown

* feat: add entry class type to MappingException message

* fix: fix filter test

* fix: fix filter tests

* chore: sync with jans-orm

* fix: throw exception if table not exists

* fix: fix typo in code

* feat: don't use lower case in authenticate if DB is Spanner

* Throw ORM exception is entryClass is not defined

* feat: throw right exception when column is undefined

* fix(4.3) : transfered TTL 30 days bugfix to cb specific manager

https://github.com/JanssenProject/jans-orm/issues/25

* fix(4.3) : avoid npe

https://github.com/JanssenProject/jans-orm/issues/25
https://github.com/JanssenProject/jans-auth-server/issues/126

* fix(4.3.0) : added missed parethesis

https://github.com/JanssenProject/jans-orm/issues/25

* feat: Support Fpis Truststores

* chore: make baseEntry extend Entry

* fix(oxOrm-oxtrust): cache Refresh not working on 4.3.0 version. #2072

* feat: reffactor exception catch in connection provider

* fix: fix properties helper split method

* Revert "fix: fix properties helper split method"

This reverts commit 2403686.

* Revert "fix(oxOrm-oxtrust): cache Refresh not working on 4.3.0 version. #2072"

This reverts commit 3377a6a.

* feat: add test to check custom field removal

* fix: fix search by multivalued column in SQL

* Version 4.3.0.Final

* fix: fix tests

* fix: fix tests

* fix: fix tests

* fix(4.3) : corrected attributes according to existing schema

GluuFederation/oxAuth#1552

* Merge with 4.3.0

Co-authored-by: Gasmyr <[email protected]>
Co-authored-by: YuriyZ <[email protected]>
Co-authored-by: Jose <[email protected]>
  • Loading branch information
4 people authored Oct 5, 2021
1 parent a32b14a commit 855f908
Show file tree
Hide file tree
Showing 697 changed files with 20,091 additions and 34,068 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Eclipse project files
.dbeaver
.settings
.project
.classpath
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
oxCore
======
This is the library for persistence and caching implemenations in GluuFederation. Currently LDAP, Couchbase, MySQL, Spanner are supported.
8 changes: 4 additions & 4 deletions persistence-annotation/pom.xml → annotation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<artifactId>oxcore-persistence-annotation</artifactId>
<artifactId>gluu-orm-annotation</artifactId>
<packaging>jar</packaging>
<name>persistence-annotation</name>
<name>gluu-orm-annotation</name>

<parent>
<groupId>org.gluu</groupId>
<artifactId>oxcore</artifactId>
<version>5.0.0-SNAPSHOT</version>
<artifactId>gluu-orm-parent</artifactId>
<version>4.3.0.Final</version>
</parent>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface DataEntry {

/**
* (Optional) The name of the Persistance attributes
*/
String[] sortByName() default {};

/**
* (Optional) Specify that this entry contains LDAP configuration definition.
*/
Expand All @@ -30,4 +35,9 @@
*/
String[] sortBy() default {};

/**
* (Optional) Specify that ORM should update entry without it lookup.
*/
boolean forceUpdate() default false;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* oxCore is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
*
* Copyright (c) 2014, Gluu
*/

package org.gluu.persist.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Persistance Entry Expiration
*
* @author Yuriy Movchan Date: 03/26/2020
*/
@Target({ ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
public @interface Expiration {
/**
* (Optional) Specify that we ignore this Persistance attribute during update.
* Defaults value is false.
*/
boolean ignoreDuringUpdate() default false;

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,5 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface ObjectClass {

@Deprecated // TODO: Remove it in 4.0
String[] values() default {};

String value() default "";
}
27 changes: 11 additions & 16 deletions demo-cdi/pom.xml → cdi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<artifactId>oxcore-demo-cdi</artifactId>
<name>Demo CDI services</name>
<artifactId>gluu-orm-cdi</artifactId>
<name>Persistence CDI services</name>

<parent>
<groupId>org.gluu</groupId>
<artifactId>oxcore</artifactId>
<version>5.0.0-SNAPSHOT</version>
<artifactId>gluu-orm-parent</artifactId>
<version>4.3.0.Final</version>
</parent>

<prerequisites>
Expand All @@ -30,26 +30,21 @@
</build>

<dependencies>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
<groupId>org.gluu</groupId>
<artifactId>gluu-orm-core</artifactId>
</dependency>

<dependency>
<groupId>org.gluu</groupId>
<artifactId>gluu-orm-ldap</artifactId>
</dependency>

<!-- CDI -->
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>

<!-- Resteasy -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* oxCore is available under the MIT License (2014). See http://opensource.org/licenses/MIT for full text.
*
* Copyright (c) 2020, Gluu
*/

package org.gluu.persist.service;

import java.io.File;
Expand All @@ -6,15 +12,15 @@

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Instance;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;

import org.apache.commons.configuration.PropertiesConfiguration;
import org.gluu.persist.PersistenceEntryManagerFactory;
import org.gluu.persist.ldap.impl.LdapEntryManagerFactory;
import org.gluu.persist.model.PersistenceConfiguration;
import org.gluu.util.StringHelper;
import org.gluu.util.properties.FileConfiguration;
import org.gluu.persist.service.BaseFactoryService;
import org.gluu.orm.util.StringHelper;
import org.gluu.orm.util.properties.FileConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -42,7 +48,7 @@ public class PersistanceFactoryService implements BaseFactoryService {

public static final String BASE_DIR;
public static final String DIR = BASE_DIR + File.separator + "conf" + File.separator;
private static final String GLUU_FILE_PATH = DIR + "gluu.properties";
private static final String JANS_FILE_PATH = DIR + "gluu.properties";

@Inject
private Logger log;
Expand All @@ -59,32 +65,32 @@ public PersistenceConfiguration loadPersistenceConfiguration() {
public PersistenceConfiguration loadPersistenceConfiguration(String applicationPropertiesFile) {
PersistenceConfiguration currentPersistenceConfiguration = null;

String gluuFileName = determineGluuConfigurationFileName(applicationPropertiesFile);
if (gluuFileName != null) {
currentPersistenceConfiguration = createPersistenceConfiguration(gluuFileName);
String jansFileName = determineJansConfigurationFileName(applicationPropertiesFile);
if (jansFileName != null) {
currentPersistenceConfiguration = createPersistenceConfiguration(jansFileName);
}

// Fall back to old LDAP persistence layer
if (currentPersistenceConfiguration == null) {
getLog().warn("Failed to load persistence configuration. Attempting to use LDAP layer");
PersistenceEntryManagerFactory defaultEntryManagerFactory = getPersistenceEntryManagerFactory(LdapEntryManagerFactory.class);
currentPersistenceConfiguration = createPersistenceConfiguration(defaultEntryManagerFactory.getPersistenceType(), LdapEntryManagerFactory.class,
defaultEntryManagerFactory.getConfigurationFileNames());
defaultEntryManagerFactory.getConfigurationFileNames(null));
}

return currentPersistenceConfiguration;
}

private PersistenceConfiguration createPersistenceConfiguration(String gluuFileName) {
private PersistenceConfiguration createPersistenceConfiguration(String jansFileName) {
try {
// Determine persistence type
FileConfiguration gluuFileConf = new FileConfiguration(gluuFileName);
if (!gluuFileConf.isLoaded()) {
getLog().error("Unable to load configuration file '{}'", gluuFileName);
FileConfiguration jansFileConf = new FileConfiguration(jansFileName);
if (!jansFileConf.isLoaded()) {
getLog().error("Unable to load configuration file '{}'", jansFileName);
return null;
}

String persistenceType = gluuFileConf.getString("persistence.type");
String persistenceType = jansFileConf.getString("persistence.type");
PersistenceEntryManagerFactory persistenceEntryManagerFactory = getPersistenceEntryManagerFactory(persistenceType);
if (persistenceEntryManagerFactory == null) {
getLog().error("Unable to get Persistence Entry Manager Factory by type '{}'", persistenceType);
Expand All @@ -96,7 +102,7 @@ private PersistenceConfiguration createPersistenceConfiguration(String gluuFileN
if (PersistenceEntryManagerFactory.class.isAssignableFrom(persistenceEntryManagerFactoryType.getSuperclass())) {
persistenceEntryManagerFactoryType = (Class<? extends PersistenceEntryManagerFactory>) persistenceEntryManagerFactoryType.getSuperclass();
}
Map<String, String> persistenceFileNames = persistenceEntryManagerFactory.getConfigurationFileNames();
Map<String, String> persistenceFileNames = persistenceEntryManagerFactory.getConfigurationFileNames(null);

PersistenceConfiguration persistenceConfiguration = createPersistenceConfiguration(persistenceType, persistenceEntryManagerFactoryType,
persistenceFileNames);
Expand Down Expand Up @@ -176,20 +182,20 @@ private void appendPropertiesWithPrefix(PropertiesConfiguration mergedConfigurat
while (keys.hasNext()) {
String key = (String) keys.next();
Object value = appendConfiguration.getProperty(key);
mergedConfiguration.setProperty(prefix + "." + key, value);
mergedConfiguration.setProperty(prefix + "#" + key, value);
}
}

private String determineGluuConfigurationFileName(String applicationPropertiesFile) {
private String determineJansConfigurationFileName(String applicationPropertiesFile) {
String applicationFilePath = DIR + applicationPropertiesFile;
File applicationFile = new File(applicationFilePath);
if (applicationFile.exists()) {
return applicationFilePath;
}

File ldapFile = new File(GLUU_FILE_PATH);
File ldapFile = new File(JANS_FILE_PATH);
if (ldapFile.exists()) {
return GLUU_FILE_PATH;
return JANS_FILE_PATH;
}

return null;
Expand All @@ -210,10 +216,12 @@ public PersistenceEntryManagerFactory getPersistenceEntryManagerFactory(Class<?

@Override
public PersistenceEntryManagerFactory getPersistenceEntryManagerFactory(String persistenceType) {
String basePersistenceType = getBasePersistenceType(persistenceType);

// Get persistence entry manager factory
for (PersistenceEntryManagerFactory currentPersistenceEntryManagerFactory : persistenceEntryManagerFactoryInstance) {
log.debug("Found Persistence Entry Manager Factory with type '{}'", currentPersistenceEntryManagerFactory);
if (StringHelper.equalsIgnoreCase(currentPersistenceEntryManagerFactory.getPersistenceType(), persistenceType)) {
if (StringHelper.equalsIgnoreCase(currentPersistenceEntryManagerFactory.getPersistenceType(), basePersistenceType)) {
return currentPersistenceEntryManagerFactory;
}
}
Expand All @@ -230,4 +238,29 @@ public Logger getLog() {
return this.log;

}

@Override
public String getBasePersistenceType(String persistenceType) {
if (StringHelper.isEmpty(persistenceType) || !persistenceType.contains(".")) {
return persistenceType;
}

int index = persistenceType.indexOf(".");
return persistenceType.substring(0, index);
}

@Override
public String getPersistenceTypeAlias(String persistenceType) {
if (StringHelper.isEmpty(persistenceType) || !persistenceType.contains(".")) {
return null;
}

int index = persistenceType.indexOf(".");
if (index < persistenceType.length() - 1) {
return persistenceType.substring(index + 1);
}

return null;
}

}
File renamed without changes.
Loading

0 comments on commit 855f908

Please sign in to comment.