Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(config-api): acr enhancement for agama, asset mgt error message made descriptive #9919

Merged
merged 152 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
a3f3a66
fix(config-api): asset mgt endpoint fixes
pujavs Aug 5, 2024
9e309c0
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 5, 2024
59fd269
feat(config-api): asset upload mgt ehancement and fido
pujavs Aug 6, 2024
5a6396a
feat(config-api): asset upload mgt ehancement and fido
pujavs Aug 6, 2024
521f7b1
feat(config-api): asset upload mgt ehancement and fido
pujavs Aug 6, 2024
73618dd
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 6, 2024
583c881
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 7, 2024
95c57e4
fix(config-api): asset upload
pujavs Aug 8, 2024
ca50ec7
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 8, 2024
bbcbc92
fix(config-api): lock review comments
pujavs Aug 8, 2024
2bb92e3
feat(config-api): lock code review comments
pujavs Aug 9, 2024
c900d5f
feat(config-api): lock master renamed to lock server
pujavs Aug 9, 2024
eb62da4
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 9, 2024
6fad621
feat(config-api): lock master renamed to lock server
pujavs Aug 9, 2024
d17d2e6
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 9, 2024
7fefadb
feat(config-api): lock master renamed to lock server
pujavs Aug 9, 2024
cf85c47
feat(config-api): lock master renamed to lock server
pujavs Aug 9, 2024
c0444b5
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 11, 2024
ccf9ace
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 12, 2024
2d4a379
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 12, 2024
dd6555c
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 12, 2024
4696f98
feat(config-api): fido2 delete functionality
pujavs Aug 13, 2024
3b51e0d
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 13, 2024
5af8a00
fix(config-api): acr validation
pujavs Aug 14, 2024
88e3a20
feat(config-api): doc(config-api): IDP schema attribute descriptions …
pujavs Aug 15, 2024
cadc584
feat(config-api): sync with main
pujavs Aug 15, 2024
c4eb118
feat(config-api): sync with main
pujavs Aug 15, 2024
4de3cc0
feat(config-api): uploading assets via API generates 2 entries #9178
pujavs Aug 15, 2024
dfbc4f1
feat(config-api): asset mgt, fido and IDP changes
pujavs Aug 16, 2024
c3ba202
feat(config-api): fido2 device endpoint
pujavs Aug 19, 2024
34d1c9a
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 20, 2024
4473a90
feat(config-api): fido2 endpoint
pujavs Aug 20, 2024
6d974ed
feat(config-api): fido2 endpoint
pujavs Aug 20, 2024
5272c28
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 21, 2024
c6f2234
feat(config-api): sync with main
pujavs Aug 21, 2024
cbc8164
feat(config-api): sync with main
pujavs Aug 21, 2024
8e45ae3
feat(config-api): sync with main
pujavs Aug 21, 2024
d2c8277
feat(config-api): resolved sonar review issues
pujavs Aug 21, 2024
792c81c
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 22, 2024
9dfba84
feat(config-api): sonar review comment fix
pujavs Aug 22, 2024
54b2f59
feat(config-api): swagger spec
pujavs Aug 22, 2024
8d92097
feat(config-api): swagger spec
pujavs Aug 22, 2024
e078be2
feat(config-api): saml config attribute description
pujavs Aug 22, 2024
b7eac33
doc(config-api): added SAML attribute description
pujavs Aug 23, 2024
1fd93d8
doc(config-api): added SAML attribute description
pujavs Aug 23, 2024
28fed18
feat(config-api): sync with main
pujavs Aug 26, 2024
0d05fb6
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 27, 2024
573e47e
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 30, 2024
4590a55
feat(config-api): sync with main
pujavs Aug 30, 2024
cd764d6
fix(jans-lock): code review comment fix isssue#9305
pujavs Aug 30, 2024
d4e4c41
fix(jans-lock): code review comment fix isssue#9305
pujavs Aug 30, 2024
07ca449
feat(config-api): lock review point
pujavs Sep 2, 2024
2e98591
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 3, 2024
a513d11
fix(lock): code review comment
pujavs Sep 3, 2024
7e86521
fix(lock): code review comment
pujavs Sep 3, 2024
db7f37d
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 4, 2024
f1c1c29
fix(config-api): sync with main
pujavs Sep 4, 2024
77c5d46
feat(config-api): lock endpoint fixes and SAML IDP NPE
pujavs Sep 5, 2024
e00453b
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 5, 2024
89e16ee
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 6, 2024
39a8321
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 6, 2024
43323bf
feat(config-api): asset enhancement
pujavs Sep 9, 2024
7de3f99
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 9, 2024
e982673
feat(config-api): implement timer for asset mgt to fetch and deploy a…
pujavs Sep 9, 2024
fb95955
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 9, 2024
ec1eb27
fix(config-api): scope validation issue #9426
pujavs Sep 9, 2024
847b024
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 10, 2024
eac818b
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 10, 2024
ea2479f
fix(config-api): asset delete error fix
pujavs Sep 10, 2024
9a5b999
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 10, 2024
4b0b0b8
feat(config-api): sysnc with main
pujavs Sep 11, 2024
c8121e9
feat(config-api): sysnc with main
pujavs Sep 11, 2024
41104fc
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 12, 2024
17d91eb
fix(config-ap): lock audit endpoint parameter declaration error#9460
pujavs Sep 12, 2024
7c7b1b2
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 12, 2024
a53c1f3
feat(config-api): client token functionality
pujavs Sep 12, 2024
7845e14
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 13, 2024
84bfda6
fix(Config-api): lock audit endpoint path param rectification
pujavs Sep 13, 2024
930de96
feat(config-api): sysnc with main
pujavs Sep 13, 2024
2101295
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 13, 2024
83596a4
feat(config-api): clint token endpoint - wip
pujavs Sep 13, 2024
eafad7e
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 17, 2024
8a6766a
feat(config-api): clint token endpoint
pujavs Sep 17, 2024
07e1a8e
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 18, 2024
189d6b0
feat(config-api): client token endpoint
pujavs Sep 19, 2024
ab9687a
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 19, 2024
1878163
feat(config-api): client token endpoint
pujavs Sep 20, 2024
33c6795
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 20, 2024
b18c2f4
feat(config-api): token endpoint
pujavs Sep 20, 2024
89a18b2
feat(config-api): token endpoint
pujavs Sep 20, 2024
685195e
Merge branch 'main' into jans-config-fix
yuriyz Sep 20, 2024
256aff3
feat(config-api): token endpoint
pujavs Sep 20, 2024
9147254
Merge branch 'jans-config-fix' of https://github.com/JanssenProject/j…
pujavs Sep 20, 2024
21dabff
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 23, 2024
ae9b325
feat(config-api): session ednpoint wip
pujavs Sep 24, 2024
383064e
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 24, 2024
0ca4a9b
feat(config-api): session ednpoint wip
pujavs Sep 24, 2024
ea54289
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 25, 2024
1baec33
feat(config-api): session and token endpoint
pujavs Sep 25, 2024
9c49ad6
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 26, 2024
cccf083
feat(config-api): session endpoint
pujavs Sep 27, 2024
28a2fc4
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 27, 2024
648fcea
feat(config-api): session endpoint
pujavs Sep 27, 2024
4e64acd
feat(config-api): session and fido2 endpoint
pujavs Sep 27, 2024
df22bb9
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 27, 2024
23e09af
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 27, 2024
78d045e
test(config-api): marked session failing test case
pujavs Sep 27, 2024
590d625
feat(config-api): asset mgt dir mapping changes wip
pujavs Sep 30, 2024
f27dfe0
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 1, 2024
d13fc8a
feat(config-api): asset mgt dir changes
pujavs Oct 1, 2024
d1a5f02
feat(config-api): asset mgt changes for dir
pujavs Oct 2, 2024
5ff1171
feat(config-api): asset mgt endpoint -wip
pujavs Oct 3, 2024
32d627e
feat(config-api): asset mgt endpoint
pujavs Oct 3, 2024
c74b12f
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 4, 2024
931dcc0
feat(config-api): custom asset mgt wip
pujavs Oct 4, 2024
e65f021
feat(config-api): custom asset mgt
pujavs Oct 4, 2024
8338754
feat(config-api): custom asset mgt
pujavs Oct 4, 2024
5a18595
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 7, 2024
62dc60f
feat(config-api): session endpoint changes to remove sessionId
pujavs Oct 10, 2024
9073e05
feat(config-api) session endpoint changes to hide id
pujavs Oct 11, 2024
ed4b368
feat(config-api) session endpoint changes to hide id
pujavs Oct 11, 2024
321f3fc
feat(config-api): sync with main
pujavs Oct 12, 2024
41cef31
feat(config-api): session endpoint mgt
pujavs Oct 12, 2024
79a9c50
feat(config-api): session enhancement for removing id
pujavs Oct 14, 2024
3fbd543
feat(config-api): session endpoint changes to remove session id
pujavs Oct 14, 2024
50744dd
feat(config-api): session endpoint changes to remove session id
pujavs Oct 14, 2024
f86318a
feat(config-api): session endpoint changes to remove session id
pujavs Oct 14, 2024
b0c2be0
feat(config-api): session endpoint changes to remove session id
pujavs Oct 14, 2024
d19d230
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 14, 2024
6994ea5
feat(config-api): search fieldValuePair enhancement
pujavs Oct 15, 2024
67e3807
feat(config-api): search fieldValuePair enhancement
pujavs Oct 15, 2024
2b99f77
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 16, 2024
de5e77f
feat(config-api): session field filter enhancement - wip
pujavs Oct 16, 2024
4c146f4
feat(config-api): session field search enhancement wip
pujavs Oct 16, 2024
bfe907a
feat(config-api): session endpoint search enhancemnt
pujavs Oct 17, 2024
d5f9b90
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 17, 2024
5a0ddcb
feat(config-api): session endpoint search enhancemnt
pujavs Oct 17, 2024
6122175
feat(config-api): session endpoint search enhancement
pujavs Oct 17, 2024
0459d2d
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 18, 2024
ed44dae
feat(config-api): session and token endpoint enhacement
pujavs Oct 18, 2024
6e4dd02
feat(config-api): session and token search enhancement
pujavs Oct 18, 2024
4c5a74b
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 21, 2024
205485f
feat(config-api): session search changes for session attribute
pujavs Oct 21, 2024
521eb38
feat(config-api): fido2 search endpoint
pujavs Oct 21, 2024
1a1ed29
feat(config-api): fido2 entry search
pujavs Oct 22, 2024
ad1ed78
feat(config-api): sync with main
pujavs Oct 22, 2024
dd056b9
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 22, 2024
46738e8
feat(config-api): pagination implemented in fido2, session and token …
pujavs Oct 22, 2024
2fc3605
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Oct 23, 2024
402a624
feat(Config-ap): acr enhacement for agama
pujavs Oct 24, 2024
824f0f7
feat(Config-ap): made asset error message descriptive
pujavs Oct 24, 2024
4e90e9c
Merge branch 'main' into jans-config-fix
yuriyz Oct 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9213,20 +9213,20 @@ components:
type: string
selected:
type: boolean
userCanView:
whitePagesCanView:
type: boolean
adminCanView:
type: boolean
adminCanEdit:
type: boolean
userCanEdit:
type: boolean
userCanView:
type: boolean
adminCanAccess:
type: boolean
userCanAccess:
type: boolean
whitePagesCanView:
type: boolean
baseDn:
type: string
PatchRequest:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@

package io.jans.configapi.rest.resource.auth;

import io.jans.ads.model.Deployment;
import io.jans.config.GluuConfiguration;
import io.jans.configapi.core.model.ApiError;
import io.jans.configapi.core.rest.ProtectedApi;
import io.jans.configapi.model.configuration.ApiAppConfiguration;
import io.jans.configapi.rest.model.AuthenticationMethod;
import io.jans.configapi.service.auth.AgamaDeploymentsService;
import io.jans.configapi.service.auth.ConfigurationService;
import io.jans.configapi.service.auth.LdapConfigurationService;
import io.jans.configapi.util.ApiAccessConstants;
import io.jans.configapi.util.ApiConstants;
import io.jans.model.custom.script.model.CustomScript;
import io.jans.model.ldap.GluuLdapConfiguration;
import io.jans.orm.model.PagedResult;
import io.jans.service.custom.CustomScriptService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
Expand All @@ -28,6 +31,7 @@
import io.swagger.v3.oas.annotations.security.*;

import java.util.List;
import java.util.Set;
import java.util.Optional;

import org.apache.commons.lang.StringUtils;
Expand All @@ -48,6 +52,9 @@
@Produces(MediaType.APPLICATION_JSON)
public class AcrsResource extends ConfigBaseResource {

private static final String AGAMA_PREFIX = "agama_";
private static final String AGAMA_PREFIX_SEPERATOR = "_";

@Inject
Logger log;

Expand All @@ -60,6 +67,9 @@ public class AcrsResource extends ConfigBaseResource {
@Inject
CustomScriptService customScriptService;

@Inject
AgamaDeploymentsService agamaDeploymentsService;

@Inject
LdapConfigurationService ldapConfigurationService;

Expand Down Expand Up @@ -101,7 +111,7 @@ public Response updateDefaultAuthenticationMethod(@NotNull AuthenticationMethod
throwBadRequestException("Default authentication method should not be null or empty !");
}

if (StringUtils.isNotBlank(authenticationMethod.getDefaultAcr())) {
if (authenticationMethod != null && StringUtils.isNotBlank(authenticationMethod.getDefaultAcr())) {
validateAuthenticationMethod(authenticationMethod.getDefaultAcr());

final GluuConfiguration gluuConfiguration = configurationService.findGluuConfiguration();
Expand All @@ -117,7 +127,7 @@ private void validateAuthenticationMethod(String authenticationMode) {

// if authentication validation check is enabled then validate
boolean isAcrValid = isAcrValid(authenticationMode);
log.debug("isAcrValid:{}",isAcrValid);
log.debug("isAcrValid:{}", isAcrValid);
if (appConfiguration.isAcrValidationEnabled() && (!isAcrValid)) {
throwBadRequestException("INVALID_ACR",
String.format("Authentication script {%s} is not valid/active", authenticationMode));
Expand All @@ -127,14 +137,20 @@ private void validateAuthenticationMethod(String authenticationMode) {

private boolean isAcrValid(String authenticationMode) {
boolean isValid = false;
log.debug(" Validate ACR being set - authenticationMethod:{}, appConfiguration.getAcrExclusionList():{}", authenticationMode,
appConfiguration.getAcrExclusionList());
log.info(" Validate ACR being set - authenticationMethod:{}, appConfiguration.getAcrExclusionList():{}",
authenticationMode, appConfiguration.getAcrExclusionList());

if (appConfiguration.getAcrExclusionList() != null
&& appConfiguration.getAcrExclusionList().contains(authenticationMode)) {
return true;
}

// Agama Flow
if (StringUtils.isNotBlank(authenticationMode) && authenticationMode.startsWith(AGAMA_PREFIX)) {
log.debug(" Agama authenticationMethod provided.");
return isValidAgamaDeployment(authenticationMode);
}

List<GluuLdapConfiguration> ldapConfigurations = ldapConfigurationService.findLdapConfigurations();
log.debug(" ldapConfigurations:{}", ldapConfigurations);
if (ldapConfigurations != null && !ldapConfigurations.isEmpty()) {
Expand All @@ -152,7 +168,7 @@ private boolean isAcrValid(String authenticationMode) {

// if ACR being set is a script then it should be active
CustomScript script = customScriptService.getScriptByDisplayName(authenticationMode);
log.debug(" script:{}", script);
log.debug(" CustomScript:{}", script);
if (script != null && script.isEnabled()) {
log.debug(" script:{}, script.isEnabled():{}", script, script.isEnabled());
return true;
Expand All @@ -162,4 +178,63 @@ private boolean isAcrValid(String authenticationMode) {
return isValid;
}

public boolean isValidAgamaDeployment(String authenticationMode) {
boolean isValid = false;
log.info(" Validate Agama ACR - authenticationMode:{},", authenticationMode);
if (StringUtils.isBlank(authenticationMode)) {
return isValid;
}

// Get deployed agama projects
PagedResult<Deployment> deploymentPagedResult = agamaDeploymentsService.list(0, 0, getMaxCount());
log.info(" Agama Deployments - deploymentPagedResult:{},", deploymentPagedResult);

if (deploymentPagedResult != null && deploymentPagedResult.getEntries() != null
&& !deploymentPagedResult.getEntries().isEmpty()) {
List<Deployment> agamaDeploymentList = deploymentPagedResult.getEntries();
log.debug(" agamaDeploymentList:{},", agamaDeploymentList);

Set<String> keys = getDirectLaunchFlows(agamaDeploymentList);
log.info("Final DirectLaunchFlows - keys:{}, authenticationMode:{}, authenticationMode.indexOf(AGAMA_PREFIX_SEPERATOR):{} , authenticationMode.indexOf(AGAMA_PREFIX_SEPERATOR)+1:{}", keys, authenticationMode, authenticationMode.indexOf(AGAMA_PREFIX_SEPERATOR) , authenticationMode.indexOf(AGAMA_PREFIX_SEPERATOR)+1);
String agamaAcr = authenticationMode;
if (authenticationMode.indexOf(AGAMA_PREFIX_SEPERATOR) > 0) {
agamaAcr = authenticationMode.substring(authenticationMode.indexOf(AGAMA_PREFIX_SEPERATOR)+1);
}
log.info(" agamaAcr:{},", agamaAcr);

if (keys != null && !keys.isEmpty() && keys.contains(agamaAcr)) {
log.debug(" keys.contains(agamaAcr):{},", keys.contains(agamaAcr));
isValid = true;
}
}
log.info(" isValidAgamaDeployment - isValid:{}", isValid);
return isValid;
}

private Set<String> getDirectLaunchFlows(List<Deployment> agamaDeploymentList) {
log.info(" agamaDeploymentList:{}", agamaDeploymentList);
Set<String> keys = null;
List<String> noDirectLaunchFlows = null;
if (agamaDeploymentList == null || agamaDeploymentList.isEmpty()) {
return keys;
}
for (Deployment deployment : agamaDeploymentList) {
log.debug("Agama deployment:{},", deployment);
if (deployment.getDetails() != null && deployment.getDetails().getFlowsError() != null) {
keys = deployment.getDetails().getFlowsError().keySet();
log.debug(" Agama flow keys:{},", keys);

if (deployment.getDetails().getProjectMetadata() != null) {
noDirectLaunchFlows = deployment.getDetails().getProjectMetadata().getNoDirectLaunchFlows();
}
}
}
log.debug("All deployed agama keys:{}, noDirectLaunchFlows:{}", keys, noDirectLaunchFlows);
if (keys != null && !keys.isEmpty() && noDirectLaunchFlows != null) {
keys.removeAll(noDirectLaunchFlows);
}
log.info("Final agama main flow keys:{}", keys);
return keys;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
public class AssetService {

private static final String ASSET_DIR_STR = "AssetDirMapping for [";
private static final String NOT_DEFINED_IN_CONFIG = "] is not defined in config!";
private static final String NOT_DEFINED_IN_CONFIG = " is not defined in config!";

@Inject
Logger log;
Expand Down Expand Up @@ -438,7 +438,7 @@ private String getAssetDir(Document asset) {

if (StringUtils.isBlank(assetDir)) {
throw new InvalidConfigurationException(
"Directory to save asset [" + assetFileName + NOT_DEFINED_IN_CONFIG);
"Directory to save asset [" + assetFileName +"]"+ NOT_DEFINED_IN_CONFIG);
}

StringBuilder sb = new StringBuilder();
Expand Down Expand Up @@ -480,7 +480,7 @@ private String getAssetDirectory(Document asset) {
log.info("Asset dirMapping :{}", dirMapping);

if (StringUtils.isBlank(dirMapping)) {
throw new InvalidConfigurationException(ASSET_DIR_STR + serviceModule + NOT_DEFINED_IN_CONFIG);
throw new InvalidConfigurationException(ASSET_DIR_STR + serviceModule +"] for asset type ["+fileExtension+"]"+ NOT_DEFINED_IN_CONFIG);
}

serviceDir = String.format(dirMapping, serviceModule);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ public PagedResult<TokenEntity> searchToken(SearchRequest searchRequest) {
persistenceEntryManager);
}

fieldValueFilters.add(Filter.createORFilter(filters));
searchFilter = Filter.createANDFilter(fieldValueFilters);
searchFilter = Filter.createANDFilter(Filter.createORFilter(filters),
Filter.createANDFilter(fieldValueFilters));

logger.info("Token final searchFilter:{}", searchFilter);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,36 @@ public static Map<String, String> getFieldType(Class<?> clazz, List<FieldFilterD
return getFieldDataType(clazz, fieldList);
}

public static Date formatStrDate(String dateString, String datePattern) {
logger.debug("Format String Date - dateString:{}: datePattern:{}", dateString, datePattern);
Date date = null;
try {
if (StringUtils.isBlank(dateString)) {
return date;
}

if (StringUtils.isBlank(datePattern)) {
if (dateString.contains(":")) {
datePattern = "yyyy-MM-dd HH:mm:ss Z";
} else {
datePattern = "yyyy-MM-dd";
}
}

SimpleDateFormat dateFormat = new SimpleDateFormat(datePattern);
logger.debug("datePattern:{}, dateFormat:{} ", datePattern, dateFormat);

date = dateFormat.parse(dateString);
logger.debug("Returning dateFormat:{}, date:{} ", dateFormat, date);

} catch (Exception ex) {
logger.error("Error while formatting String Date - dateString{" + dateString + "}", ex);
return date;
}

return date;
}

public static List<Filter> createFilter(List<FieldFilterData> fieldFilterData, String primaryKey,
PersistenceEntryManager persistenceEntryManager) {
logger.info("Create ORM Filter for fieldFilterData:{}, primaryKey:{}, persistenceEntryManager:{}",
Expand Down Expand Up @@ -288,52 +318,35 @@ private static boolean getBooleanValue(String strValue) {

}

private static Date getDate(String dateString, String primaryKey, PersistenceEntryManager persistenceEntryManager) {
logger.info("Get Date Value for dateString:{}, primaryKey:{}, persistenceEntryManager:{}", dateString,
primaryKey, persistenceEntryManager);
Date dateValue = null;
if (StringUtils.isBlank(dateString) || StringUtils.isBlank(primaryKey) || persistenceEntryManager == null) {
private static String encodeDate(Date date, String primaryKey, PersistenceEntryManager persistenceEntryManager) {
logger.info("Encode String Date - date:{}, primaryKey:{}, persistenceEntryManager:{}", date, primaryKey,
persistenceEntryManager);
String dateValue = null;
if (date == null || StringUtils.isBlank(primaryKey) || persistenceEntryManager == null) {
return dateValue;
}

dateValue = persistenceEntryManager.decodeTime(primaryKey, dateString);
logger.info(" persistenceEntryManager.decodeTime - dateString:{}, dateValue:{}", dateString, dateValue);

dateValue = formatStrDate(dateString, null);
logger.info(" formatStrDate - dateValue:{}", dateValue);
dateValue = persistenceEntryManager.encodeTime(primaryKey, date);
logger.info(" persistenceEntryManager.decodeTime - date:{}, dateValue:{}", date, dateValue);

return dateValue;

}

private static Date formatStrDate(String dateString, String datePattern) {
logger.debug("Format String Date - dateString:{}: datePattern:{}", dateString, datePattern);
Date date = null;
try {
if (StringUtils.isBlank(dateString)) {
return date;
}

if (StringUtils.isBlank(datePattern)) {
if (dateString.contains(":")) {
datePattern = "yyyy-MM-dd HH:mm:ss";
} else {
datePattern = "yyyy-MM-dd";
}
}

SimpleDateFormat dateFormat = new SimpleDateFormat(datePattern);
logger.debug("dateFormat:{} ", dateFormat);
private static Date decodeStringDate(String dateString, String primaryKey,
PersistenceEntryManager persistenceEntryManager) {
logger.info("Decode String Date - dateString:{}, primaryKey:{}, persistenceEntryManager:{}", dateString,
primaryKey, persistenceEntryManager);
Date dateValue = null;
if (StringUtils.isBlank(dateString) || StringUtils.isBlank(primaryKey) || persistenceEntryManager == null) {
return dateValue;
}

date = dateFormat.parse(dateString);
logger.info("Returning dateFormat:{}, date:{} ", dateFormat, date);
dateValue = persistenceEntryManager.decodeTime(primaryKey, dateString);
logger.info(" persistenceEntryManager.decodeTime - dateString:{}, dateValue:{}", dateString, dateValue);

} catch (Exception ex) {
logger.error("Error while formatting String Date - dateString{" + dateString + "}", ex);
return date;
}
return dateValue;

return date;
}

private static Filter createDateFilter(FieldFilterData fieldFilterData, String primaryKey,
Expand All @@ -345,10 +358,13 @@ private static Filter createDateFilter(FieldFilterData fieldFilterData, String p
if (fieldFilterData == null) {
return dateFilter;
}
Date dateValue = getDate(fieldFilterData.getValue(), primaryKey, persistenceEntryManager);

Date dateValue = decodeStringDate(fieldFilterData.getValue(), primaryKey, persistenceEntryManager);
logger.info(" fieldFilterData.getField():{}, fieldFilterData.getValue():{}, dateValue:{}",
fieldFilterData.getField(), fieldFilterData.getValue(), dateValue);

if (FilterOperator.EQUALITY.getSign().equalsIgnoreCase(fieldFilterData.getOperator())) {
dateFilter = Filter.createGreaterOrEqualFilter(fieldFilterData.getField(), dateValue);
dateFilter = Filter.createEqualityFilter(fieldFilterData.getField(), dateValue);

} else if (FilterOperator.GREATER.getSign().equalsIgnoreCase(fieldFilterData.getOperator())
|| FilterOperator.GREATER_OR_EQUAL.getSign().equalsIgnoreCase(fieldFilterData.getOperator())) {
Expand Down