Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sucurity question authN tests for REST API
- Loading branch information
Showing
16 changed files
with
188 additions
and
5 deletions.
There are no files selected for viewing
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
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
30 changes: 30 additions & 0 deletions
30
testing/rest/src/test/java/com/evolveum/midpoint/testing/rest/TestRestServiceJsonSecQ.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,30 @@ | ||
package com.evolveum.midpoint.testing.rest; | ||
|
||
import org.apache.cxf.jaxrs.client.WebClient; | ||
|
||
public class TestRestServiceJsonSecQ extends TestRestServiceJson{ | ||
|
||
|
||
@Override | ||
protected void createAuthorizationHeader(WebClient client, String username, String password) { | ||
|
||
if (username == null) { | ||
return; | ||
} | ||
|
||
String authzHeader = "{" | ||
+ "\"user\" : \""+ username +"\"," | ||
+ "\"answer\" : [" | ||
+ "{ " | ||
+ "\"qid\" : \"http://midpoint.evolveum.com/xml/ns/public/security/question-2#q001\"," | ||
+ "\"qans\" : \"" + (password == null ? "" : password) + "\"" | ||
+ "}" | ||
+ "]" | ||
+ "}"; | ||
|
||
String authorizationHeader = "SecQ " | ||
+ org.apache.cxf.common.util.Base64Utility.encode((authzHeader).getBytes()); | ||
client.header("Authorization", authorizationHeader); | ||
|
||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright (c) 2014-2016 Evolveum | ||
~ | ||
~ 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. | ||
--> | ||
|
||
<securityPolicy oid="28bf845a-b107-11e3-85bc-001e8c717e5b" | ||
xmlns='http://midpoint.evolveum.com/xml/ns/public/common/common-3'> | ||
<name>Security Policy</name> | ||
<credentials> | ||
<password> | ||
<maxAge>P30D</maxAge> | ||
<lockoutMaxFailedAttempts>3</lockoutMaxFailedAttempts> | ||
<lockoutFailedAttemptsDuration>PT3M</lockoutFailedAttemptsDuration> | ||
<lockoutDuration>PT15M</lockoutDuration> | ||
</password> | ||
<nonce> | ||
<maxAge>P30D</maxAge> | ||
<lockoutMaxFailedAttempts>3</lockoutMaxFailedAttempts> | ||
<lockoutFailedAttemptsDuration>PT3M</lockoutFailedAttemptsDuration> | ||
<lockoutDuration>PT15M</lockoutDuration> | ||
</nonce> | ||
<securityQuestions> | ||
<maxAge>P30D</maxAge> | ||
<lockoutMaxFailedAttempts>3</lockoutMaxFailedAttempts> | ||
<lockoutFailedAttemptsDuration>PT3M</lockoutFailedAttemptsDuration> | ||
<lockoutDuration>PT15M</lockoutDuration> | ||
<questionNumber>1</questionNumber> | ||
<question> | ||
<identifier>http://midpoint.evolveum.com/xml/ns/public/security/question-2#q001</identifier> | ||
<enabled>true</enabled> | ||
<questionText>How much wood would a woodchuck chuck if woodchuck could chuck wood?</questionText> | ||
</question> | ||
<question> | ||
<identifier>http://midpoint.evolveum.com/xml/ns/public/security/question-2#q002</identifier> | ||
<questionText>What is your mother's best friend's uncle's grandaughter's dog's mother maiden name?</questionText> | ||
</question> | ||
<question> | ||
<identifier>http://midpoint.evolveum.com/xml/ns/public/security/question-2#q003</identifier> | ||
<enabled>true</enabled> | ||
<questionText>What's your favorite color?</questionText> | ||
</question> | ||
<question> | ||
<identifier>http://midpoint.evolveum.com/xml/ns/public/security/question-2#q004</identifier> | ||
<enabled>false</enabled> | ||
<questionText>What's your favorite film?</questionText> | ||
</question> | ||
</securityQuestions> | ||
</credentials> | ||
</securityPolicy> |
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
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