Skip to content

Commit

Permalink
fix(config-api): user password being displayed as clear text (#10441)
Browse files Browse the repository at this point in the history
* fix(config-api): missing scope in spec

Signed-off-by: pujavs <[email protected]>

* fix(config-api): missing scope in spec

Signed-off-by: pujavs <[email protected]>

* feat(Config-api): sync with main

Signed-off-by: pujavs <[email protected]>

* feat(config-api): server app status

Signed-off-by: pujavs <[email protected]>

* feat(config-api): server app status

Signed-off-by: pujavs <[email protected]>

* feat(config-api): agama repo endpoin -wip

Signed-off-by: pujavs <[email protected]>

* feat(config-api): sync with main

Signed-off-by: pujavs <[email protected]>

* feat(config-api): agama rep endpoint

Signed-off-by: pujavs <[email protected]>

* feat(config-api): agama endpoint wip

Signed-off-by: pujavs <[email protected]>

* feat(config-api): implemenetd agama repo endpoint and fixed user pwd validation for patch

Signed-off-by: pujavs <[email protected]>

* feat(config-api): implemenetd agama repo endpoint and fixed user pwd validation for patch

Signed-off-by: pujavs <[email protected]>

* fix(Config-api): user password patch fix

Signed-off-by: pujavs <[email protected]>

* fix(config-api): user credentials in plain text

Signed-off-by: pujavs <[email protected]>

* fix(config-api): user password being displayed as clear text

Signed-off-by: pujavs <[email protected]>

* fix(config-api): user password being displayed as clear text

Signed-off-by: pujavs <[email protected]>

---------

Signed-off-by: pujavs <[email protected]>
  • Loading branch information
pujavs authored Dec 17, 2024
1 parent f215679 commit fdfd7a6
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 41 deletions.
15 changes: 9 additions & 6 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9305,18 +9305,18 @@ components:
type: boolean
whitePagesCanView:
type: boolean
adminCanEdit:
adminCanView:
type: boolean
userCanView:
type: boolean
userCanEdit:
type: boolean
adminCanView:
type: boolean
userCanAccess:
adminCanEdit:
type: boolean
adminCanAccess:
type: boolean
userCanAccess:
type: boolean
baseDn:
type: string
PatchRequest:
Expand Down Expand Up @@ -9692,6 +9692,9 @@ components:
accessTokenLifetime:
type: integer
format: int32
userInfoLifetime:
type: integer
format: int32
cleanServiceInterval:
type: integer
format: int32
Expand Down Expand Up @@ -11730,10 +11733,10 @@ components:
ttl:
type: integer
format: int32
persisted:
type: boolean
opbrowserState:
type: string
persisted:
type: boolean
SessionIdAccessMap:
type: object
properties:
Expand Down
38 changes: 30 additions & 8 deletions jans-config-api/plugins/docs/fido2-plugin-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,8 @@ components:
type: boolean
sessionIdPersistInCache:
type: boolean
oldU2fMigrationEnabled:
type: boolean
errorReasonEnabled:
type: boolean
fido2Configuration:
Expand All @@ -581,7 +583,7 @@ components:
type: string
checkU2fAttestations:
type: boolean
debugUserAutoEnrollment:
userAutoEnrollment:
type: boolean
unfinishedRequestExpiration:
type: integer
Expand All @@ -591,17 +593,17 @@ components:
format: int32
serverMetadataFolder:
type: string
enabledFidoAlgorithms:
requestedCredentialTypes:
type: array
items:
type: string
rp:
requestedParties:
type: array
items:
$ref: '#/components/schemas/RequestedParty'
metadataUrlsProvider:
type: string
disableMetadataService:
skipDownloadMdsEnabled:
type: boolean
skipValidateMdsInAttestationEnabled:
type: boolean
Expand Down Expand Up @@ -675,15 +677,15 @@ components:
type: string
username:
type: string
domain:
origin:
type: string
userId:
type: string
challenge:
type: string
attenstationRequest:
attestationRequest:
type: string
attenstationResponse:
attestationResponse:
type: string
uncompressedECPoint:
type: string
Expand All @@ -706,8 +708,28 @@ components:
signatureAlgorithm:
type: integer
format: int32
applicationId:
rpId:
type: string
backupStateFlag:
type: boolean
backupEligibilityFlag:
type: boolean
attestedCredentialDataFlag:
type: boolean
extensionDataFlag:
type: boolean
userVerifiedFlag:
type: boolean
userPresentFlag:
type: boolean
authentictatorAttachment:
type: string
credId:
type: string
transports:
type: array
items:
type: string
Fido2RegistrationEntry:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ public void setUserPassword(String userPassword) {
@Override
public String toString() {
return "CustomUser [inum=" + inum + ", mail=" + mail + ", displayName=" + displayName
+ ", givenName=" + givenName + ", userPassword=" + userPassword + "]";
+ ", givenName=" + givenName + "]";
}





}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ public void setCustomAttributes(List<CustomObjectAttribute> customAttributes) {

@Override
public String toString() {
return "UserPatchRequest [jsonPatchString=" + jsonPatchString + ", customAttributes=" + customAttributes + "]";
return "UserPatchRequest [jsonPatchString=" + jsonPatchString + "]";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -239,24 +239,23 @@ public User getUserBasedOnInum(String inum) {
}

private User updateCustomAttributes(User user, List<CustomObjectAttribute> customAttributes) {
logger.info("Custom Attributes to update for - user:{}, customAttributes:{} ", user, customAttributes);
logger.info("Custom Attributes to update for - user:{} ", user);

if (customAttributes == null || customAttributes.isEmpty()) {
return user;
}

//validate custom attribute validation
validateAttributes(customAttributes);

for (CustomObjectAttribute attribute : customAttributes) {
CustomObjectAttribute existingAttribute = userService.getCustomAttribute(user, attribute.getName());
logger.debug("Existing CustomAttributes with existingAttribute:{} ", existingAttribute);
logger.debug("Existing CustomAttributes with existingAttribute.getName():{} ", existingAttribute.getName());

// add
if (existingAttribute == null) {
boolean result = userService.addUserAttribute(user, attribute.getName(), attribute.getValues(),
attribute.isMultiValued());
logger.debug("Result of adding CustomAttributes attribute:{} , result:{} ", attribute, result);
logger.debug("Result of adding CustomAttributes attribute.getName():{} , result:{} ", attribute.getName(), result);
}
// remove attribute
else if (attribute.getValue() == null || attribute.getValues() == null) {
Expand All @@ -268,9 +267,6 @@ else if (attribute.getValue() == null || attribute.getValues() == null) {
existingAttribute.setMultiValued(attribute.isMultiValued());
existingAttribute.setValues(attribute.getValues());
}
// Final attribute
logger.info("Finally user CustomAttributes user.getCustomAttributes:{} ", user.getCustomAttributes());

}

return user;
Expand Down Expand Up @@ -442,8 +438,7 @@ public String getPersistenceType() {
}

public User addUser(User user, boolean active) {
logger.info("\n Creating user:{}, user.getCustomAttributes():{}, active:{}", user, user.getCustomAttributes(),
active);
logger.info("\n Creating user:{}, active:{}", user, active);
user = userService.addUser(user, active);
logger.info("New user:{}\n", user);
// remove inactive claims
Expand All @@ -459,7 +454,7 @@ public User addUser(User user, boolean active) {
}

public User updateUser(User user) {
logger.info("\n Updating user:{}, user.getCustomAttributes():{}", user, user.getCustomAttributes());
logger.info("\n Updating user:{}", user);
user = userService.updateUser(user);
logger.info("Updated user:{} \n", user);
// remove inactive claims
Expand All @@ -481,15 +476,14 @@ public List<User> verifyCustomAttributes(List<User> users) {
}
for (User user : users) {
List<CustomObjectAttribute> customAttributes = user.getCustomAttributes();
logger.debug("customAttributes: {}", customAttributes);
// remove inactive attributes
removeInActiveCustomAttribute(customAttributes);
}
return users;
}

public List<CustomObjectAttribute> removeInActiveCustomAttribute(List<CustomObjectAttribute> customAttributes) {
logger.info("User customAttributes: {}", customAttributes);

if (customAttributes == null || customAttributes.isEmpty()) {
return customAttributes;
}
Expand Down Expand Up @@ -525,14 +519,12 @@ private String getDnForAttribute(String inum) {
}

public void validateAttributes(List<CustomObjectAttribute> customAttributes) {
logger.info("\n **** Validate customAttributes: {}", customAttributes);
if (customAttributes == null || customAttributes.isEmpty()) {
return;
}
StringBuilder sb = new StringBuilder();
for (CustomObjectAttribute customObjectAttribute : customAttributes) {
logger.info("customObjectAttribute:{}, customObjectAttribute.getName():{}", customObjectAttribute,
customObjectAttribute.getName());
logger.info("customObjectAttribute.getName():{}", customObjectAttribute.getName());
JansAttribute attribute = attributeService.getAttributeByName(customObjectAttribute.getName());
AttributeValidation validation = null;
if (attribute != null) {
Expand All @@ -559,18 +551,16 @@ public void validateAttributes(List<CustomObjectAttribute> customAttributes) {

private String validateCustomAttributes(CustomObjectAttribute customObjectAttribute,
AttributeValidation attributeValidation) {
logger.info("Validate customObjectAttribute:{}, attributeValidation:{}", customObjectAttribute,
attributeValidation);
logger.info("Validate attributeValidation:{}", attributeValidation);

StringBuilder sb = new StringBuilder();
if (customObjectAttribute == null || attributeValidation == null) {
return sb.toString();
}

String attributeName = customObjectAttribute.getName();
try {

String attributeValue = String.valueOf(customObjectAttribute.getValue());
logger.info("Validate attributeName:{}, attributeValue:{}", attributeName, attributeValue);
if (StringUtils.isBlank(attributeValue)) {
return sb.toString();

Expand All @@ -579,8 +569,8 @@ private String validateCustomAttributes(CustomObjectAttribute customObjectAttrib
Integer maxValue = attributeValidation.getMaxLength();
String regexpValue = attributeValidation.getRegexp();
logger.info(
"Validate attributeValue:{}, attributeValue.length():{}, attributeValidation.getMinLength():{}, attributeValidation.getMaxLength():{}, attributeValidation.getRegexp():{}",
attributeValue, attributeValue.length(), attributeValidation.getMinLength(),
"Validate attributeValue.length():{}, attributeValidation.getMinLength():{}, attributeValidation.getMaxLength():{}, attributeValidation.getRegexp():{}",
attributeValue.length(), attributeValidation.getMinLength(),
attributeValidation.getMaxLength(), attributeValidation.getRegexp());

// minvalue Validation
Expand Down
Loading

0 comments on commit fdfd7a6

Please sign in to comment.