forked from camunda/camunda-bpm-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(engine): introduce password policies for engine-managed user
* a policy that enforces password length and complexity is enabled by default * policies can be created via Java API * an engine can be configured to use a custom policy or don't use any policy related to CAM-9929, CAM-9930
- Loading branch information
Showing
19 changed files
with
812 additions
and
22 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...engine-rest/src/main/java/org/camunda/bpm/engine/rest/dto/passwordPolicy/PasswordDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright © 2013-2019 camunda services GmbH and various authors (info@camunda.com) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.camunda.bpm.engine.rest.dto.passwordPolicy; | ||
|
||
/** | ||
* @author Miklas Boskamp | ||
*/ | ||
public class PasswordDto { | ||
|
||
private String password; | ||
|
||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
public void setPassword(String password) { | ||
this.password = password; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...-rest/src/main/java/org/camunda/bpm/engine/rest/dto/passwordPolicy/PasswordPolicyDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright © 2013-2019 camunda services GmbH and various authors (info@camunda.com) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.camunda.bpm.engine.rest.dto.passwordPolicy; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.camunda.bpm.engine.pwpolicy.PasswordPolicyRule; | ||
|
||
/** | ||
* @author Miklas Boskamp | ||
*/ | ||
public class PasswordPolicyDto { | ||
private List<PasswordPolicyRuleDto> rules = new ArrayList<PasswordPolicyRuleDto>(); | ||
|
||
// transformers | ||
|
||
public static PasswordPolicyDto fromPasswordPolicyRules(List<PasswordPolicyRule> rules) { | ||
PasswordPolicyDto poilicy = new PasswordPolicyDto(); | ||
|
||
for (PasswordPolicyRule rule : rules) { | ||
poilicy.rules.add(PasswordPolicyRuleDto.fromRule(rule)); | ||
} | ||
return poilicy; | ||
} | ||
|
||
// getters / setters | ||
|
||
public List<PasswordPolicyRuleDto> getRules() { | ||
return rules; | ||
} | ||
|
||
public void setRules(List<PasswordPolicyRuleDto> rules) { | ||
this.rules = rules; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...t/src/main/java/org/camunda/bpm/engine/rest/dto/passwordPolicy/PasswordPolicyRuleDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright © 2013-2019 camunda services GmbH and various authors (info@camunda.com) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.camunda.bpm.engine.rest.dto.passwordPolicy; | ||
|
||
import java.util.Map; | ||
|
||
import org.camunda.bpm.engine.pwpolicy.PasswordPolicyRule; | ||
|
||
/** | ||
* @author Miklas Boskamp | ||
*/ | ||
public class PasswordPolicyRuleDto { | ||
private String placeholder; | ||
private Map<String, String> parameter; | ||
|
||
// transformers | ||
|
||
public static PasswordPolicyRuleDto fromRule(PasswordPolicyRule rule) { | ||
PasswordPolicyRuleDto dto = new PasswordPolicyRuleDto(); | ||
dto.setPlaceholder(rule.getPlaceholder()); | ||
dto.setParameter(rule.getParameter()); | ||
return dto; | ||
} | ||
|
||
// getters / setters | ||
|
||
public String getPlaceholder() { | ||
return placeholder; | ||
} | ||
|
||
public void setPlaceholder(String placeholder) { | ||
this.placeholder = placeholder; | ||
} | ||
|
||
public Map<String, String> getParameter() { | ||
return parameter; | ||
} | ||
|
||
public void setParameter(Map<String, String> parameter) { | ||
this.parameter = parameter; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
engine/src/main/java/org/camunda/bpm/engine/impl/pwpolicy/DefaultPasswordPolicyImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright © 2013-2019 camunda services GmbH and various authors (info@camunda.com) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.camunda.bpm.engine.impl.pwpolicy; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.camunda.bpm.engine.pwpolicy.PasswordPolicy; | ||
import org.camunda.bpm.engine.pwpolicy.PasswordPolicyRule; | ||
|
||
/** | ||
* @author Miklas Boskamp | ||
*/ | ||
public class DefaultPasswordPolicyImpl implements PasswordPolicy { | ||
|
||
// password length | ||
public static final int MIN_LENGTH = 10; | ||
// password complexity | ||
public static final int MIN_LOWERCASE = 1; | ||
public static final int MIN_UPPERCSE = 1; | ||
public static final int MIN_DIGIT = 1; | ||
public static final int MIN_SPECIAL = 1; | ||
|
||
private final List<PasswordPolicyRule> rules = new ArrayList<PasswordPolicyRule>(); | ||
|
||
public DefaultPasswordPolicyImpl() { | ||
rules.add(new PasswordPolicyLengthRuleImpl(MIN_LENGTH)); | ||
rules.add(new PasswordPolicyLowerCaseRuleImpl(MIN_LOWERCASE)); | ||
rules.add(new PasswordPolicyUpperCaseRuleImpl(MIN_UPPERCSE)); | ||
rules.add(new PasswordPolicyDigitRuleImpl(MIN_DIGIT)); | ||
rules.add(new PasswordPolicySpecialCharacterRuleImpl(MIN_SPECIAL)); | ||
} | ||
|
||
@Override | ||
public List<PasswordPolicyRule> getRules() { | ||
return this.rules; | ||
} | ||
} |
Oops, something went wrong.