Skip to content

Commit

Permalink
fix(config-api): source LDAP server test (#5840)
Browse files Browse the repository at this point in the history
  • Loading branch information
pujavs authored Aug 11, 2023
1 parent ed0be7f commit 5379b36
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 26 deletions.
24 changes: 12 additions & 12 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7450,20 +7450,20 @@ components:
$ref: '#/components/schemas/AttributeValidation'
tooltip:
type: string
whitePagesCanView:
type: boolean
adminCanEdit:
type: boolean
adminCanAccess:
type: boolean
adminCanView:
userCanEdit:
type: boolean
adminCanEdit:
adminCanView:
type: boolean
userCanAccess:
type: boolean
userCanView:
type: boolean
whitePagesCanView:
type: boolean
userCanEdit:
type: boolean
baseDn:
type: string
PatchRequest:
Expand Down Expand Up @@ -8206,8 +8206,6 @@ components:
type: boolean
skipAuthenticationFilterOptionsMethod:
type: boolean
fapi:
type: boolean
allResponseTypesSupported:
uniqueItems: true
type: array
Expand All @@ -8217,6 +8215,8 @@ components:
- code
- token
- id_token
fapi:
type: boolean
AuthenticationFilter:
required:
- baseDn
Expand Down Expand Up @@ -8956,10 +8956,10 @@ components:
type: array
items:
type: object
displayValue:
type: string
value:
type: object
displayValue:
type: string
LocalizedString:
type: object
properties:
Expand Down Expand Up @@ -9196,14 +9196,14 @@ components:
type: boolean
internal:
type: boolean
locationPath:
type: string
locationType:
type: string
enum:
- ldap
- db
- file
locationPath:
type: string
baseDn:
type: string
ScriptError:
Expand Down
4 changes: 2 additions & 2 deletions jans-config-api/plugins/docs/user-mgt-plugin-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -838,10 +838,10 @@ components:
type: array
items:
type: object
displayValue:
type: string
value:
type: object
displayValue:
type: string
CustomUser:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,37 +34,34 @@ public class ConnectionStatus {
ConfigurationFactory configurationFactory;

public boolean isUp(GluuLdapConfiguration ldapConfiguration) {

FileConfiguration configuration = loadFileConfiguration();
logger.debug(
" configuration:{}, ldapConfiguration:{}, ldapConfiguration.getBindDN():{}, ldapConfiguration.getBindPassword()):{}, ldapConfiguration.isUseSSL():{} ",
configuration, ldapConfiguration, ldapConfiguration.getBindDN(), ldapConfiguration.getBindPassword(),
logger.info(" LDAP Connection Status parameters - ldapConfiguration:{}, ldapConfiguration.getBindDN():{}, ldapConfiguration.getBindPassword()):{}, ldapConfiguration.isUseSSL():{} ",
ldapConfiguration, ldapConfiguration.getBindDN(), ldapConfiguration.getBindPassword(),
ldapConfiguration.isUseSSL());

Properties properties = configuration.getProperties();
Properties properties = System.getProperties();
properties.setProperty("bindDN", ldapConfiguration.getBindDN());
properties.setProperty("bindPassword", ldapConfiguration.getBindPassword());
properties.setProperty("servers", buildServersString(getServers(ldapConfiguration)));
properties.setProperty("useSSL", Boolean.toString(ldapConfiguration.isUseSSL()));
Properties ldapDecryptedProperties = PropertiesDecrypter.decryptProperties(properties,
configurationFactory.getCryptoConfigurationSalt());

logger.trace("Attempting to create LDAP connection with properties: {}", ldapDecryptedProperties);

LdapConnectionProvider connectionProvider = new LdapConnectionProvider(
PropertiesDecrypter.decryptProperties(properties, configurationFactory.getCryptoConfigurationSalt()));

logger.trace("connectionProvider: {}", connectionProvider);
connectionProvider.create(ldapDecryptedProperties);
logger.debug("Connection status connectionProvider.isConnected(): {}", connectionProvider.isConnected());

logger.info("Connection status connectionProvider.isConnected(): {}", connectionProvider.isConnected());

if (connectionProvider.isConnected()) {
logger.trace("Connect to LDAP");
connectionProvider.closeConnectionPool();
return true;
}

return false;
}

Expand Down

0 comments on commit 5379b36

Please # to comment.