├── .github
└── workflows
│ └── github-actions.yml
├── .gitignore
├── .pre-commit-config.yaml
├── Examples
├── groovy
│ ├── getFactorsForUser
│ ├── validatePhoneOTP
│ └── validateSMSOTP
└── java
│ └── org
│ └── secureauth
│ └── restapi
│ └── examples
│ ├── AdaptiveAuth.java
│ ├── GetFactorsForUser.java
│ ├── SendAndValidateSMS.java
│ └── SendPushRequest.java
├── Jenkinsfile
├── Jersey-Legal_information_files
├── bootstrap.min.js
├── close.png
├── ga.js
├── glassfish_logo.png
├── highlight.min.js
├── jersey_logo.png
├── jquery.ba-bbq.min.js
├── jquery.min.js
├── jquery.smooth-scroll.min.js
├── lightbox.js
├── loading.gif
└── reflow-skin.js
├── LICENSE.txt
├── README.md
├── build.gradle
├── buildLocal.bat
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── javadocs
├── allclasses-frame.html
├── allclasses-noframe.html
├── constant-values.html
├── deprecated-list.html
├── help-doc.html
├── index-all.html
├── index.html
├── org
│ └── secureauth
│ │ └── sarestapi
│ │ ├── SAAccess.html
│ │ ├── data
│ │ ├── BehavioralBio
│ │ │ ├── BehaveBioRequest.html
│ │ │ ├── BehaveBioResult.html
│ │ │ ├── BehaveBioResults.html
│ │ │ ├── package-frame.html
│ │ │ ├── package-summary.html
│ │ │ └── package-tree.html
│ │ ├── DFP.html
│ │ ├── Factoring.html
│ │ ├── Factors.html
│ │ ├── Geoloc.html
│ │ ├── IPEval.html
│ │ ├── IPEvaluation.html
│ │ ├── PushAcceptDetails.html
│ │ ├── PushAcceptStatus.html
│ │ ├── Requests
│ │ │ ├── AccessHistoryRequest.html
│ │ │ ├── AdaptiveAuthRequest.AAParameters.html
│ │ │ ├── AdaptiveAuthRequest.html
│ │ │ ├── AuthRequest.html
│ │ │ ├── BehaveBioResetRequest.html
│ │ │ ├── DFPConfirmRequest.html
│ │ │ ├── DFPValidateRequest.html
│ │ │ ├── IPEvalRequest.html
│ │ │ ├── PushToAcceptRequest.html
│ │ │ ├── UserPasswordRequest.html
│ │ │ ├── package-frame.html
│ │ │ ├── package-summary.html
│ │ │ └── package-tree.html
│ │ ├── Response
│ │ │ ├── AdaptiveAuthResponse.html
│ │ │ ├── BaseResponse.html
│ │ │ ├── BehaveBioResponse.html
│ │ │ ├── DFPConfirmResponse.html
│ │ │ ├── DFPValidateResponse.html
│ │ │ ├── FactorsResponse.html
│ │ │ ├── GroupAssociationResponse.html
│ │ │ ├── JSObjectResponse.html
│ │ │ ├── ResponseObject.html
│ │ │ ├── UserProfileResponse.html
│ │ │ ├── package-frame.html
│ │ │ ├── package-summary.html
│ │ │ └── package-tree.html
│ │ ├── SAAuth.html
│ │ ├── SABaseURL.html
│ │ ├── UserProfile
│ │ │ ├── NewUserProfile.html
│ │ │ ├── NewUserProfileProperties.html
│ │ │ ├── UserProfile.html
│ │ │ ├── UserProfileAccessHistories.html
│ │ │ ├── UserProfileAccessHistory.html
│ │ │ ├── UserProfileGroups.html
│ │ │ ├── UserProfileKB.html
│ │ │ ├── UserProfileKBAKBQ.html
│ │ │ ├── UserProfileProperty.html
│ │ │ ├── UserToGroups.html
│ │ │ ├── UsersToGroup.html
│ │ │ ├── package-frame.html
│ │ │ ├── package-summary.html
│ │ │ └── package-tree.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
│ │ ├── filters
│ │ ├── SACheckRequestFilter.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
│ │ ├── interfaces
│ │ ├── AdaptiveAuthenticationInterface.html
│ │ ├── AuthenticationInterface.html
│ │ ├── BehaveBioInterface.html
│ │ ├── DeviceRecognitionInterface.html
│ │ ├── IDMInterface.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ ├── package-tree.html
│ │ ├── queries
│ │ ├── AccessHistoryQuery.html
│ │ ├── AuthQuery.html
│ │ ├── BehaveBioQuery.html
│ │ ├── DFPQuery.html
│ │ ├── FactorsQuery.html
│ │ ├── IDMQueries.html
│ │ ├── IPEvalQuery.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
│ │ ├── resources
│ │ ├── SAExecuter.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ ├── package-tree.html
│ │ └── s.html
│ │ └── util
│ │ ├── HMACUtil.html
│ │ ├── JSONUtil.html
│ │ ├── RestApiHeader.html
│ │ ├── XMLUtil.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
├── overview-frame.html
├── overview-summary.html
├── overview-tree.html
├── package-list
├── script.js
└── stylesheet.css
├── settings.gradle
└── src
├── main
├── java
│ └── org
│ │ └── secureauth
│ │ └── sarestapi
│ │ ├── ISAAccess.java
│ │ ├── SAAccess.java
│ │ ├── data
│ │ ├── BehavioralBio
│ │ │ ├── BehaveBioRequest.java
│ │ │ ├── BehaveBioResult.java
│ │ │ └── BehaveBioResults.java
│ │ ├── DFP
│ │ │ ├── DFP.java
│ │ │ ├── Fingerprint.java
│ │ │ ├── Fingerprint_.java
│ │ │ ├── TouchSupport.java
│ │ │ ├── UaBrowser.java
│ │ │ ├── UaCPU.java
│ │ │ ├── UaDevice.java
│ │ │ ├── UaEngine.java
│ │ │ └── UaOS.java
│ │ ├── Factors.java
│ │ ├── Geoloc.java
│ │ ├── IPEval.java
│ │ ├── IPEvaluation.java
│ │ ├── NumberProfile
│ │ │ ├── CarrierInfo.java
│ │ │ ├── CarrierStatus.java
│ │ │ ├── CurrentCarrier.java
│ │ │ ├── NumberProfileResult.java
│ │ │ └── OriginalCarrier.java
│ │ ├── PreferredMFA.java
│ │ ├── PushAcceptDetails.java
│ │ ├── PushAcceptStatus.java
│ │ ├── Requests
│ │ │ ├── AccessHistoryRequest.java
│ │ │ ├── AdaptiveAuthRequest.java
│ │ │ ├── AuthRequest.java
│ │ │ ├── BehaveBioResetRequest.java
│ │ │ ├── DFPConfirmRequest.java
│ │ │ ├── DFPScoreRequest.java
│ │ │ ├── DFPValidateRequest.java
│ │ │ ├── DeleteUserRequest.java
│ │ │ ├── IPEvalRequest.java
│ │ │ ├── LinkToAcceptFactory.java
│ │ │ ├── NumberProfileRequest.java
│ │ │ ├── NumberProfileUpdateRequest.java
│ │ │ ├── PushToAcceptBiometricsRequest.java
│ │ │ ├── PushToAcceptRequest.java
│ │ │ ├── PushToAcceptRequestsFactory.java
│ │ │ ├── StatusRequest.java
│ │ │ ├── ThrottleRequest.java
│ │ │ ├── UserPasswordRequest.java
│ │ │ └── ValidateOTPRequest.java
│ │ ├── Response
│ │ │ ├── AdaptiveAuthResponse.java
│ │ │ ├── BaseResponse.java
│ │ │ ├── BehaveBioResponse.java
│ │ │ ├── DFPConfirmResponse.java
│ │ │ ├── DFPValidateResponse.java
│ │ │ ├── FactorsResponse.java
│ │ │ ├── GroupAssociationResponse.java
│ │ │ ├── JSObjectResponse.java
│ │ │ ├── NumberProfileResponse.java
│ │ │ ├── ResponseObject.java
│ │ │ ├── StatefulResponseObject.java
│ │ │ ├── ThrottleResponse.java
│ │ │ ├── UserProfileResponse.java
│ │ │ └── ValidateOTPResponse.java
│ │ ├── SAAuth.java
│ │ ├── SABaseURL.java
│ │ ├── SAConfig.java
│ │ └── UserProfile
│ │ │ ├── NewUserProfile.java
│ │ │ ├── NewUserProfileProperties.java
│ │ │ ├── UserProfile.java
│ │ │ ├── UserProfileAccessHistories.java
│ │ │ ├── UserProfileAccessHistory.java
│ │ │ ├── UserProfileGroups.java
│ │ │ ├── UserProfileKB.java
│ │ │ ├── UserProfileKBAKBQ.java
│ │ │ ├── UserProfileProperties.java
│ │ │ ├── UserProfileProperty.java
│ │ │ ├── UserToGroups.java
│ │ │ └── UsersToGroup.java
│ │ ├── exception
│ │ └── SARestAPIException.java
│ │ ├── filters
│ │ └── SACheckRequestFilter.java
│ │ ├── guid
│ │ ├── GUIDStrategy.java
│ │ └── XRequestIDFilter.java
│ │ ├── interfaces
│ │ ├── AdHocInterface.java
│ │ ├── AdaptiveAuthenticationInterface.java
│ │ ├── AuthenticationInterface.java
│ │ ├── BehaveBioInterface.java
│ │ ├── DeviceRecognitionInterface.java
│ │ ├── IDMInterface.java
│ │ └── PhoneNumberProfileInterface.java
│ │ ├── main
│ │ ├── Main.java
│ │ └── api
│ │ │ ├── DiagnosticApi.java
│ │ │ ├── HelpBuilder.java
│ │ │ ├── NoImplementedYetApi.java
│ │ │ ├── Parameters.java
│ │ │ ├── fingerprint
│ │ │ └── DFPApi.java
│ │ │ └── users
│ │ │ ├── UsersProfileApi.java
│ │ │ └── UsersProfileQPApi.java
│ │ ├── queries
│ │ ├── AccessHistoryQuery.java
│ │ ├── AuthQuery.java
│ │ ├── BehaveBioQuery.java
│ │ ├── DFPQuery.java
│ │ ├── FactorsQuery.java
│ │ ├── IDMQueries.java
│ │ ├── IPEvalQuery.java
│ │ ├── NumberProfileQuery.java
│ │ ├── StatusQuery.java
│ │ ├── ThrottleQuery.java
│ │ └── ValidateOTPQuery.java
│ │ ├── resources
│ │ ├── Resource.java
│ │ └── SAExecuter.java
│ │ ├── ssl
│ │ └── SATrustManagerFactory.java
│ │ └── util
│ │ ├── HMACUtil.java
│ │ ├── JSONUtil.java
│ │ ├── RestApiHeader.java
│ │ ├── SAFactory.java
│ │ ├── TimeUtils.java
│ │ └── XMLUtil.java
└── resources
│ └── configuration
│ ├── configuration.properties
│ └── dfp
│ └── fingerprint.json
└── test
├── java
└── org
│ └── secureauth
│ ├── restapi
│ └── test
│ │ ├── Impl
│ │ ├── AdHocImpl.java
│ │ ├── AdaptiveAuthenticationImpl.java
│ │ ├── AuthenticationImpl.java
│ │ ├── BehaveBioImpl.java
│ │ ├── DeviceRecognitionImpl.java
│ │ ├── IDMImpl.java
│ │ └── PhoneNumberProfileImpl.java
│ │ └── SAAccessTDD.java
│ └── sarestapi
│ ├── BaseResponseUtils.java
│ ├── SAAccessTest.java
│ ├── guid
│ └── SAAccessUnitTest.java
│ ├── ssl
│ ├── SATrustManagerFactoryTest.java
│ └── X509CertificateMockedFactory.java
│ ├── stateful
│ └── SAAccessUnitTest.java
│ └── util
│ ├── JSONUtilTest.java
│ ├── Property.java
│ ├── RestApiHeaderTest.java
│ └── RetrievePropertiesUtils.java
└── resources
├── log4j2.xml
├── mappings
├── realm01_api_v1_auth-580bc69f-5f64-4435-bbfc-9dceef9bc544.json
├── realm01_api_v1_auth-dac77105-c0fe-4e2f-b9a1-6fee45412788.json
└── realm01_api_v1_auth_41f43a30-510b-42a9-8c2c-c04aaf96a18e-15839fba-cd27-4016-899d-bf08f37cb035.json
└── test.properties
/.github/workflows/github-actions.yml:
--------------------------------------------------------------------------------
1 | name: GitHub Actions
2 | run-name: ${{ github.ref_name }} GitHub Actions 🚀
3 | on: [push, pull_request]
4 | jobs:
5 | Build-Publish:
6 | runs-on: ubuntu-latest
7 | steps:
8 | - name: Check out repository code ⬇️
9 | uses: actions/checkout@v4
10 | - uses: actions/setup-java@v3
11 | with:
12 | distribution: temurin
13 | java-version: 11
14 | - name: Setup Gradle 🐘
15 | uses: gradle/gradle-build-action@v2
16 | - name: Make gradlew executable
17 | run: chmod +x ./gradlew
18 | - name: Run build with Gradle Wrapper 🏃
19 | run: ./gradlew build -x test
20 | - name: Run tests 🧑⚕️
21 | run: ./gradlew test
22 | # Might want to remove this step
23 | - name: Archive production artifacts ⬆️
24 | if: ${{ github.event_name == 'pull_request' && github.pull_request_target == 'master' }}
25 | uses: actions/upload-artifact@v3
26 | with:
27 | name: Artifacts
28 | path: ./build/libs/saRestApi-*.jar
29 | - uses: jfrog/setup-jfrog-cli@v3
30 | env:
31 | JF_URL: ${{ secrets.ARTIFACTORY_URL }}
32 | JF_USER: ${{ secrets.JFROG_USERNAME }}
33 | JF_PASSWORD: ${{ secrets.JFROG_PASSWORD }}
34 | - run: |
35 | # This command adds a new server configuration to the JFrog CLI
36 | - name: Upload to artifactory
37 | if: ${{ github.event_name == 'pull_request' }}
38 | run: |
39 | export BUILD_NAME="saidp-sdk-java"
40 | export BUILD_MODULE="sdk-java"
41 | export BUILD_NUMBER="1"
42 |
43 | export VERSION=$(cat gradle.properties | grep -Po "\d*\.\d*\.\d*\.\d*")
44 |
45 | jf rt upload "./build/libs/saRestApi-*.jar" radius-release-local/saRestApi/$VERSION/saRestApi-$VERSION.jar --build-name $BUILD_NAME --build-number $BUILD_NUMBER --module $BUILD_MODULE
46 | jf rt build-publish $BUILD_NAME $BUILD_NUMBER
47 | - run: echo "🍏 This job's status is ${{ job.status }}."
48 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 | /.gradle
3 | /.classpath
4 | /.project
5 | /.settings
6 | /logs/
7 | /build/
8 | /out/
9 | /.idea/
10 | *.iml
--------------------------------------------------------------------------------
/.pre-commit-config.yaml:
--------------------------------------------------------------------------------
1 | repos:
2 | - repo: https://github.com/pre-commit/pre-commit-hooks
3 | rev: v3.2.0
4 | hooks:
5 | - id: trailing-whitespace
6 | - id: end-of-file-fixer
7 | - id: check-yaml
8 | - id: check-added-large-files
9 |
--------------------------------------------------------------------------------
/Examples/groovy/getFactorsForUser:
--------------------------------------------------------------------------------
1 | import org.secureauth.sarestapi.SAAccess
2 |
3 | /**
4 | * @author rrowcliffe@secureauth.com
5 | *
6 | * SAAccess is a class that allows access to the SecureAuth REST API. The intention is to provide an easy method to access
7 | * the Secureauth Authentication Rest Services.
8 | *
9 | *
10 | *
11 | * Copyright 2015 SecureAuth Corporation
12 | *
13 | * Licensed under the Apache License, Version 2.0 (the "License");
14 | * you may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at
16 | *
17 | * http://www.apache.org/licenses/LICENSE-2.0
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | */
26 |
27 | def user = "user";
28 | def realm = "secureauth2";
29 | def applicationID = "########################";
30 | def applicationKey = "#####################################";
31 | def appliance = "example.domain.com"
32 | def port = "443"
33 | def ssl = true
34 |
35 | SAAccess saAccess = new SAAccess(appliance,port,ssl,realm, applicationID, applicationKey);
36 |
37 | def factors = saAccess.factorsByUser(user)
38 |
39 | if(factors!= null){
40 | println(factors.toString())
41 | }
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/Examples/groovy/validatePhoneOTP:
--------------------------------------------------------------------------------
1 | import org.secureauth.sarestapi.SAAccess
2 |
3 | /**
4 | * @author rrowcliffe@secureauth.com
5 | *
6 | * SAAccess is a class that allows access to the SecureAuth REST API. The intention is to provide an easy method to access
7 | * the Secureauth Authentication Rest Services.
8 | *
9 | *
10 | *
11 | * Copyright 2015 SecureAuth Corporation
12 | *
13 | * Licensed under the Apache License, Version 2.0 (the "License");
14 | * you may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at
16 | *
17 | * http://www.apache.org/licenses/LICENSE-2.0
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | */
26 |
27 | def user = "user";
28 | def realm = "secureauth2";
29 | def applicationID = "########################";
30 | def applicationKey = "#####################################";
31 | def appliance = "example.domain.com"
32 | def port = "443"
33 | def ssl = true
34 |
35 | SAAccess saAccess = new SAAccess(appliance,port,ssl,realm, applicationID, applicationKey);
36 |
37 | def factors = saAccess.factorsByUser(user)
38 |
39 |
40 | for(factor in factors.getFactors()){
41 | //Use phone number from Phone2
42 | if(factor.id.equalsIgnoreCase("phone2")){
43 | if(factor.capabilities.contains("call")){
44 | println saAccess.deliverOTPByPhone(user,factor.getId())
45 | }
46 | }
47 |
48 | }
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/Examples/groovy/validateSMSOTP:
--------------------------------------------------------------------------------
1 | import org.secureauth.sarestapi.SAAccess
2 |
3 | /**
4 | * @author rrowcliffe@secureauth.com
5 | *
6 | * SAAccess is a class that allows access to the SecureAuth REST API. The intention is to provide an easy method to access
7 | * the Secureauth Authentication Rest Services.
8 | *
9 | *
10 | *
11 | * Copyright 2015 SecureAuth Corporation
12 | *
13 | * Licensed under the Apache License, Version 2.0 (the "License");
14 | * you may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at
16 | *
17 | * http://www.apache.org/licenses/LICENSE-2.0
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | */
26 |
27 | def user = "user";
28 | def realm = "secureauth2";
29 | def applicationID = "########################";
30 | def applicationKey = "#####################################";
31 | def appliance = "example.domain.com"
32 | def port = "443"
33 | def ssl = true
34 |
35 | SAAccess saAccess = new SAAccess(appliance,port,ssl,realm, applicationID, applicationKey);
36 |
37 | def factors = saAccess.factorsByUser(user)
38 |
39 |
40 | for(factor in factors.getFactors()){
41 | //Use phone number from Phone2
42 | if(factor.id.equalsIgnoreCase("phone2")){
43 | if(factor.capabilities.contains("sms")){
44 | println saAccess.deliverOTPBySMS(user,factor.getId())
45 | }
46 | }
47 |
48 | }
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/Examples/java/org/secureauth/restapi/examples/AdaptiveAuth.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.restapi.examples;
2 |
3 | import org.secureauth.sarestapi.SAAccess;
4 | import org.secureauth.sarestapi.data.ResponseObject;
5 |
6 | public class AdaptiveAuth {
7 |
8 | // Define our User Variables
9 | private static String user = "user";
10 |
11 | // Required for connectivity to Appliance
12 | private static String applianceHost = "host.example.com";
13 | private static String appliancePort = "443";
14 | private static boolean applianceSSL = true;
15 | private static String realm = "secureauth11";
16 | private static String applicationID = "...........";
17 | private static String applicationKey = "............";
18 |
19 | public static void main(String[] args) throws Exception {
20 | // Create Instance of SAAccess Object
21 | SAAccess saAccess = new SAAccess(applianceHost, appliancePort,
22 | applianceSSL, realm, applicationID, applicationKey);
23 | ResponseObject ro = saAccess.adaptiveAuthQuery(user, "192.168.2.192");
24 | System.out.println(ro);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Jersey-Legal_information_files/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SecureAuthCorp/saidp-sdk-java/4a45e8f692ea04c647493639ab63ef829e546f66/Jersey-Legal_information_files/close.png
--------------------------------------------------------------------------------
/Jersey-Legal_information_files/glassfish_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SecureAuthCorp/saidp-sdk-java/4a45e8f692ea04c647493639ab63ef829e546f66/Jersey-Legal_information_files/glassfish_logo.png
--------------------------------------------------------------------------------
/Jersey-Legal_information_files/jersey_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SecureAuthCorp/saidp-sdk-java/4a45e8f692ea04c647493639ab63ef829e546f66/Jersey-Legal_information_files/jersey_logo.png
--------------------------------------------------------------------------------
/Jersey-Legal_information_files/jquery.smooth-scroll.min.js:
--------------------------------------------------------------------------------
1 | /*! Smooth Scroll - v1.4.6 - 2012-08-23
2 | * Copyright (c) 2012 Karl Swedberg; Licensed MIT, GPL */
3 | (function(a){function f(a){return a.replace(/(:|\.)/g,"\\$1")}var b="1.4.6",c={exclude:[],excludeWithin:[],offset:0,direction:"top",scrollElement:null,scrollTarget:null,beforeScroll:function(){},afterScroll:function(){},easing:"swing",speed:400,autoCoefficent:2},d=function(b){var c=[],d=!1,e=b.dir&&b.dir=="left"?"scrollLeft":"scrollTop";return this.each(function(){if(this==document||this==window)return;var b=a(this);b[e]()>0?c.push(this):(b[e](1),d=b[e]()>0,d&&c.push(this),b[e](0))}),c.length||this.each(function(a){this.nodeName==="BODY"&&(c=[this])}),b.el==="first"&&c.length>1&&(c=[c[0]]),c},e="ontouchend"in document;a.fn.extend({scrollable:function(a){var b=d.call(this,{dir:a});return this.pushStack(b)},firstScrollable:function(a){var b=d.call(this,{el:"first",dir:a});return this.pushStack(b)},smoothScroll:function(b){b=b||{};var c=a.extend({},a.fn.smoothScroll.defaults,b),d=a.smoothScroll.filterPath(location.pathname);return this.unbind("click.smoothscroll").bind("click.smoothscroll",function(b){var e=this,g=a(this),h=c.exclude,i=c.excludeWithin,j=0,k=0,l=!0,m={},n=location.hostname===e.hostname||!e.hostname,o=c.scrollTarget||(a.smoothScroll.filterPath(e.pathname)||d)===d,p=f(e.hash);if(!c.scrollTarget&&(!n||!o||!p))l=!1;else{while(l&&j
58 | // and HTML5 version with
59 | $('div.source pre, pre code').each(function(i, e) {hljs.highlightBlock(e)});
60 | }
61 |
62 | })
63 |
64 | }(window.jQuery)
65 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015, SecureAuth
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5 |
6 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 |
8 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 |
10 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11 |
12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
14 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/buildLocal.bat:
--------------------------------------------------------------------------------
1 | :: this batch is used internally in the corporation to build and export a local version in maven local
2 | @echo off
3 | ./gradlew.bat clean -PuseMavenLocal test publishToMavenLocal
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | currentVersion=1.1.0.13
2 | artifactory_repo=https://secureauthcloud.jfrog.io/artifactory/
3 | artifactory_user=
4 | artifactory_key=
5 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SecureAuthCorp/saidp-sdk-java/4a45e8f692ea04c647493639ab63ef829e546f66/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/javadocs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | saRestApi-sdk 1.0.0 API
7 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | JavaScript is disabled on your browser.
69 |
70 | Frame Alert
71 | This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to Non-frame version .
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/javadocs/org/secureauth/sarestapi/data/BehavioralBio/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | org.secureauth.sarestapi.data.BehavioralBio (saRestApi-sdk 1.0.0 API)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/javadocs/org/secureauth/sarestapi/data/Requests/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | org.secureauth.sarestapi.data.Requests (saRestApi-sdk 1.0.0 API)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/javadocs/org/secureauth/sarestapi/data/Response/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | org.secureauth.sarestapi.data.Response (saRestApi-sdk 1.0.0 API)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/javadocs/org/secureauth/sarestapi/data/UserProfile/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | org.secureauth.sarestapi.data.UserProfile (saRestApi-sdk 1.0.0 API)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/javadocs/org/secureauth/sarestapi/data/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | org.secureauth.sarestapi.data (saRestApi-sdk 1.0.0 API)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/javadocs/org/secureauth/sarestapi/filters/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | org.secureauth.sarestapi.filters (saRestApi-sdk 1.0.0 API)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/javadocs/org/secureauth/sarestapi/interfaces/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | org.secureauth.sarestapi.interfaces (saRestApi-sdk 1.0.0 API)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
Interfaces
15 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/javadocs/org/secureauth/sarestapi/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | org.secureauth.sarestapi (saRestApi-sdk 1.0.0 API)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/javadocs/org/secureauth/sarestapi/queries/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | org.secureauth.sarestapi.queries (saRestApi-sdk 1.0.0 API)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/javadocs/org/secureauth/sarestapi/resources/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | org.secureauth.sarestapi.resources (saRestApi-sdk 1.0.0 API)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/javadocs/org/secureauth/sarestapi/util/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | org.secureauth.sarestapi.util (saRestApi-sdk 1.0.0 API)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/javadocs/overview-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Overview List (saRestApi-sdk 1.0.0 API)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/javadocs/package-list:
--------------------------------------------------------------------------------
1 | org.secureauth.sarestapi
2 | org.secureauth.sarestapi.data
3 | org.secureauth.sarestapi.data.BehavioralBio
4 | org.secureauth.sarestapi.data.Requests
5 | org.secureauth.sarestapi.data.Response
6 | org.secureauth.sarestapi.data.UserProfile
7 | org.secureauth.sarestapi.filters
8 | org.secureauth.sarestapi.interfaces
9 | org.secureauth.sarestapi.queries
10 | org.secureauth.sarestapi.resources
11 | org.secureauth.sarestapi.util
12 |
--------------------------------------------------------------------------------
/javadocs/script.js:
--------------------------------------------------------------------------------
1 | function show(type)
2 | {
3 | count = 0;
4 | for (var key in methods) {
5 | var row = document.getElementById(key);
6 | if ((methods[key] & type) != 0) {
7 | row.style.display = '';
8 | row.className = (count++ % 2) ? rowColor : altColor;
9 | }
10 | else
11 | row.style.display = 'none';
12 | }
13 | updateTabs(type);
14 | }
15 |
16 | function updateTabs(type)
17 | {
18 | for (var value in tabs) {
19 | var sNode = document.getElementById(tabs[value][0]);
20 | var spanNode = sNode.firstChild;
21 | if (value == type) {
22 | sNode.className = activeTableTab;
23 | spanNode.innerHTML = tabs[value][1];
24 | }
25 | else {
26 | sNode.className = tableTab;
27 | spanNode.innerHTML = "" + tabs[value][1] + " ";
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'saRestApi'
2 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/BehavioralBio/BehaveBioRequest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.BehavioralBio;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import org.secureauth.sarestapi.util.JSONUtil;
5 |
6 | import javax.xml.bind.annotation.XmlRootElement;
7 |
8 | /**
9 | * Created by rrowcliffe on 4/30/16.
10 | */
11 | @XmlRootElement
12 | @JsonInclude(JsonInclude.Include.NON_NULL)
13 | public class BehaveBioRequest {
14 |
15 | private String userId;
16 | private String behaviorProfile;
17 | private String hostAddress;
18 | private String userAgent;
19 |
20 | public String getUserId() {
21 | return userId;
22 | }
23 |
24 | public void setUserId(String userId) {
25 | this.userId = userId;
26 | }
27 |
28 | public String getBehaviorProfile() {
29 | return behaviorProfile;
30 | }
31 |
32 | public void setBehaviorProfile(String behaviorProfile) {
33 | this.behaviorProfile = behaviorProfile;
34 | }
35 |
36 | public String getHostAddress() {
37 | return hostAddress;
38 | }
39 |
40 | public void setHostAddress(String hostAddress) {
41 | this.hostAddress = hostAddress;
42 | }
43 |
44 | public String getUserAgent() {
45 | return userAgent;
46 | }
47 |
48 | public void setUserAgent(String userAgent) {
49 | this.userAgent = userAgent;
50 | }
51 |
52 | @Override
53 | public String toString(){
54 | return JSONUtil.convertObjectToJSON(this);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/BehavioralBio/BehaveBioResult.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.BehavioralBio;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import com.fasterxml.jackson.annotation.JsonProperty;
5 |
6 | import javax.xml.bind.annotation.XmlRootElement;
7 |
8 | /**
9 | * Created by rrowcliffe on 4/30/16.
10 | */
11 | @JsonInclude(JsonInclude.Include.NON_NULL)
12 | public class BehaveBioResult {
13 | @JsonProperty("ControlID")
14 | private String controlID;
15 | @JsonProperty("Score")
16 | private double score;
17 | @JsonProperty("Confidence")
18 | private double confidence;
19 | @JsonProperty("Count")
20 | private int count;
21 |
22 | public String getControlID() {
23 | return controlID;
24 | }
25 |
26 | public void setControlID(String controlID) {
27 | this.controlID = controlID;
28 | }
29 |
30 | public double getScore() {
31 | return score;
32 | }
33 |
34 | public void setScore(double score) {
35 | this.score = score;
36 | }
37 |
38 | public double getConfidence() {
39 | return confidence;
40 | }
41 |
42 | public void setConfidence(double confidence) {
43 | this.confidence = confidence;
44 | }
45 |
46 | public int getCount() {
47 | return count;
48 | }
49 |
50 | public void setCount(int count) {
51 | this.count = count;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/BehavioralBio/BehaveBioResults.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.BehavioralBio;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import com.fasterxml.jackson.annotation.JsonProperty;
5 |
6 | import javax.xml.bind.annotation.XmlRootElement;
7 | import javax.xml.bind.annotation.XmlSeeAlso;
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | /**
12 | * Created by rrowcliffe on 5/12/16.
13 | */
14 | @XmlRootElement(name="BehaviorBioResults")
15 | @XmlSeeAlso(BehaveBioResult.class)
16 | @JsonInclude(JsonInclude.Include.NON_NULL)
17 | public class BehaveBioResults {
18 | @JsonProperty("TotalScore")
19 | private double totalScore;
20 | @JsonProperty("TotalConfidence")
21 | private double totalConfidence;
22 | @JsonProperty("Device")
23 | private String device;
24 |
25 | @JsonProperty("Results")
26 | private List results = new ArrayList();
27 |
28 | public double getTotalScore() {
29 | return totalScore;
30 | }
31 |
32 | public void setTotalScore(double totalScore) {
33 | this.totalScore = totalScore;
34 | }
35 |
36 | public double getTotalConfidence() {
37 | return totalConfidence;
38 | }
39 |
40 | public void setTotalConfidence(double totalConfidence) {
41 | this.totalConfidence = totalConfidence;
42 | }
43 |
44 | public String getDevice() {
45 | return device;
46 | }
47 |
48 | public void setDevice(String device) {
49 | this.device = device;
50 | }
51 |
52 | public List getResults() {
53 | return results;
54 | }
55 |
56 | public void setResults(List results) {
57 | this.results = results;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/DFP/DFP.java:
--------------------------------------------------------------------------------
1 |
2 | package org.secureauth.sarestapi.data.DFP;
3 |
4 | import com.fasterxml.jackson.annotation.*;
5 | import org.secureauth.sarestapi.util.JSONUtil;
6 |
7 | import java.util.HashMap;
8 | import java.util.Map;
9 |
10 | @JsonInclude(JsonInclude.Include.NON_NULL)
11 | @JsonPropertyOrder({
12 | "user_id",
13 | "host_address",
14 | "fingerprint"
15 | })
16 | public class DFP {
17 |
18 | @JsonProperty("user_id")
19 | private String userId;
20 | @JsonProperty("host_address")
21 | private String hostAddress;
22 | @JsonProperty("fingerprint")
23 | private Fingerprint fingerprint;
24 | @JsonIgnore
25 | private final Map additionalProperties = new HashMap();
26 |
27 | @JsonProperty("user_id")
28 | public String getUserId() {
29 | return userId;
30 | }
31 |
32 | @JsonProperty("user_id")
33 | public void setUserId(String userId) {
34 | this.userId = userId;
35 | }
36 |
37 | @JsonProperty("host_address")
38 | public String getHostAddress() {
39 | return hostAddress;
40 | }
41 |
42 | @JsonProperty("host_address")
43 | public void setHostAddress(String hostAddress) {
44 | this.hostAddress = hostAddress;
45 | }
46 |
47 | @JsonProperty("fingerprint")
48 | public Fingerprint getFingerprint() {
49 | return fingerprint;
50 | }
51 |
52 | @JsonProperty("fingerprint")
53 | public void setFingerprint(Fingerprint fingerprint) {
54 | this.fingerprint = fingerprint;
55 | }
56 |
57 | @JsonAnyGetter
58 | public Map getAdditionalProperties() {
59 | return this.additionalProperties;
60 | }
61 |
62 | @JsonAnySetter
63 | public void setAdditionalProperty(String name, Object value) {
64 | this.additionalProperties.put(name, value);
65 | }
66 |
67 | @Override
68 | public String toString(){
69 | return JSONUtil.convertObjectToJSON(this);
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/DFP/Fingerprint.java:
--------------------------------------------------------------------------------
1 |
2 | package org.secureauth.sarestapi.data.DFP;
3 |
4 | import com.fasterxml.jackson.annotation.*;
5 |
6 | import java.util.HashMap;
7 | import java.util.Map;
8 |
9 | @JsonInclude(JsonInclude.Include.NON_NULL)
10 | @JsonPropertyOrder({
11 | "fingerprint"
12 | })
13 | public class Fingerprint {
14 |
15 | @JsonProperty("fingerprint")
16 | private Fingerprint_ fingerprint;
17 | @JsonIgnore
18 | private final Map additionalProperties = new HashMap();
19 |
20 | @JsonProperty("fingerprint")
21 | public Fingerprint_ getFingerprint() {
22 | return fingerprint;
23 | }
24 |
25 | @JsonProperty("fingerprint")
26 | public void setFingerprint(Fingerprint_ fingerprint) {
27 | this.fingerprint = fingerprint;
28 | }
29 |
30 | @JsonAnyGetter
31 | public Map getAdditionalProperties() {
32 | return this.additionalProperties;
33 | }
34 |
35 | @JsonAnySetter
36 | public void setAdditionalProperty(String name, Object value) {
37 | this.additionalProperties.put(name, value);
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/DFP/TouchSupport.java:
--------------------------------------------------------------------------------
1 |
2 | package org.secureauth.sarestapi.data.DFP;
3 |
4 | import com.fasterxml.jackson.annotation.*;
5 |
6 | import java.util.HashMap;
7 | import java.util.Map;
8 |
9 | @JsonInclude(JsonInclude.Include.NON_NULL)
10 | @JsonPropertyOrder({
11 | "maxTouchPoints",
12 | "touchEvent",
13 | "touchStart"
14 | })
15 | public class TouchSupport {
16 |
17 | @JsonProperty("maxTouchPoints")
18 | private Integer maxTouchPoints;
19 | @JsonProperty("touchEvent")
20 | private Boolean touchEvent;
21 | @JsonProperty("touchStart")
22 | private Boolean touchStart;
23 | @JsonIgnore
24 | private final Map additionalProperties = new HashMap();
25 |
26 | @JsonProperty("maxTouchPoints")
27 | public Integer getMaxTouchPoints() {
28 | return maxTouchPoints;
29 | }
30 |
31 | @JsonProperty("maxTouchPoints")
32 | public void setMaxTouchPoints(Integer maxTouchPoints) {
33 | this.maxTouchPoints = maxTouchPoints;
34 | }
35 |
36 | @JsonProperty("touchEvent")
37 | public Boolean getTouchEvent() {
38 | return touchEvent;
39 | }
40 |
41 | @JsonProperty("touchEvent")
42 | public void setTouchEvent(Boolean touchEvent) {
43 | this.touchEvent = touchEvent;
44 | }
45 |
46 | @JsonProperty("touchStart")
47 | public Boolean getTouchStart() {
48 | return touchStart;
49 | }
50 |
51 | @JsonProperty("touchStart")
52 | public void setTouchStart(Boolean touchStart) {
53 | this.touchStart = touchStart;
54 | }
55 |
56 | @JsonAnyGetter
57 | public Map getAdditionalProperties() {
58 | return this.additionalProperties;
59 | }
60 |
61 | @JsonAnySetter
62 | public void setAdditionalProperty(String name, Object value) {
63 | this.additionalProperties.put(name, value);
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/DFP/UaBrowser.java:
--------------------------------------------------------------------------------
1 |
2 | package org.secureauth.sarestapi.data.DFP;
3 |
4 | import com.fasterxml.jackson.annotation.*;
5 |
6 | import java.util.HashMap;
7 | import java.util.Map;
8 |
9 | @JsonInclude(JsonInclude.Include.NON_NULL)
10 | @JsonPropertyOrder({
11 | "name",
12 | "version",
13 | "major"
14 | })
15 | public class UaBrowser {
16 |
17 | @JsonProperty("name")
18 | private String name;
19 | @JsonProperty("version")
20 | private String version;
21 | @JsonProperty("major")
22 | private String major;
23 | @JsonIgnore
24 | private Map additionalProperties = new HashMap();
25 |
26 | public UaBrowser(String name, String version, String major, Map additionalProperties) {
27 | this.name = name;
28 | this.version = version;
29 | this.major = major;
30 | this.additionalProperties = additionalProperties;
31 | }
32 |
33 | public UaBrowser() {
34 | }
35 |
36 | @JsonProperty("name")
37 | public String getName() {
38 | return name;
39 | }
40 |
41 | @JsonProperty("name")
42 | public void setName(String name) {
43 | this.name = name;
44 | }
45 |
46 | @JsonProperty("version")
47 | public String getVersion() {
48 | return version;
49 | }
50 |
51 | @JsonProperty("version")
52 | public void setVersion(String version) {
53 | this.version = version;
54 | }
55 |
56 | @JsonProperty("major")
57 | public String getMajor() {
58 | return major;
59 | }
60 |
61 | @JsonProperty("major")
62 | public void setMajor(String major) {
63 | this.major = major;
64 | }
65 |
66 | @JsonAnyGetter
67 | public Map getAdditionalProperties() {
68 | return this.additionalProperties;
69 | }
70 |
71 | @JsonAnySetter
72 | public void setAdditionalProperty(String name, Object value) {
73 | this.additionalProperties.put(name, value);
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/DFP/UaCPU.java:
--------------------------------------------------------------------------------
1 |
2 | package org.secureauth.sarestapi.data.DFP;
3 |
4 | import com.fasterxml.jackson.annotation.*;
5 |
6 | import java.util.HashMap;
7 | import java.util.Map;
8 |
9 | @JsonInclude(JsonInclude.Include.NON_NULL)
10 | @JsonPropertyOrder({
11 | "architecture"
12 | })
13 | public class UaCPU {
14 |
15 | @JsonProperty("architecture")
16 | private Object architecture;
17 | @JsonIgnore
18 | private final Map additionalProperties = new HashMap();
19 |
20 | @JsonProperty("architecture")
21 | public Object getArchitecture() {
22 | return architecture;
23 | }
24 |
25 | @JsonProperty("architecture")
26 | public void setArchitecture(Object architecture) {
27 | this.architecture = architecture;
28 | }
29 |
30 | @JsonAnyGetter
31 | public Map getAdditionalProperties() {
32 | return this.additionalProperties;
33 | }
34 |
35 | @JsonAnySetter
36 | public void setAdditionalProperty(String name, Object value) {
37 | this.additionalProperties.put(name, value);
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/DFP/UaDevice.java:
--------------------------------------------------------------------------------
1 |
2 | package org.secureauth.sarestapi.data.DFP;
3 |
4 | import com.fasterxml.jackson.annotation.*;
5 |
6 | import java.util.HashMap;
7 | import java.util.Map;
8 |
9 | @JsonInclude(JsonInclude.Include.NON_NULL)
10 | @JsonPropertyOrder({
11 | "model",
12 | "type",
13 | "vendor"
14 | })
15 | public class UaDevice {
16 |
17 | @JsonProperty("model")
18 | private Object model;
19 | @JsonProperty("type")
20 | private Object type;
21 | @JsonProperty("vendor")
22 | private Object vendor;
23 | @JsonIgnore
24 | private final Map additionalProperties = new HashMap();
25 |
26 | @JsonProperty("model")
27 | public Object getModel() {
28 | return model;
29 | }
30 |
31 | @JsonProperty("model")
32 | public void setModel(Object model) {
33 | this.model = model;
34 | }
35 |
36 | @JsonProperty("type")
37 | public Object getType() {
38 | return type;
39 | }
40 |
41 | @JsonProperty("type")
42 | public void setType(Object type) {
43 | this.type = type;
44 | }
45 |
46 | @JsonProperty("vendor")
47 | public Object getVendor() {
48 | return vendor;
49 | }
50 |
51 | @JsonProperty("vendor")
52 | public void setVendor(Object vendor) {
53 | this.vendor = vendor;
54 | }
55 |
56 | @JsonAnyGetter
57 | public Map getAdditionalProperties() {
58 | return this.additionalProperties;
59 | }
60 |
61 | @JsonAnySetter
62 | public void setAdditionalProperty(String name, Object value) {
63 | this.additionalProperties.put(name, value);
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/DFP/UaEngine.java:
--------------------------------------------------------------------------------
1 |
2 | package org.secureauth.sarestapi.data.DFP;
3 |
4 | import com.fasterxml.jackson.annotation.*;
5 |
6 | import java.util.HashMap;
7 | import java.util.Map;
8 |
9 | @JsonInclude(JsonInclude.Include.NON_NULL)
10 | @JsonPropertyOrder({
11 | "name",
12 | "version"
13 | })
14 | public class UaEngine {
15 |
16 | @JsonProperty("name")
17 | private String name;
18 | @JsonProperty("version")
19 | private String version;
20 | @JsonIgnore
21 | private final Map additionalProperties = new HashMap();
22 |
23 | @JsonProperty("name")
24 | public String getName() {
25 | return name;
26 | }
27 |
28 | @JsonProperty("name")
29 | public void setName(String name) {
30 | this.name = name;
31 | }
32 |
33 | @JsonProperty("version")
34 | public String getVersion() {
35 | return version;
36 | }
37 |
38 | @JsonProperty("version")
39 | public void setVersion(String version) {
40 | this.version = version;
41 | }
42 |
43 | @JsonAnyGetter
44 | public Map getAdditionalProperties() {
45 | return this.additionalProperties;
46 | }
47 |
48 | @JsonAnySetter
49 | public void setAdditionalProperty(String name, Object value) {
50 | this.additionalProperties.put(name, value);
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/DFP/UaOS.java:
--------------------------------------------------------------------------------
1 |
2 | package org.secureauth.sarestapi.data.DFP;
3 |
4 | import com.fasterxml.jackson.annotation.*;
5 |
6 | import java.util.HashMap;
7 | import java.util.Map;
8 |
9 | @JsonInclude(JsonInclude.Include.NON_NULL)
10 | @JsonPropertyOrder({
11 | "name",
12 | "version"
13 | })
14 | public class UaOS {
15 |
16 | @JsonProperty("name")
17 | private String name;
18 | @JsonProperty("version")
19 | private String version;
20 | @JsonIgnore
21 | private Map additionalProperties = new HashMap();
22 |
23 | public UaOS() {
24 | }
25 |
26 | public UaOS(String name, String version, Map additionalProperties) {
27 | this.name = name;
28 | this.version = version;
29 | this.additionalProperties = additionalProperties;
30 | }
31 |
32 | @JsonProperty("name")
33 | public String getName() {
34 | return name;
35 | }
36 |
37 | @JsonProperty("name")
38 | public void setName(String name) {
39 | this.name = name;
40 | }
41 |
42 | @JsonProperty("version")
43 | public String getVersion() {
44 | return version;
45 | }
46 |
47 | @JsonProperty("version")
48 | public void setVersion(String version) {
49 | this.version = version;
50 | }
51 |
52 | @JsonAnyGetter
53 | public Map getAdditionalProperties() {
54 | return this.additionalProperties;
55 | }
56 |
57 | @JsonAnySetter
58 | public void setAdditionalProperty(String name, Object value) {
59 | this.additionalProperties.put(name, value);
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/IPEval.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data;
2 |
3 | import javax.xml.bind.annotation.XmlRootElement;
4 |
5 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
6 | import com.fasterxml.jackson.annotation.JsonInclude;
7 | import org.secureauth.sarestapi.data.Response.BaseResponse;
8 | import org.secureauth.sarestapi.util.JSONUtil;
9 |
10 |
11 | /**
12 | * @author rrowcliffe@secureauth.com
13 | *
14 | Copyright (c) 2015, SecureAuth
15 | All rights reserved.
16 |
17 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
18 |
19 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
20 |
21 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
22 |
23 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
24 |
25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 | **/
29 |
30 | @XmlRootElement(name="IPEval")
31 | @JsonInclude(JsonInclude.Include.NON_NULL)
32 | @JsonIgnoreProperties(ignoreUnknown = true)
33 | public class IPEval extends BaseResponse {
34 |
35 | private IPEvaluation ip_evaluation;
36 |
37 | public IPEvaluation getIp_evaluation() {
38 | return ip_evaluation;
39 | }
40 |
41 | public void setIp_evaluation(IPEvaluation ip_evaluation) {
42 | this.ip_evaluation = ip_evaluation;
43 | }
44 |
45 | @Override
46 | public String toString(){
47 | return JSONUtil.convertObjectToJSON(this);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/NumberProfile/CarrierInfo.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.NumberProfile;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 |
5 | import javax.xml.bind.annotation.XmlRootElement;
6 |
7 | /**
8 | * Created by rrowcliffe on 12/27/16.
9 | */
10 | @XmlRootElement(name="carrierInfo")
11 | @JsonInclude(JsonInclude.Include.NON_NULL)
12 | public class CarrierInfo {
13 | private String carrierCode;
14 | private String carrier;
15 | private String countryCode;
16 | private String networkType;
17 |
18 |
19 | public String getCarrierCode() {
20 | return carrierCode;
21 | }
22 |
23 | public void setCarrierCode(String carrierCode) {
24 | this.carrierCode = carrierCode;
25 | }
26 |
27 | public String getCarrier() {
28 | return carrier;
29 | }
30 |
31 | public void setCarrier(String carrier) {
32 | this.carrier = carrier;
33 | }
34 |
35 | public String getCountryCode() {
36 | return countryCode;
37 | }
38 |
39 | public void setCountryCode(String countryCode) {
40 | this.countryCode = countryCode;
41 | }
42 |
43 | public String getNetworkType() {
44 | return networkType;
45 | }
46 |
47 | public void setNetworkType(String networkType) {
48 | this.networkType = networkType;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/NumberProfile/CarrierStatus.java:
--------------------------------------------------------------------------------
1 |
2 | package org.secureauth.sarestapi.data.NumberProfile;
3 |
4 | import com.fasterxml.jackson.annotation.JsonInclude;
5 | import com.fasterxml.jackson.annotation.JsonProperty;
6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder;
7 | import org.secureauth.sarestapi.util.JSONUtil;
8 |
9 | /**
10 | * Created by rrowcliffe on 12/27/16.
11 | */
12 | @JsonInclude(JsonInclude.Include.NON_NULL)
13 | @JsonPropertyOrder({
14 | "status",
15 | "reason"
16 | })
17 | public class CarrierStatus {
18 |
19 | @JsonProperty("status")
20 | private String status;
21 | @JsonProperty("reason")
22 | private Object reason;
23 |
24 | /**
25 | * No args constructor for use in serialization
26 | *
27 | */
28 | public CarrierStatus() {
29 | }
30 |
31 | /**
32 | *
33 | * @param reason explanation for the state of the carrier (network_type, ported, country, carrier) based on the configuration defined in the Web Admin
34 | * @param status state of the carrier (blocked, allowed) based on the configuration defined in the Web Admin
35 | */
36 | public CarrierStatus(String status, Object reason) {
37 | super();
38 | this.status = status;
39 | this.reason = reason;
40 | }
41 |
42 | @JsonProperty("status")
43 | public String getStatus() {
44 | return status;
45 | }
46 |
47 | @JsonProperty("status")
48 | public void setStatus(String status) {
49 | this.status = status;
50 | }
51 |
52 | public CarrierStatus withStatus(String status) {
53 | this.status = status;
54 | return this;
55 | }
56 |
57 | @JsonProperty("reason")
58 | public Object getReason() {
59 | return reason;
60 | }
61 |
62 | @JsonProperty("reason")
63 | public void setReason(Object reason) {
64 | this.reason = reason;
65 | }
66 |
67 | public CarrierStatus withReason(Object reason) {
68 | this.reason = reason;
69 | return this;
70 | }
71 |
72 | @Override
73 | public String toString(){
74 | return JSONUtil.convertObjectToJSON(this);
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/PreferredMFA.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data;
2 |
3 | import org.secureauth.sarestapi.util.JSONUtil;
4 |
5 |
6 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
7 | import com.fasterxml.jackson.annotation.JsonInclude;
8 | import com.fasterxml.jackson.annotation.JsonProperty;
9 |
10 | @JsonInclude(JsonInclude.Include.NON_NULL)
11 | @JsonIgnoreProperties(ignoreUnknown = true)
12 | public class PreferredMFA {
13 |
14 | @JsonProperty("factor_id")
15 | private String factorId;
16 |
17 | @JsonProperty("type")
18 | private String type;
19 |
20 | @JsonProperty("biometric_type")
21 | private String biometricType;
22 |
23 | public String getFactorId() {
24 | return factorId;
25 | }
26 |
27 | public void setFactorId(String factorId) {
28 | this.factorId = factorId;
29 | }
30 |
31 | public String getType() {
32 | return type;
33 | }
34 |
35 | public void setType(String type) {
36 | this.type = type;
37 | }
38 |
39 | public String getBiometricType() {
40 | return biometricType;
41 | }
42 |
43 | public void setBiometricType(String biometricType) {
44 | this.biometricType = biometricType;
45 | }
46 |
47 | @Override
48 | public String toString() {
49 | return JSONUtil.convertObjectToJSON(this);
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/PushAcceptDetails.java:
--------------------------------------------------------------------------------
1 | /**
2 |
3 | Copyright (c) 2015 SecureAuth Corporation
4 | All Rights Reserved
5 |
6 | */
7 | package org.secureauth.sarestapi.data;
8 |
9 | import javax.xml.bind.annotation.XmlRootElement;
10 |
11 | import com.fasterxml.jackson.annotation.JsonInclude;
12 |
13 |
14 | /**
15 | * @author lding@secureauth.com
16 | *
17 | Copyright (c) 2015, SecureAuth
18 | All rights reserved.
19 |
20 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
21 |
22 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
23 |
24 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
25 |
26 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
27 |
28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
30 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | @XmlRootElement
34 | @JsonInclude(JsonInclude.Include.NON_NULL)
35 | public class PushAcceptDetails {
36 | private String company_name, application_description, enduser_ip;
37 |
38 | public String getCompany_name() {
39 | return company_name;
40 | }
41 |
42 | public void setCompany_name(String company_name) {
43 | this.company_name = company_name;
44 | }
45 |
46 | public String getApplication_description() {
47 | return application_description;
48 | }
49 |
50 | public void setApplication_description(String application_description) {
51 | this.application_description = application_description;
52 | }
53 |
54 | public String getEnduser_ip() {
55 | return enduser_ip;
56 | }
57 |
58 | public void setEnduser_ip(String enduser_ip) {
59 | this.enduser_ip = enduser_ip;
60 | }
61 |
62 | @Override
63 | public String toString() {
64 | return "company_name=" + company_name + ", application_description="
65 | + application_description + ", enduser_ip=" + enduser_ip;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/PushAcceptStatus.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import org.secureauth.sarestapi.util.JSONUtil;
5 |
6 |
7 | import javax.xml.bind.annotation.XmlRootElement;
8 |
9 | /**
10 | * @author lding@secureauth.com
11 | *
12 | Copyright (c) 2015, SecureAuth
13 | All rights reserved.
14 |
15 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
16 |
17 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
18 |
19 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
20 |
21 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
22 |
23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | @XmlRootElement
29 | @JsonInclude(JsonInclude.Include.NON_NULL)
30 | public class PushAcceptStatus {
31 |
32 | private String status, message;
33 |
34 | @Override
35 | public String toString(){
36 | return "status: " + status + "; message: " + message;
37 | }
38 |
39 | public String getStatus() {
40 | return status;
41 | }
42 |
43 | public void setStatus(String status) {
44 | this.status = status;
45 | }
46 |
47 | public String getMessage() {
48 | return message;
49 | }
50 |
51 | public void setMessage(String message) {
52 | this.message = message;
53 | }
54 |
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Requests/AccessHistoryRequest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Requests;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import org.secureauth.sarestapi.util.JSONUtil;
5 |
6 | import javax.xml.bind.annotation.XmlRootElement;
7 |
8 | /**
9 | * @author rrowcliffe@secureauth.com
10 | *
11 | *
12 | Copyright (c) 2015, SecureAuth
13 | All rights reserved.
14 |
15 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
16 |
17 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
18 |
19 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
20 |
21 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
22 |
23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | **/
27 |
28 | @XmlRootElement
29 | @JsonInclude(JsonInclude.Include.NON_NULL)
30 | public class AccessHistoryRequest {
31 |
32 | private String user_id;
33 | private String ip_address;
34 |
35 |
36 |
37 | public String getUser_id() {
38 | return user_id;
39 | }
40 |
41 | public void setUser_id(String user_id) {
42 | this.user_id = user_id;
43 | }
44 |
45 | public String getIp_address() {
46 | return ip_address;
47 | }
48 |
49 | public void setIp_address(String ip_address) {
50 | this.ip_address = ip_address;
51 | }
52 |
53 | @Override
54 | public String toString(){
55 | return JSONUtil.convertObjectToJSON(this);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Requests/AdaptiveAuthRequest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Requests;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import org.secureauth.sarestapi.util.JSONUtil;
5 |
6 |
7 | import javax.xml.bind.annotation.XmlRootElement;
8 |
9 | /**
10 | * @author lding@secureauth.com
11 | *
12 | Copyright (c) 2015, SecureAuth
13 | All rights reserved.
14 |
15 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
16 |
17 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
18 |
19 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
20 |
21 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
22 |
23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | @XmlRootElement
29 | @JsonInclude(JsonInclude.Include.NON_NULL)
30 | public class AdaptiveAuthRequest extends AuthRequest {
31 |
32 | private AAParameters parameters;
33 |
34 | public AdaptiveAuthRequest(String user_id, String ip) {
35 | this.user_id = user_id;
36 | parameters = new AAParameters();
37 | parameters.setIp_address(ip);
38 | }
39 |
40 | public AAParameters getParameters() {
41 | return parameters;
42 | }
43 |
44 | public void setParameters(AAParameters parameters) {
45 | this.parameters = parameters;
46 | }
47 |
48 | @XmlRootElement
49 | @JsonInclude(JsonInclude.Include.NON_NULL)
50 | public static class AAParameters {
51 | private String ip_address;
52 |
53 | public String getIp_address() {
54 | return ip_address;
55 | }
56 |
57 | public void setIp_address(String ip_address) {
58 | this.ip_address = ip_address;
59 | }
60 | }
61 |
62 | @Override
63 | public String toString(){
64 | return JSONUtil.convertObjectToJSON(this);
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Requests/AuthRequest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Requests;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import org.secureauth.sarestapi.util.JSONUtil;
5 |
6 |
7 | import javax.xml.bind.annotation.XmlRootElement;
8 |
9 | /**
10 | * @author rrowcliffe@secureauth.com
11 | *
12 | Copyright (c) 2015, SecureAuth
13 | All rights reserved.
14 |
15 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
16 |
17 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
18 |
19 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
20 |
21 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
22 |
23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | @XmlRootElement
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | public class AuthRequest {
30 |
31 | String user_id;
32 | private String type;
33 | private String token;
34 | private String factor_id;
35 | private String enduser_ip;
36 |
37 |
38 | public String getUser_id() {
39 | return user_id;
40 | }
41 |
42 | public void setUser_id(String user_id) {
43 | this.user_id = user_id;
44 | }
45 |
46 | public String getType() {
47 | return type;
48 | }
49 |
50 | public void setType(String type) {
51 | this.type = type;
52 | }
53 |
54 | public String getToken() {
55 | return token;
56 | }
57 |
58 | public void setToken(String token) {
59 | this.token = token;
60 | }
61 |
62 | public String getFactor_id() {
63 | return factor_id;
64 | }
65 |
66 | public void setFactor_id(String factor_id) {
67 | this.factor_id = factor_id;
68 | }
69 |
70 | public String getEnduser_ip() {
71 | return enduser_ip;
72 | }
73 |
74 | public void setEnduser_ip(String enduser_ip) {
75 | this.enduser_ip = enduser_ip;
76 | }
77 |
78 | @Override
79 | public String toString(){
80 | return JSONUtil.convertObjectToJSON(this);
81 | }
82 |
83 | }
84 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Requests/BehaveBioResetRequest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Requests;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import org.secureauth.sarestapi.util.JSONUtil;
5 |
6 | import javax.xml.bind.annotation.XmlRootElement;
7 |
8 | /**
9 | * Created by rrowcliffe on 4/30/16.
10 | */
11 | @XmlRootElement
12 | @JsonInclude(JsonInclude.Include.NON_NULL)
13 | public class BehaveBioResetRequest {
14 |
15 | private String userId;
16 | private String fieldName;
17 | private String fieldType;
18 | private String deviceType;
19 |
20 | public String getUserId() {
21 | return userId;
22 | }
23 |
24 | public void setUserId(String userId) {
25 | this.userId = userId;
26 | }
27 |
28 | public String getFieldName() {
29 | return fieldName;
30 | }
31 |
32 | public void setFieldName(String fieldName) {
33 | this.fieldName = fieldName;
34 | }
35 |
36 | public String getFieldType() {
37 | return fieldType;
38 | }
39 |
40 | public void setFieldType(String fieldType) {
41 | this.fieldType = fieldType;
42 | }
43 |
44 | public String getDeviceType() {
45 | return deviceType;
46 | }
47 |
48 | public void setDeviceType(String deviceType) {
49 | this.deviceType = deviceType;
50 | }
51 |
52 | @Override
53 | public String toString(){
54 | return JSONUtil.convertObjectToJSON(this);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Requests/DFPConfirmRequest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Requests;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import org.secureauth.sarestapi.util.JSONUtil;
5 |
6 |
7 | import javax.xml.bind.annotation.XmlRootElement;
8 |
9 | /**
10 | * @author rrowcliffe@secureauth.com
11 | *
12 | *
13 | Copyright (c) 2015, SecureAuth
14 | All rights reserved.
15 |
16 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
17 |
18 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
19 |
20 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
21 |
22 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
23 |
24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | **/
28 |
29 | @XmlRootElement
30 | @JsonInclude(JsonInclude.Include.NON_NULL)
31 | public class DFPConfirmRequest {
32 |
33 | private String user_id;
34 | private String fingerprint_id;
35 |
36 | public DFPConfirmRequest(){}
37 |
38 | public DFPConfirmRequest(String user_id, String fingerprint_id) {
39 | this.user_id = user_id;
40 | this.fingerprint_id = fingerprint_id;
41 | }
42 |
43 | public String getUser_id() {
44 | return user_id;
45 | }
46 |
47 | public void setUser_id(String user_id) {
48 | this.user_id = user_id;
49 | }
50 |
51 | public String getFingerprint_id() {
52 | return fingerprint_id;
53 | }
54 |
55 | public void setFingerprint_id(String fingerprint_id) {
56 | this.fingerprint_id = fingerprint_id;
57 | }
58 |
59 | @Override
60 | public String toString(){
61 | return JSONUtil.convertObjectToJSON(this);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Requests/DFPScoreRequest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Requests;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import com.fasterxml.jackson.annotation.JsonProperty;
5 |
6 | import javax.xml.bind.annotation.XmlRootElement;
7 |
8 | @XmlRootElement
9 | @JsonInclude(JsonInclude.Include.NON_NULL)
10 | public class DFPScoreRequest extends DFPValidateRequest {
11 | @JsonProperty("fingerprint_id")
12 | private String fingerprintId;
13 |
14 | public DFPScoreRequest(DFPConfirmRequest dfpConfirmRequest, DFPValidateRequest dfpValidateRequest) {
15 | this.setUser_id(dfpValidateRequest.getUser_id());
16 | this.setHost_address(dfpValidateRequest.getHost_address());
17 | this.setFingerprint(dfpValidateRequest.getFingerprint());
18 | this.setFingerprintId(dfpConfirmRequest.getFingerprint_id());
19 | }
20 |
21 | public DFPScoreRequest() {
22 | }
23 |
24 | public String getFingerprintId() {
25 | return fingerprintId;
26 | }
27 |
28 | public void setFingerprintId(String fingerprintId) {
29 | this.fingerprintId = fingerprintId;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Requests/DeleteUserRequest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Requests;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import com.fasterxml.jackson.annotation.JsonProperty;
5 |
6 | import javax.xml.bind.annotation.XmlRootElement;
7 |
8 | @XmlRootElement
9 | @JsonInclude(JsonInclude.Include.NON_NULL)
10 | public class DeleteUserRequest {
11 |
12 | @JsonProperty("user_id")
13 | private String userId;
14 | private Boolean deleteAllRelatedData;
15 | private String domain;
16 |
17 | public DeleteUserRequest() {
18 | }
19 |
20 | public DeleteUserRequest(String userId, Boolean deleteAllRelatedData, String domain) {
21 | this.userId = userId;
22 | this.deleteAllRelatedData = deleteAllRelatedData;
23 | this.domain = domain;
24 | }
25 |
26 | public String getUserId() {
27 | return userId;
28 | }
29 |
30 | public void setUserId(String userId) {
31 | this.userId = userId;
32 | }
33 |
34 | public Boolean getDeleteAllRelatedData() {
35 | return deleteAllRelatedData;
36 | }
37 |
38 | public void setDeleteAllRelatedData(Boolean deleteAllRelatedData) {
39 | this.deleteAllRelatedData = deleteAllRelatedData;
40 | }
41 |
42 | public String getDomain() {
43 | return domain;
44 | }
45 |
46 | public void setDomain(String domain) {
47 | this.domain = domain;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Requests/IPEvalRequest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Requests;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import org.secureauth.sarestapi.util.JSONUtil;
5 |
6 |
7 | import javax.xml.bind.annotation.XmlRootElement;
8 |
9 | /**
10 | * @author rrowcliffe@secureauth.com
11 | *
12 | *
13 | Copyright (c) 2015, SecureAuth
14 | All rights reserved.
15 |
16 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
17 |
18 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
19 |
20 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
21 |
22 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
23 |
24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | **/
28 |
29 | @XmlRootElement
30 | @JsonInclude(JsonInclude.Include.NON_NULL)
31 | public class IPEvalRequest {
32 |
33 | private String user_id;
34 | private String type;
35 | private String ip_address;
36 |
37 |
38 |
39 | public String getUser_id() {
40 | return user_id;
41 | }
42 |
43 | public void setUser_id(String user_id) {
44 | this.user_id = user_id;
45 | }
46 |
47 | public String getType() {
48 | return type;
49 | }
50 |
51 | public void setType(String type) {
52 | this.type = type;
53 | }
54 |
55 | public String getIp_address() {
56 | return ip_address;
57 | }
58 |
59 | public void setIp_address(String ip_address) {
60 | this.ip_address = ip_address;
61 | }
62 |
63 | @Override
64 | public String toString(){
65 | return JSONUtil.convertObjectToJSON(this);
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Requests/LinkToAcceptFactory.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Requests;
2 |
3 | import org.secureauth.sarestapi.resources.Resource;
4 |
5 | public class LinkToAcceptFactory {
6 |
7 | public static AuthRequest createLinkToAcceptAuthRequest(String userId, String factorId, String type) {
8 | AuthRequest authRequest = new AuthRequest();
9 |
10 | authRequest.setUser_id(userId);
11 | authRequest.setType(type);
12 | authRequest.setFactor_id(factorId);
13 | return authRequest;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Requests/NumberProfileRequest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Requests;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import org.secureauth.sarestapi.util.JSONUtil;
5 |
6 | import javax.xml.bind.annotation.XmlRootElement;
7 |
8 | /**
9 | * @author rrowcliffe@secureauth.com
10 | *
11 | Copyright (c) 2015, SecureAuth
12 | All rights reserved.
13 |
14 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
15 |
16 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
17 |
18 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
19 |
20 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | */
26 | @XmlRootElement
27 | @JsonInclude(JsonInclude.Include.NON_NULL)
28 | public class NumberProfileRequest {
29 |
30 | private String user_id;
31 | private String phone_number;
32 |
33 |
34 | public String getUser_id() {
35 | return user_id;
36 | }
37 |
38 | public void setUser_id(String user_id) {
39 | this.user_id = user_id;
40 | }
41 |
42 | public String getPhone_number() {
43 | return phone_number;
44 | }
45 |
46 | public void setPhone_number(String phone_number) {
47 | this.phone_number = phone_number;
48 | }
49 |
50 | @Override
51 | public String toString(){
52 | return JSONUtil.convertObjectToJSON(this);
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Requests/PushToAcceptBiometricsRequest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Requests;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 |
5 | import javax.xml.bind.annotation.XmlRootElement;
6 |
7 | @XmlRootElement
8 | @JsonInclude(JsonInclude.Include.NON_NULL)
9 | public class PushToAcceptBiometricsRequest extends PushToAcceptRequest {
10 |
11 | private String biometricType;
12 |
13 | public void setBiometricType(String biometricType) {
14 | this.biometricType = biometricType;
15 | }
16 |
17 | public String getBiometricType() {
18 | return biometricType;
19 | }
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Requests/PushToAcceptRequest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Requests;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import org.secureauth.sarestapi.data.PushAcceptDetails;
5 | import org.secureauth.sarestapi.util.JSONUtil;
6 |
7 | import javax.xml.bind.annotation.XmlRootElement;
8 |
9 | /**
10 | *
11 | Copyright (c) 2015, SecureAuth
12 | All rights reserved.
13 |
14 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
15 |
16 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
17 |
18 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
19 |
20 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | */
26 |
27 | @XmlRootElement
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | public class PushToAcceptRequest extends AuthRequest {
30 |
31 | private PushAcceptDetails push_accept_details;
32 |
33 | public PushAcceptDetails getPush_accept_details() {
34 | return push_accept_details;
35 | }
36 |
37 | public void setPush_accept_details(PushAcceptDetails push_accept_details) {
38 | this.push_accept_details = push_accept_details;
39 | }
40 |
41 | @Override
42 | public String toString(){
43 | return JSONUtil.convertObjectToJSON(this);
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Requests/PushToAcceptRequestsFactory.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Requests;
2 |
3 | import org.secureauth.sarestapi.data.PushAcceptDetails;
4 | import org.secureauth.sarestapi.resources.Resource;
5 |
6 | public class PushToAcceptRequestsFactory {
7 |
8 | public static PushToAcceptBiometricsRequest createPushToAcceptBiometricRequest(String biometricType, String userId, String factorId, String endUserIP, String clientCompany, String clientDescription) {
9 | PushToAcceptBiometricsRequest req = new PushToAcceptBiometricsRequest();
10 | req.setUser_id(userId);
11 | req.setType(Resource.PUSH_ACCEPT_BIOMETRIC);
12 | req.setFactor_id(factorId);
13 | req.setBiometricType( biometricType );
14 | PushAcceptDetails pad = new PushAcceptDetails();
15 | pad.setEnduser_ip(endUserIP);
16 | if (clientCompany != null) {
17 | pad.setCompany_name(clientCompany);
18 | }
19 | if (clientDescription != null) {
20 | pad.setApplication_description(clientDescription);
21 | }
22 | req.setPush_accept_details(pad);
23 | return req;
24 | }
25 |
26 | public static PushToAcceptRequest createPushToAcceptRequest(String userId, String factor_id, String endUserIP, String clientCompany, String clientDescription, String type) {
27 | PushToAcceptRequest req = new PushToAcceptRequest();
28 | req.setUser_id(userId);
29 | req.setType(type);
30 | req.setFactor_id(factor_id);
31 | PushAcceptDetails pad = new PushAcceptDetails();
32 | pad.setEnduser_ip(endUserIP);
33 | if (clientCompany != null) {
34 | pad.setCompany_name(clientCompany);
35 | }
36 | if (clientDescription != null) {
37 | pad.setApplication_description(clientDescription);
38 | }
39 | req.setPush_accept_details(pad);
40 | return req;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Requests/StatusRequest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Requests;
2 |
3 | public class StatusRequest {
4 |
5 | private String status;
6 |
7 | public StatusRequest(String status){
8 | this.status = status;
9 | }
10 |
11 | public String getStatus() {
12 | return status;
13 | }
14 |
15 | public void setStatus(String status) {
16 | this.status = status;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Requests/ThrottleRequest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Requests;
2 |
3 | public class ThrottleRequest {
4 | int count;
5 |
6 | public ThrottleRequest(int count) {
7 | this.count = count;
8 | }
9 |
10 | public int getCount() {
11 | return count;
12 | }
13 |
14 | public void setCount(int count) {
15 | this.count = count;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Requests/UserPasswordRequest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Requests;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 |
5 | import javax.xml.bind.annotation.XmlRootElement;
6 |
7 | /**
8 | * Created by rrowcliffe on 5/3/16.
9 | */
10 | @XmlRootElement
11 | @JsonInclude(JsonInclude.Include.NON_NULL)
12 | public class UserPasswordRequest {
13 | /* Object to Support both Password Reset and Change Password Requests */
14 | private char[] currentPassword = new char[0];
15 | private char[] newPassword = new char[0];
16 | private char[] password = new char[0];
17 |
18 | public String getCurrentPassword() {
19 | return new String(currentPassword);
20 | }
21 |
22 | public void setCurrentPassword(String currentPassword) {
23 | this.currentPassword = currentPassword.toCharArray();
24 | }
25 |
26 | public String getNewPassword() {
27 | return new String(newPassword);
28 | }
29 |
30 | public void setNewPassword(String newPassword) {
31 | this.newPassword = newPassword.toCharArray();
32 | }
33 |
34 | public String getPassword() {
35 | return new String(password);
36 | }
37 |
38 | public void setPassword(String password) {
39 | this.password = password.toCharArray();
40 | }
41 | }
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Requests/ValidateOTPRequest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Requests;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import org.secureauth.sarestapi.util.JSONUtil;
5 |
6 | import javax.xml.bind.annotation.XmlRootElement;
7 |
8 | /**
9 | * @author rrowcliffe@secureauth.com
10 | *
11 | Copyright (c) 2015, SecureAuth
12 | All rights reserved.
13 |
14 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
15 |
16 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
17 |
18 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
19 |
20 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | */
26 | @XmlRootElement
27 | @JsonInclude(JsonInclude.Include.NON_NULL)
28 | public class ValidateOTPRequest {
29 |
30 | String user_id;
31 | private String otp;
32 |
33 |
34 |
35 | public String getUser_id() {
36 | return user_id;
37 | }
38 |
39 | public void setUser_id(String user_id) {
40 | this.user_id = user_id;
41 | }
42 |
43 | public String getOtp() {
44 | return otp;
45 | }
46 |
47 | public void setOtp(String otp) {
48 | this.otp = otp;
49 | }
50 |
51 | @Override
52 | public String toString(){
53 | return JSONUtil.convertObjectToJSON(this);
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Response/AdaptiveAuthResponse.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Response;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import org.secureauth.sarestapi.util.JSONUtil;
5 |
6 |
7 | import javax.xml.bind.annotation.XmlRootElement;
8 |
9 | /**
10 | * @author lding@secureauth.com
11 | *
12 | Copyright (c) 2015, SecureAuth
13 | All rights reserved.
14 |
15 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
16 |
17 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
18 |
19 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
20 |
21 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
22 |
23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | @XmlRootElement
29 | @JsonInclude(JsonInclude.Include.NON_NULL)
30 | public class AdaptiveAuthResponse extends ResponseObject {
31 |
32 | private String realm_workflow, suggested_action, redirect_url;
33 |
34 | public String getRealm_workflow() {
35 | return realm_workflow;
36 | }
37 |
38 | public void setRealm_workflow(String realm_workflow) {
39 | this.realm_workflow = realm_workflow;
40 | }
41 |
42 | public String getSuggested_action() {
43 | return suggested_action;
44 | }
45 |
46 | public void setSuggested_action(String suggested_action) {
47 | this.suggested_action = suggested_action;
48 | }
49 |
50 | public String getRedirect_url() {
51 | return redirect_url;
52 | }
53 |
54 | public void setRedirect_url(String redirect_url) {
55 | this.redirect_url = redirect_url;
56 | }
57 |
58 | @Override
59 | public String toString(){
60 | return JSONUtil.convertObjectToJSON(this);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Response/BaseResponse.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Response;
2 |
3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 | import com.fasterxml.jackson.annotation.JsonInclude;
5 | import com.fasterxml.jackson.annotation.JsonProperty;
6 |
7 | import org.secureauth.sarestapi.util.JSONUtil;
8 |
9 | import javax.xml.bind.annotation.XmlRootElement;
10 |
11 | /**
12 | * Created by rrowcliffe on 5/8/16.
13 | */
14 | @XmlRootElement
15 | @JsonInclude(JsonInclude.Include.NON_NULL)
16 | @JsonIgnoreProperties(ignoreUnknown = true)
17 | public class BaseResponse {
18 |
19 | @JsonProperty("status")
20 | private String status;
21 |
22 | @JsonProperty("message")
23 | private String message;
24 |
25 | @JsonProperty("user_id")
26 | private String user_id;
27 |
28 | public String getStatus() {
29 | return status;
30 | }
31 |
32 | public void setStatus(String status) {
33 | this.status = status;
34 | }
35 |
36 | public String getMessage() {
37 | return message;
38 | }
39 |
40 | public void setMessage(String message) {
41 | this.message = message;
42 | }
43 |
44 | public String getUser_id() {
45 | return user_id;
46 | }
47 |
48 | public void setUser_id(String user_id) {
49 | this.user_id = user_id;
50 | }
51 |
52 | @Override
53 | public String toString(){
54 | return JSONUtil.convertObjectToJSON(this);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Response/BehaveBioResponse.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Response;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import com.fasterxml.jackson.annotation.JsonProperty;
5 | import org.secureauth.sarestapi.data.BehavioralBio.BehaveBioResult;
6 | import org.secureauth.sarestapi.data.BehavioralBio.BehaveBioResults;
7 | import org.secureauth.sarestapi.util.JSONUtil;
8 |
9 | import javax.xml.bind.annotation.XmlRootElement;
10 | import javax.xml.bind.annotation.XmlSeeAlso;
11 | import java.util.ArrayList;
12 | import java.util.List;
13 |
14 | /**
15 | * Created by rrowcliffe on 4/30/16.
16 | */
17 | @JsonInclude(JsonInclude.Include.NON_NULL)
18 | public class BehaveBioResponse extends BaseResponse{
19 | @JsonProperty("BehaviorBioResults")
20 | private BehaveBioResults behaveBioResults;
21 |
22 | public BehaveBioResults getBehaveBioResults() {
23 | return behaveBioResults;
24 | }
25 |
26 | public void setBehaveBioResults(BehaveBioResults behaveBioResults) {
27 | this.behaveBioResults = behaveBioResults;
28 | }
29 |
30 | @Override
31 | public String toString(){
32 | return JSONUtil.convertObjectToJSON(this);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Response/DFPConfirmResponse.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Response;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import com.fasterxml.jackson.annotation.JsonProperty;
5 | import org.secureauth.sarestapi.util.JSONUtil;
6 |
7 |
8 | import javax.xml.bind.annotation.XmlRootElement;
9 |
10 | /**
11 | * @author rrowcliffe@secureauth.com
12 | *
13 | *
14 | Copyright (c) 2015, SecureAuth
15 | All rights reserved.
16 |
17 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
18 |
19 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
20 |
21 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
22 |
23 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
24 |
25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 | **/
29 |
30 | @XmlRootElement
31 | @JsonInclude(JsonInclude.Include.NON_NULL)
32 | public class DFPConfirmResponse extends BaseResponse{
33 | @JsonProperty("fingerprint_id")
34 | private String fingerprintId;
35 | @JsonProperty("fingerprint_name")
36 | private String fingerprintName;
37 |
38 | public String getFingerprintId() {
39 | return fingerprintId;
40 | }
41 |
42 | public void setFingerprintId(String fingerprintId) {
43 | this.fingerprintId = fingerprintId;
44 | }
45 |
46 |
47 | public String getFingerprintName() {
48 | return fingerprintName;
49 | }
50 |
51 | public void setFingerprintName(String fingerprintName) {
52 | this.fingerprintName = fingerprintName;
53 | }
54 |
55 | @Override
56 | public String toString(){
57 | return JSONUtil.convertObjectToJSON(this);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Response/FactorsResponse.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Response;
2 |
3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 | /**
5 | * @author rrowcliffe@secureauth.com
6 | *
7 | */
8 | import com.fasterxml.jackson.annotation.JsonInclude;
9 | import com.fasterxml.jackson.annotation.JsonProperty;
10 |
11 | import org.secureauth.sarestapi.data.Factors;
12 | import org.secureauth.sarestapi.data.PreferredMFA;
13 | import org.secureauth.sarestapi.util.JSONUtil;
14 |
15 |
16 | import javax.xml.bind.annotation.XmlRootElement;
17 | import javax.xml.bind.annotation.XmlSeeAlso;
18 | import java.util.ArrayList;
19 |
20 | @XmlRootElement
21 | @XmlSeeAlso(Factors.class)
22 | @JsonInclude(JsonInclude.Include.NON_NULL)
23 | @JsonIgnoreProperties(ignoreUnknown = true)
24 | public class FactorsResponse extends BaseResponse {
25 |
26 | @JsonProperty("factors")
27 | private ArrayList factors = new ArrayList();
28 |
29 | @JsonProperty("preferred_mfa")
30 | public PreferredMFA preferredMfa = new PreferredMFA();
31 |
32 | public ArrayList getFactors() {
33 | return factors;
34 | }
35 | public void setFactors(ArrayList factors) {
36 | this.factors = factors;
37 | }
38 | public PreferredMFA getPreferredMfa() {
39 | return preferredMfa;
40 | }
41 | public void setPreferredMfa(PreferredMFA preferredMfa) {
42 | this.preferredMfa = preferredMfa;
43 | }
44 |
45 | @Override
46 | public String toString(){
47 | return JSONUtil.convertObjectToJSON(this);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Response/GroupAssociationResponse.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Response;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import org.secureauth.sarestapi.util.JSONUtil;
5 |
6 | import javax.xml.bind.annotation.XmlRootElement;
7 | import java.util.ArrayList;
8 | import java.util.HashMap;
9 |
10 | /**
11 | * Created by rrowcliffe on 5/8/16.
12 | */
13 | @XmlRootElement
14 | @JsonInclude(JsonInclude.Include.NON_NULL)
15 | public class GroupAssociationResponse extends BaseResponse {
16 | HashMap> failures = new HashMap<>();
17 |
18 | public HashMap> getFailures() {
19 | return failures;
20 | }
21 |
22 | public void setFailures(HashMap> failures) {
23 | this.failures = failures;
24 | }
25 |
26 | @Override
27 | public String toString(){
28 | return JSONUtil.convertObjectToJSON(this);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Response/JSObjectResponse.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Response;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import org.secureauth.sarestapi.util.JSONUtil;
5 |
6 | import javax.xml.bind.annotation.XmlRootElement;
7 |
8 | /**
9 | * @author rrowcliffe@secureauth.com
10 | *
11 | Copyright (c) 2015, SecureAuth
12 | All rights reserved.
13 |
14 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
15 |
16 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
17 |
18 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
19 |
20 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | */
26 | @XmlRootElement
27 | @JsonInclude(JsonInclude.Include.NON_NULL)
28 | public class JSObjectResponse {
29 |
30 | private String src;
31 |
32 | public String getSrc() {
33 | return src;
34 | }
35 |
36 | public void setSrc(String src) {
37 | this.src = src;
38 | }
39 |
40 | @Override
41 | public String toString(){
42 | return JSONUtil.convertObjectToJSON(this);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Response/NumberProfileResponse.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Response;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import com.fasterxml.jackson.annotation.JsonProperty;
5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder;
6 | import org.secureauth.sarestapi.data.NumberProfile.NumberProfileResult;
7 | import org.secureauth.sarestapi.util.JSONUtil;
8 |
9 | /**
10 | * Created by rrowcliffe on 12/27/16.
11 | */
12 |
13 | @JsonInclude(JsonInclude.Include.NON_NULL)
14 | @JsonPropertyOrder({
15 | "numberProfileResult",
16 | "status",
17 | "message"
18 | })
19 | public class NumberProfileResponse extends BaseResponse{
20 |
21 | @JsonProperty("numberProfileResult")
22 | private NumberProfileResult numberProfileResult;
23 |
24 |
25 | /**
26 | * No args constructor for use in serialization
27 | *
28 | */
29 | public NumberProfileResponse() {
30 | }
31 |
32 | /**
33 | *
34 | * @param numberProfileResult Result of request The Actual Object of Data
35 | */
36 | public NumberProfileResponse(NumberProfileResult numberProfileResult) {
37 | super();
38 | this.numberProfileResult = numberProfileResult;
39 |
40 | }
41 |
42 | @JsonProperty("numberProfileResult")
43 | public NumberProfileResult getNumberProfileResult() {
44 | return numberProfileResult;
45 | }
46 |
47 | @JsonProperty("numberProfileResult")
48 | public void setNumberProfileResult(NumberProfileResult numberProfileResult) {
49 | this.numberProfileResult = numberProfileResult;
50 | }
51 |
52 | public NumberProfileResponse withNumberProfileResult(NumberProfileResult numberProfileResult) {
53 | this.numberProfileResult = numberProfileResult;
54 | return this;
55 | }
56 |
57 | @Override
58 | public String toString(){
59 | return JSONUtil.convertObjectToJSON(this);
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Response/ResponseObject.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Response;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import org.secureauth.sarestapi.data.Response.BaseResponse;
5 | import org.secureauth.sarestapi.util.JSONUtil;
6 |
7 |
8 | import javax.xml.bind.annotation.XmlRootElement;
9 |
10 | /**
11 | * @author rrowcliffe@secureauth.com
12 | *
13 | Copyright (c) 2015, SecureAuth
14 | All rights reserved.
15 |
16 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
17 |
18 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
19 |
20 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
21 |
22 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
23 |
24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | */
28 |
29 | @XmlRootElement
30 | @JsonInclude(JsonInclude.Include.NON_NULL)
31 | public class ResponseObject extends BaseResponse {
32 |
33 |
34 | private String reference_id;
35 | private int otp;
36 | private String symbol;
37 |
38 | public int getOtp() {
39 | return otp;
40 | }
41 |
42 | public void setOtp(int otp) {
43 | this.otp = otp;
44 | }
45 |
46 | public String getReference_id() {
47 | return reference_id;
48 | }
49 |
50 | public void setReference_id(String reference_id) {
51 | this.reference_id = reference_id;
52 | }
53 |
54 | public String getSymbol() {
55 | return symbol;
56 | }
57 |
58 | public void setSymbol(String symbol) {
59 | this.symbol = symbol;
60 | }
61 |
62 | @Override
63 | public String toString(){
64 | return JSONUtil.convertObjectToJSON(this);
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Response/StatefulResponseObject.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Response;
2 |
3 | import javax.ws.rs.core.NewCookie;
4 |
5 | public class StatefulResponseObject extends ResponseObject {
6 |
7 | private NewCookie sessionAffinityCookie;
8 |
9 | public NewCookie getSessionAffinityCookie() {
10 | return sessionAffinityCookie;
11 | }
12 |
13 | public void setSessionAffinityCookie(NewCookie sessionAffinityCookie) {
14 | this.sessionAffinityCookie = sessionAffinityCookie;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Response/ThrottleResponse.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Response;
2 |
3 | /**
4 | * The value of the integer corresponding to the number of the successful / failed attempt within the rolling time period
5 | *
6 | */
7 | public class ThrottleResponse extends BaseResponse {
8 |
9 | private String count;
10 |
11 | public String getCount() {
12 | return count;
13 | }
14 |
15 | public void setCount(String count) {
16 | this.count = count;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Response/UserProfileResponse.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Response;
2 |
3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 | import com.fasterxml.jackson.annotation.JsonInclude;
5 | import org.secureauth.sarestapi.data.Response.BaseResponse;
6 | import org.secureauth.sarestapi.data.UserProfile.*;
7 | import org.secureauth.sarestapi.util.JSONUtil;
8 |
9 | import javax.xml.bind.annotation.XmlRootElement;
10 | import java.util.ArrayList;
11 | import java.util.HashMap;
12 | import java.util.LinkedHashMap;
13 | import java.util.List;
14 | import java.util.Map;
15 |
16 | /**
17 | * Created by rrowcliffe on 5/1/16.
18 | */
19 | @XmlRootElement
20 | @JsonInclude(JsonInclude.Include.NON_NULL)
21 | @JsonIgnoreProperties(ignoreUnknown = true)
22 | public class UserProfileResponse extends BaseResponse{
23 | private String userId;
24 | private Map properties = new HashMap<>();
25 | private Map knowledgeBase = new LinkedHashMap<>();
26 | private List groups = new ArrayList<>();
27 | private List accessHistories = new ArrayList<>();
28 |
29 | public String getUserId() {
30 | return userId;
31 | }
32 |
33 | public void setUserId(String userId) {
34 | this.userId = userId;
35 | }
36 |
37 | public Map getProperties() {
38 | return properties;
39 | }
40 |
41 | public void setProperties(HashMap properties) {
42 | this.properties = properties;
43 | }
44 |
45 | public Map getKnowledgeBase() {
46 | return knowledgeBase;
47 | }
48 |
49 | public void setKnowledgeBase(HashMap knowledgeBase) {
50 | this.knowledgeBase = knowledgeBase;
51 | }
52 |
53 | public List getGroups() {
54 | return groups;
55 | }
56 |
57 | public void setGroups(List groups) {
58 | this.groups = groups;
59 | }
60 |
61 | public List getAccessHistories() {
62 | return accessHistories;
63 | }
64 |
65 | public void setAccessHistories(List accessHistories) {
66 | this.accessHistories = accessHistories;
67 | }
68 |
69 | @Override
70 | public String toString(){
71 | return JSONUtil.convertObjectToJSON(this);
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/Response/ValidateOTPResponse.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.Response;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import org.secureauth.sarestapi.util.JSONUtil;
5 |
6 | import javax.xml.bind.annotation.XmlRootElement;
7 |
8 | /**
9 | * Created by rrowcliffe on 5/8/16.
10 | */
11 | @XmlRootElement
12 | @JsonInclude(JsonInclude.Include.NON_NULL)
13 | public class ValidateOTPResponse {
14 | private String status;
15 | private String message;
16 |
17 | public String getStatus() {
18 | return status;
19 | }
20 |
21 | public void setStatus(String status) {
22 | this.status = status;
23 | }
24 |
25 | public String getMessage() {
26 | return message;
27 | }
28 |
29 | public void setMessage(String message) {
30 | this.message = message;
31 | }
32 |
33 |
34 | @Override
35 | public String toString(){
36 | return JSONUtil.convertObjectToJSON(this);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/SAAuth.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data;
2 |
3 | /**
4 | * @author rrowcliffe@secureauth.com
5 | *
6 | Copyright (c) 2015, SecureAuth
7 | All rights reserved.
8 |
9 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
10 |
11 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
12 |
13 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
14 |
15 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
19 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20 | */
21 |
22 | public class SAAuth {
23 | private String applicationID;
24 | private String applicationKey;
25 | private String realm;
26 |
27 | public SAAuth(){}
28 |
29 | public SAAuth(String applicationID,String applicationKey, String realm){
30 | this.applicationID=applicationID;
31 | this.applicationKey=applicationKey;
32 | this.realm=realm;
33 | }
34 |
35 | public String getApplicationID() {
36 | return applicationID;
37 | }
38 |
39 | public void setApplicationID(String applicationID) {
40 | this.applicationID = applicationID;
41 | }
42 |
43 | public String getApplicationKey() {
44 | return applicationKey;
45 | }
46 |
47 | public void setApplicationKey(String applicationKey) {
48 | this.applicationKey = applicationKey;
49 | }
50 |
51 | public String getRealm() {
52 | return realm;
53 | }
54 |
55 | public void setRealm(String realm) {
56 | this.realm = realm;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/SAConfig.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data;
2 |
3 | import java.util.Hashtable;
4 |
5 | public class SAConfig {
6 | private Hashtable config;
7 | private Boolean oldIdpSupport = false;
8 | private static volatile SAConfig instance = null;
9 |
10 | private SAConfig () {
11 |
12 | }
13 |
14 | public static synchronized SAConfig getInstance() {
15 | if (instance == null) {
16 | instance = new SAConfig();
17 | }
18 | return instance;
19 | }
20 |
21 | public void updateConfig( Hashtable newConfig ) {
22 | config = newConfig;
23 | oldIdpSupport = (Boolean) config.get("support.deprecated.idp");
24 | }
25 |
26 | public Boolean getOldIdPSupport() {
27 | return oldIdpSupport;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/UserProfile/NewUserProfile.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.UserProfile;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 |
5 | import javax.xml.bind.annotation.XmlRootElement;
6 | import java.util.HashMap;
7 | import java.util.LinkedHashMap;
8 | import java.util.Map;
9 | import java.util.TreeMap;
10 |
11 | /**
12 | * Created by rrowcliffe on 5/2/16.
13 | */
14 | @XmlRootElement
15 | @JsonInclude(JsonInclude.Include.NON_NULL)
16 | public class NewUserProfile {
17 | private String userId;
18 | private String password;
19 | private NewUserProfileProperties properties;
20 | private Map knowledgeBase = new LinkedHashMap<>();
21 | private UserProfileGroups groups;
22 | private UserProfileAccessHistories accessHistories;
23 |
24 | public String getUserId() {
25 | return userId;
26 | }
27 |
28 | public void setUserId(String userId) {
29 | this.userId = userId;
30 | }
31 |
32 | public String getPassword() {
33 | return password;
34 | }
35 |
36 | public void setPassword(String password) {
37 | this.password = password;
38 | }
39 |
40 | public NewUserProfileProperties getProperties() {
41 | return properties;
42 | }
43 |
44 | public void setProperties(NewUserProfileProperties properties) {
45 | this.properties = properties;
46 | }
47 |
48 | public Map getKnowledgeBase() {
49 | return knowledgeBase;
50 | }
51 |
52 | public void setKnowledgeBase(Map knowledgeBase) {
53 | this.knowledgeBase = knowledgeBase;
54 | }
55 |
56 | public UserProfileGroups getGroups() {
57 | return groups;
58 | }
59 |
60 | public void setGroups(UserProfileGroups groups) {
61 | this.groups = groups;
62 | }
63 |
64 | public UserProfileAccessHistories getAccessHistories() {
65 | return accessHistories;
66 | }
67 |
68 | public void setAccessHistories(UserProfileAccessHistories accessHistories) {
69 | this.accessHistories = accessHistories;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/UserProfile/UserProfile.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.UserProfile;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 |
5 | import javax.xml.bind.annotation.XmlRootElement;
6 | import java.util.HashMap;
7 | import java.util.LinkedHashMap;
8 | import java.util.Map;
9 | import java.util.TreeMap;
10 |
11 | /**
12 | * Created by rrowcliffe on 5/2/16.
13 | */
14 | @XmlRootElement
15 | @JsonInclude(JsonInclude.Include.NON_NULL)
16 | public class UserProfile {
17 | private Map properties = new LinkedHashMap<>();
18 | private UserProfileKBAKBQ knowledgeBase;
19 | private UserProfileGroups groups;
20 | private UserProfileAccessHistories accessHistories;
21 |
22 | public Map getProperties() {
23 | return properties;
24 | }
25 |
26 | public void setProperties(Map properties) {
27 | this.properties = properties;
28 | }
29 |
30 | public UserProfileKBAKBQ getKnowledgeBase() {
31 | return knowledgeBase;
32 | }
33 |
34 | public void setKnowledgeBase(UserProfileKBAKBQ knowledgeBase) {
35 | this.knowledgeBase = knowledgeBase;
36 | }
37 |
38 | public UserProfileGroups getGroups() {
39 | return groups;
40 | }
41 |
42 | public void setGroups(UserProfileGroups groups) {
43 | this.groups = groups;
44 | }
45 |
46 | public UserProfileAccessHistories getAccessHistories() {
47 | return accessHistories;
48 | }
49 |
50 | public void setAccessHistories(UserProfileAccessHistories accessHistories) {
51 | this.accessHistories = accessHistories;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/UserProfile/UserProfileAccessHistories.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.UserProfile;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 |
5 | import javax.xml.bind.annotation.XmlRootElement;
6 | import java.util.ArrayList;
7 |
8 | /**
9 | * Created by rrowcliffe on 5/1/16.
10 | */
11 | @XmlRootElement(name="accessHistories")
12 | @JsonInclude(JsonInclude.Include.NON_NULL)
13 | public class UserProfileAccessHistories {
14 | private ArrayList accessHistories = new ArrayList<>();
15 |
16 | public ArrayList getAccessHistories() {
17 | return accessHistories;
18 | }
19 |
20 | public void setAccessHistories(ArrayList accessHistories) {
21 | this.accessHistories = accessHistories;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/UserProfile/UserProfileAccessHistory.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.UserProfile;
2 |
3 | /**
4 | * Created by rrowcliffe on 5/1/16.
5 | */
6 | public class UserProfileAccessHistory {
7 |
8 | private String userAgent;
9 | private String ipAddress;
10 | private String timeStamp;
11 | private String authState;
12 |
13 | public String getUserAgent() {
14 | return userAgent;
15 | }
16 |
17 | public void setUserAgent(String userAgent) {
18 | this.userAgent = userAgent;
19 | }
20 |
21 | public String getIpAddress() {
22 | return ipAddress;
23 | }
24 |
25 | public void setIpAddress(String ipAddress) {
26 | this.ipAddress = ipAddress;
27 | }
28 |
29 | public String getTimeStamp() {
30 | return timeStamp;
31 | }
32 |
33 | public void setTimeStamp(String timeStamp) {
34 | this.timeStamp = timeStamp;
35 | }
36 |
37 | public String getAuthState() {
38 | return authState;
39 | }
40 |
41 | public void setAuthState(String authState) {
42 | this.authState = authState;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/UserProfile/UserProfileGroups.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.UserProfile;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 |
5 | import javax.xml.bind.annotation.XmlRootElement;
6 | import java.util.ArrayList;
7 |
8 | /**
9 | * Created by rrowcliffe on 5/1/16.
10 | */
11 | @XmlRootElement(name="groups")
12 | @JsonInclude(JsonInclude.Include.NON_NULL)
13 | public class UserProfileGroups {
14 |
15 | private ArrayList groups = new ArrayList<>();
16 |
17 | public ArrayList getGroups() {
18 | return groups;
19 | }
20 |
21 | public void setGroups(ArrayList groups) {
22 | this.groups = groups;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/UserProfile/UserProfileKB.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.UserProfile;
2 |
3 | import java.util.HashMap;
4 |
5 | /**
6 | * Created by rrowcliffe on 5/1/16.
7 | */
8 | public class UserProfileKB {
9 | private String question;
10 | private String answer;
11 |
12 | public UserProfileKB(String question, String answer) {
13 | this.question = question;
14 | this.answer = answer;
15 | }
16 |
17 | public UserProfileKB() {
18 | }
19 |
20 | public String getQuestion() {
21 | return question;
22 | }
23 |
24 | public void setQuestion(String question) {
25 | this.question = question;
26 | }
27 |
28 | public String getAnswer() {
29 | return answer;
30 | }
31 |
32 | public void setAnswer(String answer) {
33 | this.answer = answer;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/UserProfile/UserProfileKBAKBQ.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.UserProfile;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 |
5 | import javax.xml.bind.annotation.XmlRootElement;
6 | import java.util.HashMap;
7 | import java.util.LinkedHashMap;
8 | import java.util.Map;
9 |
10 | /**
11 | * Created by rrowcliffe on 5/1/16.
12 | */
13 | @XmlRootElement(name="knowledgeBase")
14 | @JsonInclude(JsonInclude.Include.NON_NULL)
15 | public class UserProfileKBAKBQ {
16 |
17 | private Map knowledgeBase = new LinkedHashMap<>();
18 |
19 |
20 | public Map getKnowledgeBase() {
21 | return knowledgeBase;
22 | }
23 |
24 | public void setKnowledgeBase(Map knowledgeBase) {
25 | this.knowledgeBase = knowledgeBase;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/UserProfile/UserProfileProperties.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.UserProfile;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 |
5 | import javax.xml.bind.annotation.XmlRootElement;
6 | import java.util.HashMap;
7 |
8 | /**
9 | * Created by rrowcliffe on 5/1/16.
10 | */
11 | @XmlRootElement(name="properties")
12 | @JsonInclude(JsonInclude.Include.NON_NULL)
13 | public class UserProfileProperties {
14 |
15 | private HashMap properties = new HashMap<>();
16 |
17 | public HashMap getProperties() {
18 | return properties;
19 | }
20 |
21 | public void setProperties(HashMap properties) {
22 | this.properties = properties;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/UserProfile/UserProfileProperty.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.UserProfile;
2 |
3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 | import com.fasterxml.jackson.annotation.JsonInclude;
5 |
6 | /**
7 | * Created by rrowcliffe on 5/1/16.
8 | */
9 | @JsonInclude(JsonInclude.Include.NON_NULL)
10 | @JsonIgnoreProperties(ignoreUnknown = true)
11 | public class UserProfileProperty {
12 | private String value;
13 | private String isWritable;
14 | private String displayName;
15 | private String isEncrypted;
16 |
17 | public String getValue() {
18 | return value;
19 | }
20 |
21 | public void setValue(String value) {
22 | this.value = value;
23 | }
24 |
25 | public String getIsWritable() {
26 | return isWritable;
27 | }
28 |
29 | public void setIsWritable(String isWritable) {
30 | this.isWritable = isWritable;
31 | }
32 |
33 | public String getDisplayName() {
34 | return displayName;
35 | }
36 |
37 | public void setDisplayName(String displayName) {
38 | this.displayName = displayName;
39 | }
40 |
41 | public String getIsEncrypted() { return isEncrypted; }
42 |
43 | public void setIsEncrypted(String isEncrypted) { this.isEncrypted = isEncrypted; }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/UserProfile/UserToGroups.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.UserProfile;
2 |
3 | import java.util.Arrays;
4 |
5 | /**
6 | * Created by rrowcliffe on 5/8/16.
7 | */
8 | public class UserToGroups {
9 | private String[] groupNames;
10 |
11 | public UserToGroups(){}
12 |
13 | public UserToGroups(String... groupNames) {
14 | this.groupNames = groupNames;
15 | }
16 |
17 | public String[] getGroupNames() {
18 | return groupNames.clone();
19 | }
20 |
21 | public void setGroupNames(String... groupNames) {
22 | this.groupNames = Arrays.copyOf(groupNames, groupNames.length);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/data/UserProfile/UsersToGroup.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.data.UserProfile;
2 |
3 | import java.util.Arrays;
4 |
5 | /**
6 | * Created by rrowcliffe on 5/8/16.
7 | */
8 | public class UsersToGroup {
9 | private String[] userIds;
10 |
11 | public UsersToGroup(){}
12 |
13 | public UsersToGroup(String... userIds) {
14 | this.userIds = userIds;
15 | }
16 |
17 | public String[] getUserIds() {
18 | return userIds.clone();
19 | }
20 |
21 | public void setUserIds(String... userIds) {
22 | this.userIds = Arrays.copyOf(userIds, userIds.length);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/exception/SARestAPIException.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.exception;
2 |
3 | public class SARestAPIException extends RuntimeException {
4 |
5 | private static final long serialVersionUID = 2201204523946051388L;
6 |
7 | public SARestAPIException(String message) {
8 | super(message);
9 | }
10 |
11 | public SARestAPIException(String message, Throwable e) {
12 | super(message, e);
13 | }
14 |
15 | public SARestAPIException(String s, Exception e) {
16 | super(s,e);
17 | }
18 |
19 | public SARestAPIException(Exception exception) {
20 | super("Exception occurred executing REST query:\n" + exception.getMessage(), exception);
21 | }
22 | }
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/filters/SACheckRequestFilter.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.filters;
2 |
3 | import javax.ws.rs.client.ClientRequestContext;
4 | import javax.ws.rs.client.ClientRequestFilter;
5 | import javax.ws.rs.core.MediaType;
6 | import javax.ws.rs.core.Response;
7 | import java.io.IOException;
8 | import java.text.SimpleDateFormat;
9 | import java.util.Calendar;
10 | import java.util.Locale;
11 | import java.util.TimeZone;
12 |
13 | /**
14 | * Created by rrowcliffe on 5/6/16.
15 | */
16 | public class SACheckRequestFilter implements ClientRequestFilter {
17 |
18 | @Override
19 | public void filter(ClientRequestContext requestContext) throws IOException {
20 | if (requestContext.getHeaders().get("Authorization") == null) {
21 | requestContext.abortWith(Response.status(Response.Status.BAD_REQUEST).entity("Authorization header must be defined.").build());
22 | }
23 |
24 | //Moved all TimeStamp Header setting to Filter Controlled
25 | //if(!requestContext.getHeaders().containsKey("X-SA-Ext-Date")){
26 | // requestContext.getHeaders().add("X-SA-Ext-Date", getServerTimeMs());
27 | //}
28 | //Technically we should never get this point
29 | if (!requestContext.getHeaders().containsKey("X-SA-Date") && !requestContext.getHeaders().containsKey("X-SA-Ext-Date")){
30 | requestContext.abortWith(Response.status(Response.Status.BAD_REQUEST).entity("X-SA-Date or X-SA-Ext-Date header must be defined.").build());
31 | }
32 |
33 | }
34 |
35 | String getServerTimeMs() {
36 | Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
37 | SimpleDateFormat dateFormat = new SimpleDateFormat(
38 | "EEE, dd MMM yyyy HH:mm:ss.SSS z", Locale.US);
39 | dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
40 | return dateFormat.format(calendar.getTime());
41 | }
42 |
43 | //Just in case we want to force the second version timestamp for older versions of IDP
44 | String getServerTimeSeconds() {
45 | Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
46 | SimpleDateFormat dateFormat = new SimpleDateFormat(
47 | "EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
48 | dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
49 | return dateFormat.format(calendar.getTime());
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/guid/GUIDStrategy.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.guid;
2 |
3 | import java.util.UUID;
4 |
5 | public interface GUIDStrategy {
6 |
7 | UUID generateRequestID();
8 | }
9 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/guid/XRequestIDFilter.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.guid;
2 |
3 | import javax.ws.rs.client.ClientRequestContext;
4 | import javax.ws.rs.client.ClientRequestFilter;
5 |
6 | public class XRequestIDFilter implements ClientRequestFilter {
7 |
8 | private String transactionId;
9 |
10 | public XRequestIDFilter(String transactionId) {
11 | this.transactionId = transactionId;
12 | }
13 |
14 | @Override
15 | public void filter(ClientRequestContext requestContext) {
16 | requestContext.getHeaders().putSingle( "X-Request-ID", this.transactionId );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/interfaces/AdHocInterface.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.interfaces;
2 |
3 | import org.secureauth.sarestapi.SAAccess;
4 | import org.secureauth.sarestapi.data.Response.ResponseObject;
5 |
6 | /**
7 | * Created by rrowcliffe on 5/6/16.
8 | */
9 | public interface AdHocInterface {
10 |
11 | ResponseObject sendAdHocSmsOTP(SAAccess saAccess, String userId, String phoneNumber);
12 |
13 | ResponseObject sendAdHocPhoneOTP(SAAccess saAccess, String userId, String phoneNumber);
14 |
15 | ResponseObject sendAdHocEmailOTP(SAAccess saAccess, String userId, String emailAddress);
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/interfaces/AdaptiveAuthenticationInterface.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.interfaces;
2 |
3 | import org.secureauth.sarestapi.SAAccess;
4 | import org.secureauth.sarestapi.data.IPEval;
5 | import org.secureauth.sarestapi.data.Response.ResponseObject;
6 |
7 | /**
8 | * Created by rrowcliffe on 5/7/16.
9 | */
10 | public interface AdaptiveAuthenticationInterface {
11 |
12 | IPEval ipThreatCheck(SAAccess saAccess, String userid, String ip_address);
13 |
14 | ResponseObject updateAccessHistories(SAAccess saAccess, String user, String ip_address);
15 |
16 | ResponseObject submitAdaptiveAuth(SAAccess saAccess, String user, String ipAddress);
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/interfaces/AuthenticationInterface.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.interfaces;
2 |
3 | import org.secureauth.sarestapi.SAAccess;
4 | import org.secureauth.sarestapi.data.Response.BaseResponse;
5 | import org.secureauth.sarestapi.data.Response.FactorsResponse;
6 | import org.secureauth.sarestapi.data.Response.ResponseObject;
7 | import org.secureauth.sarestapi.data.Response.ThrottleResponse;
8 | import org.secureauth.sarestapi.data.Response.ValidateOTPResponse;
9 |
10 | /**
11 | * Created by rrowcliffe on 5/6/16.
12 | */
13 | public interface AuthenticationInterface {
14 |
15 | BaseResponse validateUser(SAAccess saAccess, String userId);
16 |
17 | BaseResponse validatePassword(SAAccess saAccess, String userId, String password);
18 |
19 | FactorsResponse getFactorsForUser(SAAccess saAccess, String userId);
20 |
21 | BaseResponse validateOath(SAAccess saAccess, String userId, String otp, String factorId);
22 |
23 | ResponseObject validatePushOTP(SAAccess saAccess, String userId, String factorId);
24 |
25 | ResponseObject sendSmsOTP(SAAccess saAccess, String userId, String factorId);
26 |
27 | ResponseObject sendPhoneOTP(SAAccess saAccess, String userId, String factorId);
28 |
29 | ResponseObject sendHelpDeskOTP(SAAccess saAccess, String userid, String factorId);
30 |
31 | ResponseObject sendEmailOTP(SAAccess saAccess, String userId, String factorId);
32 |
33 | BaseResponse validateKBQ(SAAccess saAccess, String userId, String answer, String factorId);
34 |
35 | BaseResponse validatePin(SAAccess saAccess, String userId, String pin);
36 |
37 | ValidateOTPResponse validateOTP(SAAccess saAccess, String userId, String otp);
38 |
39 | ThrottleResponse sendResetThrottleReq(SAAccess saAccess, String userId);
40 |
41 | ThrottleResponse sendResetThrottleReqQP(SAAccess saAccess, String userId);
42 |
43 | void PushToAccept(SAAccess saAccess, String user, String factorID, String ipAddress) throws InterruptedException;
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/interfaces/BehaveBioInterface.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.interfaces;
2 |
3 | import org.secureauth.sarestapi.SAAccess;
4 | import org.secureauth.sarestapi.data.Response.BehaveBioResponse;
5 | import org.secureauth.sarestapi.data.Response.JSObjectResponse;
6 | import org.secureauth.sarestapi.data.Response.ResponseObject;
7 |
8 | /**
9 | * Created by rrowcliffe on 5/6/16.
10 | */
11 | public interface BehaveBioInterface {
12 |
13 | JSObjectResponse getBehaveBioJavaScriptSrc(SAAccess saAccess);
14 |
15 | BehaveBioResponse submitBehaveBioProfile(SAAccess saAccess,String userid, String behaviorProfile, String hostAddress, String userAgent);
16 |
17 | ResponseObject resetBehaveBioProfile(SAAccess saAccess, String userid, String fieldName, String fieldType, String deviceType);
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/interfaces/DeviceRecognitionInterface.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.interfaces;
2 |
3 | import org.secureauth.sarestapi.SAAccess;
4 | import org.secureauth.sarestapi.data.Response.DFPConfirmResponse;
5 | import org.secureauth.sarestapi.data.Response.DFPValidateResponse;
6 | import org.secureauth.sarestapi.data.Response.JSObjectResponse;
7 |
8 | /**
9 | * Created by rrowcliffe on 5/8/16.
10 | */
11 | public interface DeviceRecognitionInterface {
12 |
13 | JSObjectResponse getDFPJavaScriptSrc(SAAccess saAccess);
14 |
15 | DFPConfirmResponse confirmDeviceRecognition(SAAccess saAccess, String userid, String fingerprint_id);
16 |
17 | DFPValidateResponse validateNewDevice(SAAccess saAccess, String userid, String host_address, String jsonString);
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/interfaces/IDMInterface.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.interfaces;
2 |
3 | import org.secureauth.sarestapi.SAAccess;
4 | import org.secureauth.sarestapi.data.Response.GroupAssociationResponse;
5 | import org.secureauth.sarestapi.data.Response.ResponseObject;
6 | import org.secureauth.sarestapi.data.Response.UserProfileResponse;
7 | import org.secureauth.sarestapi.data.UserProfile.NewUserProfile;
8 | import org.secureauth.sarestapi.data.UserProfile.UserProfile;
9 | import org.secureauth.sarestapi.data.UserProfile.UserToGroups;
10 | import org.secureauth.sarestapi.data.UserProfile.UsersToGroup;
11 |
12 | /**
13 | * Created by rrowcliffe on 5/8/16.
14 | */
15 | public interface IDMInterface {
16 |
17 | ResponseObject createUser(SAAccess saAccess, NewUserProfile newUserProfile);
18 |
19 | ResponseObject updateUser(SAAccess saAccess, String userId, NewUserProfile newUserProfile);
20 |
21 | ResponseObject updateUserQP(SAAccess saAccess, String userId, NewUserProfile newUserProfile);
22 |
23 | ResponseObject addUserToGroup(SAAccess saAccess, String userId, String groupName);
24 |
25 | GroupAssociationResponse addUsersToGroup(SAAccess saAccess, UsersToGroup usersToGroup, String groupName);
26 |
27 | GroupAssociationResponse addGroupToUser(SAAccess saAccess, String groupName, String userid);
28 |
29 | GroupAssociationResponse addUserToGroups(SAAccess saAccess, String userId, UserToGroups userToGroups);
30 |
31 | UserProfileResponse getUserProfile(SAAccess saAccess, String userId);
32 |
33 | ResponseObject passwordReset(SAAccess saAccess, String userId, String password);
34 |
35 | ResponseObject passwordResetQP(SAAccess saAccess, String userId, String password);
36 |
37 | ResponseObject passwordChange(SAAccess saAccess, String userId, String currentPassword, String newPassword);
38 |
39 | ResponseObject passwordChangeQP(SAAccess saAccess, String userId, String currentPassword, String newPassword);
40 |
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/interfaces/PhoneNumberProfileInterface.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.interfaces;
2 |
3 | import org.secureauth.sarestapi.SAAccess;
4 | import org.secureauth.sarestapi.data.Response.*;
5 |
6 | /**
7 | * Created by rrowcliffe on 5/6/16.
8 | */
9 | public interface PhoneNumberProfileInterface {
10 |
11 | NumberProfileResponse submitPhoneNumber(SAAccess saAccess, String userid, String phone_number);
12 |
13 | BaseResponse updatePhoneNumberProfile(SAAccess saAccess, String userid, String phone_number, String portedStatus, String carrierCode, String carrier, String countryCode, String networkType);
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/main/api/DiagnosticApi.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.main.api;
2 |
3 | import org.secureauth.sarestapi.ISAAccess;
4 |
5 | public interface DiagnosticApi {
6 |
7 | Object run(Parameters parameters, ISAAccess saAccess);
8 |
9 | String printHelp();
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/main/api/HelpBuilder.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.main.api;
2 |
3 | public class HelpBuilder {
4 | private StringBuffer message = new StringBuffer();
5 |
6 | public HelpBuilder mandatory(String parameterName) {
7 | this.message.append( parameterName );
8 | this.message.append( " is mandatory.\n" );
9 | return this;
10 | }
11 |
12 | public HelpBuilder optional(String parameterName, String defaultValue) {
13 | this.message.append( parameterName );
14 | this.message.append( " is optional : the default value " );
15 | this.message.append( defaultValue );
16 | this.message.append( " is set if omitted.\n" );
17 | return this;
18 | }
19 |
20 | public HelpBuilder optional(String parameterName) {
21 | this.message.append( parameterName );
22 | this.message.append( " is optional.\n" );
23 | return this;
24 | }
25 |
26 | public String print() {
27 | return this.message.toString();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/main/api/NoImplementedYetApi.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.main.api;
2 |
3 | import org.secureauth.sarestapi.ISAAccess;
4 |
5 | import java.util.Set;
6 |
7 | public class NoImplementedYetApi implements DiagnosticApi {
8 | private String service;
9 | private Set availableServices;
10 |
11 | public NoImplementedYetApi(String service, Set availableServices) {
12 | this.service = service;
13 | this.availableServices = availableServices;
14 | }
15 |
16 | @Override
17 | public Object run(Parameters parameters, ISAAccess saAccess) {
18 | return this.printHelp();
19 | }
20 |
21 | @Override
22 | public String printHelp() {
23 | return this.service + " is not implemented yet. Implemented services are : " + this.availableServices;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/main/api/Parameters.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.main.api;
2 |
3 | import com.google.common.base.Strings;
4 | import com.google.common.collect.Maps;
5 |
6 | import java.util.Map;
7 | import java.util.stream.Stream;
8 |
9 | public class Parameters {
10 | private final Map paramsMap;
11 |
12 | public Parameters(final String[] args, final String delimiter) {
13 | this.paramsMap = getParametersFrom( args, delimiter );
14 | }
15 |
16 | public String getOrDefault(final String key, final String defaultValue) {
17 | return this.paramsMap.getOrDefault( key, defaultValue );
18 | }
19 |
20 | public String getMandatory(final String key) throws IllegalArgumentException {
21 | final String value = this.paramsMap.get( key );
22 | if( Strings.isNullOrEmpty( value ) ) {
23 | throw new IllegalArgumentException( key + " is not provided and it is mandatory" );
24 | }
25 | return value;
26 | }
27 |
28 | private static Map getParametersFrom(final String [] args, final String delimiter) {
29 | Map params = Maps.newHashMap();
30 | for(int paramNumber=0; paramNumber < args.length; paramNumber++) {
31 | String[] paramAndValue = args[ paramNumber ].split( delimiter );
32 | // help is used for service information.
33 | if ( addParameterAsFlagIfApply( args[ paramNumber ], params, "help", "stacktrace" ) ) {
34 | continue;
35 | }
36 | if( paramAndValue.length != 2) {
37 | // ignore when the parameter format ( key-> value ) is not valid
38 | System.out.println( args[ paramNumber ] + " is invalid and will be ignored." );
39 | continue;
40 | }
41 | params.put( paramAndValue[0], paramAndValue[1]);
42 | }
43 | return params;
44 | }
45 |
46 | private static boolean addParameterAsFlagIfApply(final String currentParam, Map params, String ...flagNames) {
47 | if ( Stream.of( flagNames ).anyMatch( name -> name.equalsIgnoreCase( currentParam ) ) ) {
48 | params.put( currentParam, "true" );
49 | return true;
50 | }
51 | return false;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/main/api/fingerprint/DFPApi.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.main.api.fingerprint;
2 |
3 | import org.secureauth.sarestapi.ISAAccess;
4 | import org.secureauth.sarestapi.data.Response.DFPValidateResponse;
5 | import org.secureauth.sarestapi.main.api.DiagnosticApi;
6 | import org.secureauth.sarestapi.main.api.HelpBuilder;
7 | import org.secureauth.sarestapi.main.api.Parameters;
8 |
9 | import java.io.IOException;
10 | import java.nio.file.Files;
11 | import java.nio.file.Paths;
12 |
13 | public class DFPApi implements DiagnosticApi {
14 |
15 | private static final String FINGERPRINT_JSON_PATH = "fingerprint_json_path";
16 | private static final String USER_ID = "user_id";
17 | private static final String HOST = "host";
18 | private static final String FINGERPRINT_ID = "fingerprint_id";
19 | private static final String DEFAULT_FINGERPRINT_JSON_PATH = "configuration/dfp/fingerprint.json";
20 |
21 | @Override
22 | public Object run(Parameters parameters, ISAAccess saAccess) {
23 | final String jsonPath = parameters.getOrDefault( FINGERPRINT_JSON_PATH, DEFAULT_FINGERPRINT_JSON_PATH );
24 | try {
25 | final String fingerprint_json = readFromFile( jsonPath );
26 | DFPValidateResponse response = saAccess.DFPSaveFingerprint(
27 | parameters.getMandatory( USER_ID ),
28 | parameters.getMandatory( HOST ),
29 | parameters.getOrDefault( FINGERPRINT_ID, ""),
30 | fingerprint_json);
31 | return response.toString();
32 | } catch (IOException exc) {
33 | throw new RuntimeException( exc );
34 | }
35 | }
36 |
37 | @Override
38 | public String printHelp() {
39 | return new HelpBuilder()
40 | .mandatory( USER_ID )
41 | .mandatory( HOST )
42 | .optional( FINGERPRINT_JSON_PATH, DEFAULT_FINGERPRINT_JSON_PATH )
43 | .optional( FINGERPRINT_ID )
44 | .print();
45 | }
46 |
47 | private String readFromFile(final String path) throws IOException {
48 | return Files.lines( Paths.get( path ) ).reduce( "", (line1, line2) -> line1 + line2 );
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/main/api/users/UsersProfileApi.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.main.api.users;
2 |
3 | import org.secureauth.sarestapi.ISAAccess;
4 | import org.secureauth.sarestapi.main.api.DiagnosticApi;
5 | import org.secureauth.sarestapi.main.api.HelpBuilder;
6 | import org.secureauth.sarestapi.main.api.Parameters;
7 |
8 | public class UsersProfileApi implements DiagnosticApi {
9 |
10 | private final static String USER_ID = "user_id";
11 |
12 | @Override
13 | public Object run(Parameters parameters, ISAAccess saAccess) {
14 | return saAccess.getUserProfile( parameters.getMandatory( USER_ID ) );
15 | }
16 |
17 | @Override
18 | public String printHelp() {
19 | return new HelpBuilder()
20 | .mandatory( USER_ID )
21 | .print();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/main/api/users/UsersProfileQPApi.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.main.api.users;
2 |
3 | import org.secureauth.sarestapi.ISAAccess;
4 | import org.secureauth.sarestapi.main.api.DiagnosticApi;
5 | import org.secureauth.sarestapi.main.api.HelpBuilder;
6 | import org.secureauth.sarestapi.main.api.Parameters;
7 |
8 | public class UsersProfileQPApi implements DiagnosticApi {
9 |
10 | private final static String USER_ID = "user_id";
11 |
12 | @Override
13 | public Object run(Parameters parameters, ISAAccess saAccess) {
14 | return saAccess.getUserProfileQP( parameters.getMandatory( USER_ID ) );
15 | }
16 |
17 | @Override
18 | public String printHelp() {
19 | return new HelpBuilder()
20 | .mandatory( USER_ID )
21 | .print();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/queries/AccessHistoryQuery.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.queries;
2 |
3 | import org.secureauth.sarestapi.resources.Resource;
4 |
5 | /**
6 | * @author rrowcliffe@secureauth.com
7 | *
8 | *
9 | Copyright (c) 2015, SecureAuth
10 | All rights reserved.
11 |
12 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
13 |
14 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
15 |
16 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
17 |
18 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | */
24 |
25 | public final class AccessHistoryQuery {
26 |
27 | private AccessHistoryQuery(){}
28 |
29 | public static String queryAccessHistory(String realm){
30 | return realm + Resource.APPLIANCE_ACCESSHISTORY;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/queries/AuthQuery.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.queries;
2 |
3 | import org.secureauth.sarestapi.resources.Resource;
4 |
5 | /**
6 | * @author rrowcliffe@secureauth.com
7 | *
8 | *
9 | Copyright (c) 2015, SecureAuth
10 | All rights reserved.
11 |
12 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
13 |
14 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
15 |
16 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
17 |
18 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | */
24 |
25 | public final class AuthQuery {
26 |
27 | private AuthQuery(){}
28 |
29 | public static String queryAuth(String realm){
30 | return realm + Resource.APPLIANCE_AUTH;
31 | }
32 |
33 | public static String queryAAuth(String realm){
34 | return realm + Resource.APPLIANCE_AAUTH;
35 | }
36 |
37 | public static String queryAuthLink(String realm, String linkId){
38 | return realm + Resource.APPLIANCE_AUTH_LINK + linkId;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/queries/BehaveBioQuery.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.queries;
2 |
3 | import org.secureauth.sarestapi.resources.Resource;
4 |
5 | /**
6 | * @author rrowcliffe@secureauth.com
7 | *
8 | *
9 | Copyright (c) 2015, SecureAuth
10 | All rights reserved.
11 |
12 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
13 |
14 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
15 |
16 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
17 |
18 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | */
24 |
25 | public final class BehaveBioQuery {
26 |
27 | private BehaveBioQuery(){}
28 |
29 | public static String queryBehaveBiojs(String realm){
30 | return realm + Resource.APPLIANCE_BEHAVEBIO_JS;
31 | }
32 |
33 | public static String queryBehaveBio(String realm){
34 | return realm + Resource.APPLIANCE_BEHAVEBIO;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/queries/DFPQuery.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.queries;
2 |
3 | import org.secureauth.sarestapi.resources.Resource;
4 |
5 | /**
6 | * @author rrowcliffe@secureauth.com
7 | *
8 | *
9 | Copyright (c) 2015, SecureAuth
10 | All rights reserved.
11 |
12 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
13 |
14 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
15 |
16 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
17 |
18 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | */
24 |
25 | public final class DFPQuery {
26 |
27 | private DFPQuery(){}
28 |
29 | public static String queryDFPjs(String realm){
30 | return realm + Resource.APPLIANCE_DFP_JS;
31 | }
32 |
33 | public static String queryDFPValidate(String realm){
34 | return realm + Resource.APPLIANCE_DFP_VALIDATE;
35 | }
36 |
37 | public static String queryDFPConfirm(String realm){
38 | return realm + Resource.APPLIANCE_DFP_CONFIRM;
39 | }
40 |
41 | public static String queryDFPScore(String realm){
42 | return realm + Resource.APPLIANCE_DFP_SCORE;
43 | }
44 |
45 | public static String queryDFPSave(String realm){
46 | return realm + Resource.APPLIANCE_DFP_SAVE;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/queries/FactorsQuery.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.queries;
2 |
3 | import org.secureauth.sarestapi.resources.Resource;
4 |
5 | /**
6 | * @author rrowcliffe@secureauth.com
7 | *
8 | *
9 | Copyright (c) 2015, SecureAuth
10 | All rights reserved.
11 |
12 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
13 |
14 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
15 |
16 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
17 |
18 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | */
24 |
25 | public final class FactorsQuery {
26 |
27 | private FactorsQuery(){}
28 |
29 | //https://{domain}/{realm}/v1/users/{username}/factors
30 | public static String queryFactors(String realm, String userName){
31 | return realm + Resource.APPLIANCE_USERS + userName + Resource.APPLIANCE_FACTORS;
32 | }
33 |
34 | //https://{domain}/{realm}/v3/users/{username}/factors
35 | public static String queryFactorsV3(String realm, String userName){
36 | return realm + Resource.APPLIANCE_USERS_V3 + userName + Resource.APPLIANCE_FACTORS;
37 | }
38 |
39 | //https://{domain}/{realm}/v1/users/factors?username={username}
40 | public static String queryFactorsQP(String realm) {
41 | return realm + removeLastChar(Resource.APPLIANCE_USERS) + Resource.APPLIANCE_FACTORS;
42 | }
43 |
44 | //https://{domain}/{realm}/v3/users/factors?username={username}
45 | public static String queryFactorsQPV3(String realm) {
46 | return realm + removeLastChar(Resource.APPLIANCE_USERS_V3) + Resource.APPLIANCE_FACTORS;
47 | }
48 |
49 | private static String removeLastChar (String query){
50 | return query.substring(0, query.length()-1);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/queries/IPEvalQuery.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.queries;
2 |
3 | import org.secureauth.sarestapi.resources.Resource;
4 |
5 | /**
6 | * @author rrowcliffe@secureauth.com
7 | *
8 | Copyright (c) 2015, SecureAuth
9 | All rights reserved.
10 |
11 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
12 |
13 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
14 |
15 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
16 |
17 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 | */
23 | public final class IPEvalQuery {
24 |
25 | private IPEvalQuery(){}
26 |
27 | public static String queryIPEval(String realm){
28 | return realm + Resource.APPLIANCE_IPEVAL;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/queries/NumberProfileQuery.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.queries;
2 |
3 | import org.secureauth.sarestapi.resources.Resource;
4 |
5 | /**
6 | * @author rrowcliffe@secureauth.com
7 | *
8 | *
9 | Copyright (c) 2015, SecureAuth
10 | All rights reserved.
11 |
12 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
13 |
14 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
15 |
16 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
17 |
18 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | */
24 |
25 | public final class NumberProfileQuery {
26 |
27 | private NumberProfileQuery(){}
28 |
29 | public static String queryNumberProfile(String realm){
30 | return realm + Resource.APPLIANCE_NUMBERPROFILE;
31 | }
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/queries/StatusQuery.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.queries;
2 |
3 | import org.secureauth.sarestapi.resources.Resource;
4 |
5 | /**
6 | *
7 | */
8 | public final class StatusQuery {
9 |
10 | private StatusQuery(){}
11 |
12 | public static String queryStatus(String realm, String userName){
13 | return realm + Resource.APPLIANCE_USERS + userName + Resource.APPLIANCE_STATUS;
14 | }
15 |
16 | // This method supports special characters for userId since it uses QP (Query Params) in order to create the request.
17 | public static String queryStatusQP(String realm){
18 | return realm + Resource.APPLIANCE_USERS + Resource.APPLIANCE_STATUS;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/queries/ThrottleQuery.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.queries;
2 |
3 | import org.secureauth.sarestapi.resources.Resource;
4 |
5 | public final class ThrottleQuery {
6 |
7 | private ThrottleQuery(){}
8 |
9 | public static String queryThrottles(String realm, String userName){
10 | return realm + Resource.APPLIANCE_USERS + userName + Resource.APPLIANCE_THROTTLE;
11 | }
12 |
13 | // This method supports special characters for userId since it uses QP (Query Params) in order to create the request.
14 | public static String queryThrottlesQP(String realm){
15 | return realm + removeLastChar(Resource.APPLIANCE_USERS) + Resource.APPLIANCE_THROTTLE;
16 | }
17 |
18 | private static String removeLastChar (String query){
19 | return query.substring(0, query.length()-1);
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/queries/ValidateOTPQuery.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.queries;
2 |
3 | import org.secureauth.sarestapi.resources.Resource;
4 |
5 | /**
6 | * @author rrowcliffe@secureauth.com
7 | *
8 | *
9 | Copyright (c) 2015, SecureAuth
10 | All rights reserved.
11 |
12 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
13 |
14 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
15 |
16 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
17 |
18 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | */
24 |
25 | public final class ValidateOTPQuery {
26 |
27 | private ValidateOTPQuery(){}
28 |
29 | public static String queryValidateOTP(String realm){
30 | return realm + Resource.APPLIANCE_OTP_VALIDATE;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/ssl/SATrustManagerFactory.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.ssl;
2 |
3 | import org.secureauth.sarestapi.data.SABaseURL;
4 |
5 | import javax.net.ssl.TrustManager;
6 | import javax.net.ssl.TrustManagerFactory;
7 | import javax.net.ssl.X509TrustManager;
8 | import java.security.KeyStore;
9 | import java.security.KeyStoreException;
10 | import java.security.NoSuchAlgorithmException;
11 | import java.security.cert.CertificateException;
12 | import java.security.cert.X509Certificate;
13 |
14 | public final class SATrustManagerFactory {
15 |
16 | private SATrustManagerFactory(){}
17 |
18 | private static final String PKIX_ALGORITHM = "PKIX";
19 |
20 | public static TrustManager[] createTrustsManagersFor(SABaseURL saBaseURL) throws NoSuchAlgorithmException, KeyStoreException {
21 | if( saBaseURL.isSelfSigned() ) {
22 | // disabled impl.
23 | return new TrustManager[]{
24 | new X509TrustManager() {
25 | @Override
26 | public X509Certificate[] getAcceptedIssuers() {
27 | return null;
28 | }
29 |
30 | @Override
31 | public void checkServerTrusted(X509Certificate[] chain, String authType) {
32 | }
33 |
34 | @Override
35 | public void checkClientTrusted(X509Certificate[] chain, String authType) {
36 | }
37 | }
38 | };
39 | }
40 | // The default implementation for SSLContext :
41 | // A factory for X509ExtendedTrustManager objects that validate certificate chains according
42 | // to the rules defined by the IETF PKIX working group in RFC 5280 or its successor.
43 | // "Internet X.509 Public Key Infrastructure Certificate
44 | // and Certificate Revocation List (CRL) Profile"
45 | // https://tools.ietf.org/html/rfc5280https://tools.ietf.org/html/rfc5280
46 | TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance( PKIX_ALGORITHM );
47 | trustManagerFactory.init( ( KeyStore )null );
48 | return trustManagerFactory.getTrustManagers();
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/util/HMACUtil.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.util;
2 |
3 | import org.apache.commons.codec.binary.Base64;
4 | import org.apache.commons.codec.binary.Hex;
5 |
6 | import java.nio.charset.Charset;
7 | import java.nio.charset.StandardCharsets;
8 |
9 | import javax.crypto.Mac;
10 | import javax.crypto.spec.SecretKeySpec;
11 |
12 | /**
13 | * @author rrowcliffe@secureauth.com
14 | *
15 | Copyright (c) 2015, SecureAuth
16 | All rights reserved.
17 |
18 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
19 |
20 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
21 |
22 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
23 |
24 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
25 |
26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | public final class HMACUtil {
32 |
33 | private HMACUtil(){}
34 |
35 | public static byte[] encode(String secret, String data) throws Exception {
36 | // get the bytes of the hmac key and data string
37 | byte[] secretByte = new Hex(StandardCharsets.UTF_8).decode(secret.getBytes(StandardCharsets.UTF_8));
38 | byte[] dataBytes = data.getBytes(StandardCharsets.UTF_8);
39 |
40 | SecretKeySpec secretKey = new SecretKeySpec(secretByte, "HmacSHA256");
41 | Mac mac = Mac.getInstance("HmacSHA256");
42 | mac.init(secretKey);
43 | byte[] doFinal = mac.doFinal(dataBytes);
44 | return doFinal;
45 | }
46 |
47 | public static String getFinalHmac(String username, String secret, String data) throws Exception {
48 | byte[] orginHmac = encode(secret, data);
49 |
50 | String firstBase64 = new String(Base64.encodeBase64(orginHmac));
51 |
52 | String usernameN64 = username + ":" + firstBase64;
53 |
54 | String secodeBase64 = new String(Base64.encodeBase64(usernameN64.getBytes(StandardCharsets.UTF_8)));
55 |
56 | String authHeader = "Basic " + secodeBase64;
57 |
58 | return authHeader;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/util/TimeUtils.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.util;
2 |
3 | import java.text.SimpleDateFormat;
4 | import java.util.Calendar;
5 | import java.util.Locale;
6 | import java.util.TimeZone;
7 |
8 | public class TimeUtils {
9 |
10 | public static String getServerTime( Boolean oldIdpMode ) {
11 | if (oldIdpMode) return getServerTimeSeconds();
12 | return getServerTimeMs();
13 | }
14 |
15 | static String getServerTimeMs() {
16 | Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
17 | SimpleDateFormat dateFormat = new SimpleDateFormat(
18 | "EEE, dd MMM yyyy HH:mm:ss.SSS z", Locale.US);
19 | dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
20 | return dateFormat.format(calendar.getTime());
21 | }
22 |
23 | // Just in case we want to force the second version timestamp for older versions of IDP
24 | // This may cause sync errors which we fixed using getServerTimeMs
25 | static String getServerTimeSeconds() {
26 | Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
27 | SimpleDateFormat dateFormat = new SimpleDateFormat(
28 | "EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
29 | dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
30 | return dateFormat.format(calendar.getTime());
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/org/secureauth/sarestapi/util/XMLUtil.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.util;
2 |
3 | import javax.xml.bind.JAXBContext;
4 | import javax.xml.bind.JAXBException;
5 | import javax.xml.bind.Marshaller;
6 | import java.io.StringWriter;
7 |
8 | /**
9 | * Created by rrowcliffe on 4/21/16.
10 | */
11 | public final class XMLUtil {
12 | private XMLUtil(){}
13 |
14 | public static String convertObjectToXML(Object object){
15 | JAXBContext jaxbContext = null;
16 | Marshaller jaxbMarshaller = null;
17 | StringWriter stringWriter = new StringWriter();
18 | try {
19 | jaxbContext = JAXBContext.newInstance(object.getClass());
20 | jaxbMarshaller = jaxbContext.createMarshaller();
21 | jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
22 | jaxbMarshaller.marshal(object, stringWriter);
23 | } catch (JAXBException e) {
24 | e.printStackTrace();
25 | }
26 | String xmlString = stringWriter.toString();
27 |
28 | return xmlString;
29 |
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/resources/configuration/configuration.properties:
--------------------------------------------------------------------------------
1 | idp.host=yourendpoint.com
2 | idp.port=443
3 | idp.realm=SecureAuthXXXX
4 | idp.realm.api.application.id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
5 | idp.realm.api.application.key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
6 | idp.ssl=true
--------------------------------------------------------------------------------
/src/test/java/org/secureauth/restapi/test/Impl/AdHocImpl.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.restapi.test.Impl;
2 |
3 | import org.secureauth.sarestapi.SAAccess;
4 |
5 | import org.secureauth.sarestapi.data.Response.ResponseObject;
6 | import org.secureauth.sarestapi.interfaces.AdHocInterface;
7 |
8 | /**
9 | * Created by rrowcliffe on 5/14/16.
10 | */
11 | public class AdHocImpl implements AdHocInterface {
12 |
13 | public AdHocImpl(){}
14 |
15 | @Override
16 | public ResponseObject sendAdHocSmsOTP(SAAccess saAccess, String userid, String phoneNumber) {
17 | ResponseObject smsOTP = saAccess.deliverAdHocOTPBySMS(userid, phoneNumber);
18 | System.out.println("SMS OTP is: " + smsOTP.getOtp());
19 | return smsOTP;
20 | }
21 |
22 | @Override
23 | public ResponseObject sendAdHocPhoneOTP(SAAccess saAccess, String userid, String phoneNumber) {
24 | ResponseObject phoneOTP = saAccess.deliverAdHocOTPByPhone(userid, phoneNumber);
25 | System.out.println("PHONE OTP is: " + phoneOTP.getOtp());
26 | return phoneOTP;
27 | }
28 |
29 | @Override
30 | public ResponseObject sendAdHocEmailOTP(SAAccess saAccess, String userid, String emailAddress) {
31 | ResponseObject emailOTP = saAccess.deliverAdHocOTPByEmail(userid, emailAddress);
32 | System.out.println("Email OTP is: " + emailOTP.getOtp());
33 | return emailOTP;
34 | }
35 |
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/test/java/org/secureauth/restapi/test/Impl/AdaptiveAuthenticationImpl.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.restapi.test.Impl;
2 |
3 | import org.secureauth.sarestapi.SAAccess;
4 | import org.secureauth.sarestapi.data.IPEval;
5 | import org.secureauth.sarestapi.data.Response.ResponseObject;
6 | import org.secureauth.sarestapi.interfaces.AdaptiveAuthenticationInterface;
7 |
8 | /**
9 | * Created by rrowcliffe on 5/14/16.
10 | */
11 | public class AdaptiveAuthenticationImpl implements AdaptiveAuthenticationInterface {
12 | public AdaptiveAuthenticationImpl(){}
13 |
14 | @Override
15 | public IPEval ipThreatCheck(SAAccess saAccess, String userid, String ip_address) {
16 | IPEval ipEval = saAccess.iPEvaluation(userid, ip_address);
17 | //System.out.println("Start IPEvaluation +++++++++++++++++");
18 | if (ipEval != null) {
19 | System.out.println(ipEval.toString());
20 | } else {
21 | System.out.println("If you See this then Something went Wrong!!");
22 | }
23 | // System.out.println("End IPEvaluation +++++++++++++++++");
24 | return ipEval;
25 | }
26 |
27 | @Override
28 | public ResponseObject updateAccessHistories(SAAccess saAccess, String user, String ip_address) {
29 | System.out.println("START Access Histories test +++++++++");
30 | ResponseObject ahistories = saAccess.accessHistory(user, ip_address);
31 | System.out.println(ahistories.toString());
32 | System.out.println("END Access Histories test +++++++++++");
33 | return ahistories;
34 | }
35 |
36 | @Override
37 | public ResponseObject submitAdaptiveAuth(SAAccess saAccess, String user, String ipAddress) {
38 | System.out.println("Start Adaptive Test ++++++++++++++++");
39 | ResponseObject responseObject = saAccess.adaptiveAuthQuery(user,ipAddress);
40 | System.out.println(responseObject.toString());
41 | System.out.println("End Adaptive Test ++++++++++++++++++");
42 | return responseObject;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/test/java/org/secureauth/restapi/test/Impl/BehaveBioImpl.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.restapi.test.Impl;
2 |
3 | import org.secureauth.sarestapi.SAAccess;
4 | import org.secureauth.sarestapi.data.Response.BehaveBioResponse;
5 | import org.secureauth.sarestapi.data.Response.JSObjectResponse;
6 | import org.secureauth.sarestapi.data.Response.ResponseObject;
7 | import org.secureauth.sarestapi.interfaces.BehaveBioInterface;
8 |
9 | /**
10 | * Created by rrowcliffe on 5/14/16.
11 | */
12 | public class BehaveBioImpl implements BehaveBioInterface {
13 |
14 | public BehaveBioImpl(){}
15 |
16 | @Override
17 | public JSObjectResponse getBehaveBioJavaScriptSrc(SAAccess saAccess) {
18 | System.out.println("START BehaveBio JavaScript Get URL Request ++++++++");
19 | JSObjectResponse jsObject = saAccess.BehaveBioJSSrc();
20 | if(jsObject != null){
21 | System.out.println(jsObject.getSrc());
22 | }else{
23 | System.out.println("Null Object Response");
24 | }
25 |
26 | System.out.println("END BehaveBio JavaScript Get URL Request ++++++++");
27 | return jsObject;
28 | }
29 |
30 | @Override
31 | public BehaveBioResponse submitBehaveBioProfile(SAAccess saAccess, String userid, String behaviorProfile, String hostAddress, String userAgent) {
32 | System.out.println("START Submit BehaveBio " + userid + " Request ++++++++");
33 | BehaveBioResponse userBioProfile = saAccess.BehaveBioProfileSubmit(userid,behaviorProfile,hostAddress,userAgent);
34 | if(userBioProfile != null){
35 | System.out.println(userBioProfile.toString());
36 | System.out.println("END Submit BehaveBio " + userid + " Request ++++++++");
37 | return userBioProfile;
38 | }else{
39 | System.out.println("Null Object you messed up");
40 | }
41 | System.out.println("END Submit BehaveBio " + userid + " Request ++++++++");
42 | return null;
43 | }
44 |
45 | @Override
46 | public ResponseObject resetBehaveBioProfile(SAAccess saAccess, String userid, String fieldName, String fieldType, String deviceType) {
47 | System.out.println("START Submit BehaveBio reset " + userid + " Request ++++++++");
48 | ResponseObject userBioProfile = saAccess.BehaveBioProfileReset(userid,fieldName,fieldType,deviceType);
49 | if(userBioProfile != null){
50 | System.out.println(userBioProfile.toString());
51 | System.out.println("END Submit BehaveBio Reset " + userid + " Request ++++++++");
52 | return userBioProfile;
53 | }else{
54 | System.out.println("Null Object you messed up");
55 | }
56 | System.out.println("END Submit BehaveBio Reset " + userid + " Request ++++++++");
57 | return null;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/test/java/org/secureauth/restapi/test/Impl/DeviceRecognitionImpl.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.restapi.test.Impl;
2 |
3 | import org.secureauth.sarestapi.SAAccess;
4 | import org.secureauth.sarestapi.data.Response.DFPConfirmResponse;
5 | import org.secureauth.sarestapi.data.Response.DFPValidateResponse;
6 | import org.secureauth.sarestapi.data.Response.JSObjectResponse;
7 | import org.secureauth.sarestapi.interfaces.DeviceRecognitionInterface;
8 |
9 | /**
10 | * Created by rrowcliffe on 5/14/16.
11 | */
12 | public class DeviceRecognitionImpl implements DeviceRecognitionInterface {
13 |
14 | public DeviceRecognitionImpl(){}
15 |
16 | @Override
17 | public JSObjectResponse getDFPJavaScriptSrc(SAAccess saAccess) {
18 | System.out.println("START JavaScript Get URL Request ++++++++");
19 | JSObjectResponse jsObject = saAccess.javaScriptSrc();
20 | if(jsObject != null){
21 | System.out.println(jsObject.getSrc());
22 | }else{
23 | System.out.println("Null Object Response");
24 | }
25 |
26 | System.out.println("END JavaScript Get URL Request ++++++++");
27 | return jsObject;
28 | }
29 |
30 | @Override
31 | public DFPConfirmResponse confirmDeviceRecognition(SAAccess saAccess, String userid, String fingerprint_id) {
32 | System.out.println("START Confirm DeviceRecognition " + userid + " Request ++++++++");
33 | DFPConfirmResponse dfpConfirmResponse = saAccess.DFPConfirm(userid,fingerprint_id);
34 | if(dfpConfirmResponse != null){
35 | System.out.println(dfpConfirmResponse.toString());
36 | System.out.println("END Confirm DeviceRecognition " + userid + " Request ++++++++");
37 | return dfpConfirmResponse;
38 | }else{
39 | System.out.println("Null Object you messed up");
40 | }
41 | System.out.println("END Confirm DeviceRecognition " + userid + " Request ++++++++");
42 | return null;
43 | }
44 |
45 | @Override
46 | public DFPValidateResponse validateNewDevice(SAAccess saAccess, String userid, String host_address, String jsonString) {
47 | System.out.println("START Validate DeviceRecognition " + userid + " Request ++++++++");
48 | DFPValidateResponse dfpValidateResponse = saAccess.DFPValidateNewFingerprint(userid,host_address,jsonString);
49 | if(dfpValidateResponse != null){
50 | System.out.println(dfpValidateResponse.toString());
51 | System.out.println("END Validate DeviceRecognition " + userid + " Request ++++++++");
52 | return dfpValidateResponse;
53 | }else{
54 | System.out.println("Null Object you messed up");
55 | }
56 | System.out.println("END Validate DeviceRecognition " + userid + " Request ++++++++");
57 | return null;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/test/java/org/secureauth/restapi/test/Impl/PhoneNumberProfileImpl.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.restapi.test.Impl;
2 |
3 | import org.secureauth.sarestapi.SAAccess;
4 | import org.secureauth.sarestapi.data.Response.*;
5 | import org.secureauth.sarestapi.interfaces.BehaveBioInterface;
6 | import org.secureauth.sarestapi.interfaces.PhoneNumberProfileInterface;
7 |
8 | /**
9 | * Created by rrowcliffe on 5/14/16.
10 | */
11 | public class PhoneNumberProfileImpl implements PhoneNumberProfileInterface {
12 |
13 | public PhoneNumberProfileImpl(){}
14 |
15 |
16 | @Override
17 | public NumberProfileResponse submitPhoneNumber(SAAccess saAccess, String userid, String phone_number) {
18 | System.out.println("START Submit PhoneNumber " + userid + " Request ++++++++");
19 | NumberProfileResponse userPhoneNumberProfile = saAccess.PhoneNumberProfileSubmit(userid,phone_number);
20 | if(userPhoneNumberProfile != null){
21 | System.out.println(userPhoneNumberProfile.toString());
22 | System.out.println("END Submit PhoneNumber " + userid + " Request ++++++++");
23 | return userPhoneNumberProfile;
24 | }else{
25 | System.out.println("Null Object you messed up");
26 | }
27 | System.out.println("END Submit PhoneNumeber " + userid + " Request ++++++++");
28 | return null;
29 | }
30 |
31 | @Override
32 | public BaseResponse updatePhoneNumberProfile(SAAccess saAccess, String userid, String phone_number, String portedStatus, String carrierCode, String carrier, String countryCode, String networkType) {
33 | System.out.println("START Submit PhoneNumber Update " + userid + " Request ++++++++");
34 | BaseResponse userPhoneNumberProfile = saAccess.UpdatePhoneNumberProfile(userid,phone_number,portedStatus,carrierCode,carrier,countryCode,networkType);
35 | if(userPhoneNumberProfile != null){
36 | System.out.println(userPhoneNumberProfile.toString());
37 | System.out.println("END Submit PhoneNumber Update " + userid + " Request ++++++++");
38 | return userPhoneNumberProfile;
39 | }else{
40 | System.out.println("Null Object you messed up");
41 | }
42 | System.out.println("END Submit PhoneNumber Update " + userid + " Request ++++++++");
43 | return null;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/test/java/org/secureauth/sarestapi/ssl/SATrustManagerFactoryTest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.ssl;
2 |
3 | import org.junit.Rule;
4 | import org.junit.Test;
5 | import org.junit.rules.ExpectedException;
6 | import org.secureauth.sarestapi.data.SABaseURL;
7 |
8 | import javax.net.ssl.TrustManager;
9 | import javax.net.ssl.X509TrustManager;
10 | import java.security.cert.X509Certificate;
11 |
12 | public class SATrustManagerFactoryTest {
13 |
14 | @Rule
15 | public ExpectedException thrown = ExpectedException.none();
16 |
17 | @Test
18 | public void givenSABaseUrlSelfSignedWhenValidateSelfSignedCertificateThenNoExceptionIsThrownAndIsCertificateIsValid() throws Exception {
19 | // setup
20 | final String appliance = "127.0.0.1";
21 | final String port = "8080";
22 | final boolean ssl = true;
23 | final boolean selfSigned = true;
24 | final X509Certificate[] certificates = { X509CertificateMockedFactory.createMockedSelfSignedX509Certificate( "O=\"For test\"" ) };
25 | // when
26 | TrustManager[] trustManagers =
27 | SATrustManagerFactory.createTrustsManagersFor( new SABaseURL( appliance, port , ssl, selfSigned ) );
28 | // then
29 | for( TrustManager tm : trustManagers ) {
30 | ( ( X509TrustManager ) tm ).checkServerTrusted( certificates, "DHE_DSS" );
31 | }
32 | }
33 |
34 | @Test
35 | public void givenSABaseUrlNoSelfSignedWhenValidateASelfSignedCertificateThenExceptionIsThrownAndIsCertificateIsNotValid() throws Exception {
36 | // setup
37 | final String appliance = "127.0.0.1";
38 | final String port = "8080";
39 | final boolean ssl = true;
40 | final boolean selfSigned = false;
41 |
42 | final X509Certificate[] certificates = { X509CertificateMockedFactory.createMockedSelfSignedX509Certificate( "O=\"For test\"" ) };
43 | // when
44 | TrustManager[] trustManagers =
45 | SATrustManagerFactory.createTrustsManagersFor( new SABaseURL( appliance, port , ssl, selfSigned ) );
46 | // expect exception.
47 | this.thrown.expect(NullPointerException.class);
48 | // then
49 | for (TrustManager tm : trustManagers) {
50 | ((X509TrustManager) tm).checkServerTrusted(certificates, "DHE_DSS");
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/test/java/org/secureauth/sarestapi/ssl/X509CertificateMockedFactory.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.ssl;
2 |
3 | import javax.security.auth.x500.X500Principal;
4 | import java.security.cert.X509Certificate;
5 |
6 | import static org.mockito.Mockito.mock;
7 | import static org.mockito.Mockito.when;
8 |
9 | public class X509CertificateMockedFactory {
10 |
11 | public static X509Certificate createMockedSelfSignedX509Certificate(final String subject) {
12 | final X509Certificate x509Certificate = mock( X509Certificate.class );
13 | X500Principal x500Principal = new X500Principal( subject );
14 | when( x509Certificate.getSubjectX500Principal() ).thenReturn( x500Principal );
15 | when( x509Certificate.getIssuerX500Principal() ).thenReturn( x500Principal );
16 | return x509Certificate;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/test/java/org/secureauth/sarestapi/stateful/SAAccessUnitTest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.stateful;
2 |
3 | import com.github.tomakehurst.wiremock.WireMockServer;
4 | import org.junit.After;
5 | import org.junit.Assert;
6 | import org.junit.Before;
7 | import org.junit.Test;
8 | import org.secureauth.sarestapi.SAAccess;
9 | import org.secureauth.sarestapi.data.PushAcceptStatus;
10 | import org.secureauth.sarestapi.data.Response.StatefulResponseObject;
11 |
12 | public class SAAccessUnitTest {
13 |
14 | private WireMockServer wireMockServer;
15 | private SAAccess saAccess;
16 | private static boolean RECORDING_MODE = false;
17 | @Before
18 | public void setup() {
19 | this.wireMockServer = new WireMockServer(8090);
20 | this.wireMockServer.start();
21 | if( RECORDING_MODE ) {
22 | this.wireMockServer.startRecording("https://myidp.com");
23 | }
24 | this.saAccess = new SAAccess(
25 | "localhost",
26 | "8090",
27 | false,
28 | true,
29 | "Realm01",
30 | "Realm01-ApplicationId",
31 | "Realm01-ApplicationKey"
32 | );
33 | }
34 |
35 | @After
36 | public void teardown() {
37 | if( RECORDING_MODE ) {
38 | this.wireMockServer.stopRecording();
39 | } else {
40 | this.wireMockServer.stop();
41 | }
42 | }
43 |
44 | @Test
45 | public void given_AValidUserAndFactorId_When_PerformOutOfBandAuthStateful_Then_IngressCookieIsReturned() {
46 | // given
47 | final String userId = "test-user-1";
48 | final String factorId = "9a29542309654256a0d71f9e86095f45";
49 | // when
50 | StatefulResponseObject resp = this.saAccess.sendPushToAcceptReqStateful( userId, factorId, "127.0.0.1", "", "" );
51 | // then
52 | Assert.assertEquals("1570217946.933.809.995388", resp.getSessionAffinityCookie().getValue());
53 | }
54 |
55 | @Test
56 | public void given_APushNotificationRequestInProgress_When_QueryUsingRefIdAndCookie_Then_PushAcceptStatusIsOk() {
57 | // given
58 | final String userId = "test-user-2";
59 | final String factorId = "9a29542309654256a0d71f9e86095f45";
60 | StatefulResponseObject resp = this.saAccess.sendPushToAcceptReqStateful( userId, factorId, "127.0.0.2", "", "" );
61 | // when
62 | PushAcceptStatus pushAcceptStatus = this.saAccess.queryPushAcceptStatusStateful( resp.getReference_id(), resp.getSessionAffinityCookie() );
63 | // then
64 | Assert.assertEquals("PENDING", pushAcceptStatus.getMessage());
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/test/java/org/secureauth/sarestapi/util/Property.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.util;
2 |
3 | public enum Property {
4 | REALM("idp.realm"),
5 | API_APPLICATION_ID("idp.realm.api.application.id"),
6 | API_APPLICATION_KEY("idp.realm.api.application.key"),
7 | HOST("idp.host"),
8 | PORT("idp.port"),
9 | SSL("idp.ssl"),
10 | VALID_USERNAME("user.username"),
11 | VALID_PIN("user.pin"),
12 | VALID_PASSWORD("user.password"),
13 | USER_DOMAIN("user.domain"),
14 | VALID_FACTOR_ID_FOR_OATH_OTP("user.oath.totp.factor.id"),
15 | VALID_OATH_TOTP_SHARED_KEY("user.oath.totp.shared.key"),
16 | VALID_OATH_TOTP_LENGTH("user.oath.totp.length"),
17 | VALID_OTP_PIN_CODE("user.otp.pin"),
18 | VALID_OTP_OATH_CODE("user.otp.oath"),
19 | VALID_HOST_ADDRESS("valid.host.address"),
20 | VALID_FINGERPRINT_ID("valid.fingerprint.id"),
21 | VALID_YUBICO_TOKEN("valid.yubico.token"),
22 | VALID_IP("user.ip"),
23 | ASSUME_TEST("assume.test");
24 |
25 | private final String value;
26 |
27 | private Property(String value) {
28 | this.value = value;
29 | }
30 |
31 | public String getValue() {
32 | return this.value;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/test/java/org/secureauth/sarestapi/util/RestApiHeaderTest.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.util;
2 |
3 | import org.junit.jupiter.api.BeforeEach;
4 | import org.junit.jupiter.api.Test;
5 | import org.secureauth.sarestapi.data.Requests.StatusRequest;
6 | import org.secureauth.sarestapi.data.SAAuth;
7 | import org.secureauth.sarestapi.queries.StatusQuery;
8 | import org.secureauth.sarestapi.resources.Resource;
9 |
10 | import java.time.LocalDateTime;
11 | import java.time.format.DateTimeFormatter;
12 |
13 | import static org.junit.jupiter.api.Assertions.*;
14 |
15 | class RestApiHeaderTest {
16 |
17 | private final static String realm = "realm1";
18 | private final static String applicationID = "applicationID";
19 | private final static String applicationKey = "applicationKey";
20 | private static SAAuth saAuth;
21 |
22 | @BeforeEach
23 | public void setup() {
24 | saAuth = new SAAuth(applicationID,applicationKey,realm);
25 | }
26 |
27 | @Test
28 | void getAuthorizationHeaderWithoutPayload() {
29 | String query = StatusQuery.queryStatus(saAuth.getRealm(), "userId");
30 |
31 | String header = RestApiHeader.getAuthorizationHeader(saAuth, Resource.METHOD_GET, query, getServerTime());
32 |
33 | assertEquals(header, "Basic YXBwbGljYXRpb25JRDo=");
34 | }
35 |
36 | @Test
37 | void testGetAuthorizationHeaderWithPayload() {
38 | StatusRequest statusRequest = new StatusRequest("some status");
39 |
40 | String query = StatusQuery.queryStatus(saAuth.getRealm(), "userId");
41 |
42 | String header = RestApiHeader.getAuthorizationHeader(saAuth, Resource.METHOD_POST, query, statusRequest, getServerTime());
43 |
44 | assertEquals(header, "Basic YXBwbGljYXRpb25JRDo=");
45 | }
46 |
47 |
48 | private String getServerTime() {
49 | LocalDateTime fixLocalDateTime = LocalDateTime.of(2020, 6, 12, 0,0);
50 | DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE;
51 | return formatter.format(fixLocalDateTime);
52 | }
53 | }
--------------------------------------------------------------------------------
/src/test/java/org/secureauth/sarestapi/util/RetrievePropertiesUtils.java:
--------------------------------------------------------------------------------
1 | package org.secureauth.sarestapi.util;
2 |
3 | import java.io.IOException;
4 | import java.io.InputStream;
5 | import java.util.HashMap;
6 | import java.util.Map;
7 | import java.util.Optional;
8 | import java.util.Properties;
9 |
10 | public class RetrievePropertiesUtils {
11 |
12 |
13 | private final static String PROPERTIES_FILE_PATH = "test.properties";
14 | private Map propertiesMap;
15 |
16 | public RetrievePropertiesUtils(){
17 | propertiesMap = new HashMap<>();
18 | getAndFieldProperties();
19 | }
20 |
21 | public RetrievePropertiesUtils(String path){
22 | getAndFieldProperties(path);
23 | }
24 |
25 | private void getAndFieldProperties(){
26 | propertiesMap = new HashMap<>();
27 | getAndFieldProperties(PROPERTIES_FILE_PATH);
28 | }
29 |
30 | public Map getPropertiesMap() {
31 | return propertiesMap;
32 | }
33 |
34 | public void setPropertiesMap(Map propertiesMap) {
35 | this.propertiesMap = propertiesMap;
36 | }
37 |
38 | public String getValueFromProperty(Property property){
39 | return Optional.ofNullable(propertiesMap.get(property.getValue())).orElse("");
40 | }
41 |
42 | public void getAndFieldProperties(String path){
43 | Properties properties = new Properties();
44 | try (InputStream inputStream = RetrievePropertiesUtils.class.getClassLoader().getResourceAsStream(path)) {
45 | properties.load(inputStream);
46 | for(String name: properties.stringPropertyNames()){
47 | propertiesMap.put(name, properties.getProperty(name));
48 | }
49 |
50 | } catch (IOException e) {
51 | e.printStackTrace();
52 | throw new RuntimeException("Cannot load " + PROPERTIES_FILE_PATH + ": " + e.getMessage());
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/test/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/test/resources/mappings/realm01_api_v1_auth-580bc69f-5f64-4435-bbfc-9dceef9bc544.json:
--------------------------------------------------------------------------------
1 | {
2 | "id" : "580bc69f-5f64-4435-bbfc-9dceef9bc544",
3 | "name" : "realm01_api_v1_auth",
4 | "request" : {
5 | "url" : "/Realm01/api/v1/auth",
6 | "method" : "POST",
7 | "bodyPatterns" : [ {
8 | "equalToJson" : "{\r\n \"user_id\" : \"test-user-1\",\r\n \"type\" : \"push_accept\",\r\n \"factor_id\" : \"9a29542309654256a0d71f9e86095f45\",\r\n \"push_accept_details\" : {\r\n \"company_name\" : \"\",\r\n \"application_description\" : \"\",\r\n \"enduser_ip\" : \"127.0.0.1\"\r\n }\r\n}",
9 | "ignoreArrayOrder" : true,
10 | "ignoreExtraElements" : true
11 | } ]
12 | },
13 | "response" : {
14 | "status" : 200,
15 | "body" : "{\"reference_id\":\"87ab8245-cc8d-4070-ac8c-6bf0b4e5b541\",\"status\":\"valid\",\"message\":\"\",\"user_id\":\"test-user-1\"}",
16 | "headers" : {
17 | "Cache-Control" : "no-cache, no-store",
18 | "Pragma" : "no-cache",
19 | "Content-Type" : "application/json; charset=utf-8",
20 | "Expires" : "-1",
21 | "Set-Cookie" : "INGRESSCOOKIE=1570217946.933.809.995388; Expires=Fri, 04-Oct-19 19:41:05 GMT; Max-Age=120; Path=/; Secure; HttpOnly",
22 | "X-SA-SIGNATURE" : "Mk6W8WkH23nW7Kx03d48HxIqaiFnTBOESbvmI72f8kA=",
23 | "X-SA-DATE" : "Fri, 02 Oct 2020 15:11:57 GMT",
24 | "Strict-Transport-Security" : "max-age=31536000",
25 | "Date" : "Fri, 02 Oct 2020 15:11:57 GMT"
26 | }
27 | },
28 | "uuid" : "580bc69f-5f64-4435-bbfc-9dceef9bc544",
29 | "persistent" : true,
30 | "insertionIndex" : 1
31 | }
--------------------------------------------------------------------------------
/src/test/resources/mappings/realm01_api_v1_auth-dac77105-c0fe-4e2f-b9a1-6fee45412788.json:
--------------------------------------------------------------------------------
1 | {
2 | "id" : "dac77105-c0fe-4e2f-b9a1-6fee45412788",
3 | "name" : "realm01_api_v1_auth",
4 | "request" : {
5 | "url" : "/Realm01/api/v1/auth",
6 | "method" : "POST",
7 | "bodyPatterns" : [ {
8 | "equalToJson" : "{\r\n \"user_id\" : \"test-user-2\",\r\n \"type\" : \"push_accept\",\r\n \"factor_id\" : \"9a29542309654256a0d71f9e86095f45\",\r\n \"push_accept_details\" : {\r\n \"company_name\" : \"\",\r\n \"application_description\" : \"\",\r\n \"enduser_ip\" : \"127.0.0.2\"\r\n }\r\n}",
9 | "ignoreArrayOrder" : true,
10 | "ignoreExtraElements" : true
11 | } ]
12 | },
13 | "response" : {
14 | "status" : 200,
15 | "body" : "{\"reference_id\":\"41f43a30-510b-42a9-8c2c-c04aaf96a18e\",\"status\":\"valid\",\"message\":\"\",\"user_id\":\"test-user-2\"}",
16 | "headers" : {
17 | "Cache-Control" : "no-cache, no-store",
18 | "Pragma" : "no-cache",
19 | "Content-Type" : "application/json; charset=utf-8",
20 | "Expires" : "-1",
21 | "Set-Cookie" : "INGRESSCOOKIE=1570217946.933.809.995388; Expires=Fri, 04-Oct-19 19:41:05 GMT; Max-Age=120; Path=/; Secure; HttpOnly",
22 | "X-SA-SIGNATURE" : "uqmCDFtpfoEo0QonH12Z9kOalqSeceEZuXhE1Z4kO9E=",
23 | "X-SA-DATE" : "Fri, 02 Oct 2020 15:44:45 GMT",
24 | "Strict-Transport-Security" : "max-age=31536000",
25 | "Date" : "Fri, 02 Oct 2020 15:44:45 GMT"
26 | }
27 | },
28 | "uuid" : "dac77105-c0fe-4e2f-b9a1-6fee45412788",
29 | "persistent" : true,
30 | "insertionIndex" : 2
31 | }
--------------------------------------------------------------------------------
/src/test/resources/mappings/realm01_api_v1_auth_41f43a30-510b-42a9-8c2c-c04aaf96a18e-15839fba-cd27-4016-899d-bf08f37cb035.json:
--------------------------------------------------------------------------------
1 | {
2 | "id" : "15839fba-cd27-4016-899d-bf08f37cb035",
3 | "name" : "realm01_api_v1_auth_41f43a30-510b-42a9-8c2c-c04aaf96a18e",
4 | "request" : {
5 | "url" : "/Realm01/api/v1/auth/41f43a30-510b-42a9-8c2c-c04aaf96a18e",
6 | "method" : "GET"
7 | },
8 | "response" : {
9 | "status" : 200,
10 | "body" : "{\"status\":\"found\",\"message\":\"PENDING\"}",
11 | "headers" : {
12 | "Cache-Control" : "no-cache, no-store",
13 | "Pragma" : "no-cache",
14 | "Content-Type" : "application/json; charset=utf-8",
15 | "Expires" : "-1",
16 | "X-SA-SIGNATURE" : "bcDSXj5zqtW8PU2O+S4XEOxJOH88T6g9Bt3P02RAZJ0=",
17 | "X-SA-DATE" : "Fri, 02 Oct 2020 15:44:45 GMT",
18 | "Strict-Transport-Security" : "max-age=31536000",
19 | "Date" : "Fri, 02 Oct 2020 15:44:45 GMT"
20 | }
21 | },
22 | "uuid" : "15839fba-cd27-4016-899d-bf08f37cb035",
23 | "persistent" : true,
24 | "insertionIndex" : 3
25 | }
--------------------------------------------------------------------------------
/src/test/resources/test.properties:
--------------------------------------------------------------------------------
1 | #saaccess
2 | idp.host=yourendpoint.com
3 | idp.port=443
4 | idp.realm=SecureAuthXXXX
5 | idp.realm.api.application.id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
6 | idp.realm.api.application.key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
7 | idp.ssl=true
8 |
9 | #User
10 | user.username=foobar
11 | user.pin=1234
12 | user.password=1234
13 | user.domain=
14 |
15 | #UserOATH-OTP
16 | user.oath.totp.factor.id=
17 | user.oath.totp.shared.key=
18 | user.oath.totp.length=
19 | user.oath.totp.interval=
20 | user.otp.pin=
21 | user.otp.oath=
22 |
23 | #Valid_Tokens
24 | valid.yubico.token=
25 |
26 | assume.test=false
--------------------------------------------------------------------------------