From af9a4767a3bcb3c10486ecdcd4ec7ef4b8f16b6b Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Thu, 14 Sep 2017 10:45:00 -0400 Subject: [PATCH 01/22] Creates base classes and moves generated classes into its own area --- composer.json | 8 +- openapi/generator/index.js | 60 +- .../generator/templates/collection.php.hbs | 2 +- openapi/generator/templates/model.php.hbs | 19 +- openapi/package-lock.json | 295 +++++++++ openapi/package.json | 4 +- src/Generated/GroupRules/Collection.php | 25 + src/Generated/GroupRules/GroupRule.php | 230 +++++++ src/Generated/GroupRules/GroupRuleAction.php | 55 ++ .../GroupRules/GroupRuleConditions.php | 85 +++ .../GroupRules/GroupRuleExpression.php | 75 +++ .../GroupRules/GroupRuleGroupAssignment.php | 50 ++ .../GroupRules/GroupRuleGroupCondition.php | 75 +++ .../GroupRules/GroupRulePeopleCondition.php | 85 +++ src/Generated/GroupRules/GroupRuleStatus.php | 25 + .../GroupRules/GroupRuleUserCondition.php | 75 +++ src/Generated/Groups/Collection.php | 25 + src/Generated/Groups/Group.php | 192 ++++++ src/Generated/Groups/GroupProfile.php | 75 +++ src/Generated/Users/AppLink.php | 125 ++++ .../Users/AuthenticationProvider.php | 75 +++ .../Users/AuthenticationProviderType.php | 25 + src/Generated/Users/ChangePasswordRequest.php | 85 +++ src/Generated/Users/Collection.php | 25 + .../Users/ForgotPasswordResponse.php | 35 ++ src/Generated/Users/PasswordCredential.php | 50 ++ .../Users/RecoveryQuestionCredential.php | 75 +++ src/Generated/Users/ResetPasswordToken.php | 35 ++ src/Generated/Users/Role.php | 120 ++++ src/Generated/Users/RoleStatus.php | 25 + src/Generated/Users/TempPassword.php | 35 ++ src/Generated/Users/User.php | 583 ++++++++++++++++++ src/Generated/Users/UserActivationToken.php | 45 ++ src/Generated/Users/UserCredentials.php | 115 ++++ src/Generated/Users/UserProfile.php | 175 ++++++ src/Generated/Users/UserStatus.php | 25 + src/GroupRules/Collection.php | 34 +- src/GroupRules/GroupRule.php | 237 +------ src/GroupRules/GroupRuleAction.php | 64 +- src/GroupRules/GroupRuleConditions.php | 94 +-- src/GroupRules/GroupRuleExpression.php | 84 +-- src/GroupRules/GroupRuleGroupAssignment.php | 59 +- src/GroupRules/GroupRuleGroupCondition.php | 84 +-- src/GroupRules/GroupRulePeopleCondition.php | 94 +-- src/GroupRules/GroupRuleStatus.php | 34 +- src/GroupRules/GroupRuleUserCondition.php | 84 +-- src/Groups/Collection.php | 34 +- src/Groups/Group.php | 199 +----- src/Groups/GroupProfile.php | 84 +-- src/Resource/AbstractCollection.php | 2 +- src/Users/AppLink.php | 134 +--- src/Users/AuthenticationProvider.php | 84 +-- src/Users/AuthenticationProviderType.php | 34 +- src/Users/ChangePasswordRequest.php | 94 +-- src/Users/Collection.php | 34 +- src/Users/ForgotPasswordResponse.php | 44 +- src/Users/PasswordCredential.php | 59 +- src/Users/RecoveryQuestionCredential.php | 84 +-- src/Users/ResetPasswordToken.php | 44 +- src/Users/Role.php | 129 +--- src/Users/RoleStatus.php | 34 +- src/Users/TempPassword.php | 44 +- src/Users/User.php | 572 +---------------- src/Users/UserActivationToken.php | 54 +- src/Users/UserCredentials.php | 124 +--- src/Users/UserProfile.php | 184 +----- src/Users/UserStatus.php | 34 +- tests/Unit/Groups/GroupTest.php | 2 +- 68 files changed, 3572 insertions(+), 2516 deletions(-) create mode 100644 openapi/package-lock.json create mode 100644 src/Generated/GroupRules/Collection.php create mode 100644 src/Generated/GroupRules/GroupRule.php create mode 100644 src/Generated/GroupRules/GroupRuleAction.php create mode 100644 src/Generated/GroupRules/GroupRuleConditions.php create mode 100644 src/Generated/GroupRules/GroupRuleExpression.php create mode 100644 src/Generated/GroupRules/GroupRuleGroupAssignment.php create mode 100644 src/Generated/GroupRules/GroupRuleGroupCondition.php create mode 100644 src/Generated/GroupRules/GroupRulePeopleCondition.php create mode 100644 src/Generated/GroupRules/GroupRuleStatus.php create mode 100644 src/Generated/GroupRules/GroupRuleUserCondition.php create mode 100644 src/Generated/Groups/Collection.php create mode 100644 src/Generated/Groups/Group.php create mode 100644 src/Generated/Groups/GroupProfile.php create mode 100644 src/Generated/Users/AppLink.php create mode 100644 src/Generated/Users/AuthenticationProvider.php create mode 100644 src/Generated/Users/AuthenticationProviderType.php create mode 100644 src/Generated/Users/ChangePasswordRequest.php create mode 100644 src/Generated/Users/Collection.php create mode 100644 src/Generated/Users/ForgotPasswordResponse.php create mode 100644 src/Generated/Users/PasswordCredential.php create mode 100644 src/Generated/Users/RecoveryQuestionCredential.php create mode 100644 src/Generated/Users/ResetPasswordToken.php create mode 100644 src/Generated/Users/Role.php create mode 100644 src/Generated/Users/RoleStatus.php create mode 100644 src/Generated/Users/TempPassword.php create mode 100644 src/Generated/Users/User.php create mode 100644 src/Generated/Users/UserActivationToken.php create mode 100644 src/Generated/Users/UserCredentials.php create mode 100644 src/Generated/Users/UserProfile.php create mode 100644 src/Generated/Users/UserStatus.php diff --git a/composer.json b/composer.json index 7346e794c0..afbd41fbb5 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ }, "autoload": { "psr-4": { - "Okta\\": "src/" + "Okta\\": "src" } }, "scripts": { @@ -44,11 +44,7 @@ "@fix-code" ], "delete-resources": [ - "rm -rf ./src/Apps", - "rm -rf ./src/Groups", - "rm -rf ./src/GroupRules", - "rm -rf ./src/Shared", - "rm -rf ./src/Users" + "rm -rf ./src/Generated" ], "generate-resources": "cd ./openapi && npm run generator", "fix-code": "phpcbf ." diff --git a/openapi/generator/index.js b/openapi/generator/index.js index c75ec2d0c1..0621bcf99b 100644 --- a/openapi/generator/index.js +++ b/openapi/generator/index.js @@ -3,12 +3,12 @@ _.mixin(require('lodash-inflection')); const php = module.exports; -function getType(obj) { +function getType(obj, model) { switch (obj.commonType) { case 'dateTime': return String.raw`\Carbon\Carbon|null`; case 'object': - return obj.model; + return `\\${model}\\${obj.model}`; case 'hash': return String.raw`\stdClass`; case 'boolean': @@ -22,12 +22,12 @@ function getType(obj) { } } -function getSafeType(obj) { +function getSafeType(obj, model) { switch (obj.commonType) { case 'dateTime': return ``; case 'object': - return `: ${obj.model}`; + return `: \\${model}\\${obj.model}`; case 'hash': return String.raw`: \stdClass`; case 'boolean': @@ -199,11 +199,44 @@ function getCrudMethodName(alias) { } } +function getClassNameForCollection(obj) { + console.log(obj); + switch(obj.operation.operationId) { + case 'listUserGroups': + case 'listGroupTargetsForRole': + return '\\Okta\\Groups\\Group'; + case 'listGroupUsers': + return '\\Okta\\Users\\User'; + default: + return `\\${obj.baseClass}\\${obj.operation.responseModel}`; + } + +} + +function getCollectionName(obj) { + switch(obj.operation.operationId) { + case 'listUserGroups': + case 'listGroupTargetsForRole': + return '\\Okta\\Groups\\Collection'; + case 'listGroupUsers': + return '\\Okta\\Users\\Collection'; + default: + return `\\${obj.baseClass}\\Collection`; + } +} + function getCrudOperationPath(method) { let parts = _.split(method.operation.path, '/'); return '/' + parts[3]; } +function pluralize(string) { + return _.pluralize(string); +} + +function customLog(toLog) { + console.log(toLog); +} php.process = ({ spec, operations, models, handlebars }) => { const templates = []; @@ -219,6 +252,16 @@ php.process = ({ spec, operations, models, handlebars }) => { namespaces.push(model.namespace); } + for (let property of model.properties) { + property.baseClass = `Okta\\${model.namespace}`; + } + + if (model.methods) { + for(let method of model.methods) { + method.baseClass = `Okta\\${model.namespace}`; + } + } + // Build modelMap modelMap[model.modelName] = model; } @@ -228,6 +271,8 @@ php.process = ({ spec, operations, models, handlebars }) => { model.namespacedModels = []; model.crudOperations = []; + + if (model.methods) { for (let method of model.methods) { const responseModel = method.operation.responseModel; @@ -250,6 +295,7 @@ php.process = ({ spec, operations, models, handlebars }) => { } } + templates.push({ src: 'templates/model.php.hbs', dest: `${model.namespace}/${model.modelName}.php`, @@ -277,7 +323,11 @@ php.process = ({ spec, operations, models, handlebars }) => { getOperationReturnType, getMethodParamsComment, getCrudMethodName, - getCrudOperationPath + getCrudOperationPath, + pluralize, + customLog, + getClassNameForCollection, + getCollectionName }); return templates; diff --git a/openapi/generator/templates/collection.php.hbs b/openapi/generator/templates/collection.php.hbs index dc5662c6d7..21e5c66032 100644 --- a/openapi/generator/templates/collection.php.hbs +++ b/openapi/generator/templates/collection.php.hbs @@ -15,7 +15,7 @@ * limitations under the License. ******************************************************************************/ -namespace Okta\\{{namespace}}; +namespace Okta\Generated\\{{namespace}}; use Okta\Resource\AbstractCollection; diff --git a/openapi/generator/templates/model.php.hbs b/openapi/generator/templates/model.php.hbs index 4ecede87b0..dc9de6e040 100644 --- a/openapi/generator/templates/model.php.hbs +++ b/openapi/generator/templates/model.php.hbs @@ -15,7 +15,7 @@ * limitations under the License. ******************************************************************************/ -namespace Okta\\{{namespace}}; +namespace Okta\Generated\\{{namespace}}; {{#each namespacedModels as |namespacedModel|}} use Okta\\{{namespacedModel.namespace}}\\{{namespacedModel.modelName}}; @@ -85,14 +85,14 @@ class {{modelName}} extends AbstractResource /** * Get the {{propertyName}}. * - * @return {{getType this}} + * @return {{getType this baseClass}} */ {{#if isObject}} - public function get{{pascalCase propertyName}}(array $options = []){{getSafeType this}} + public function get{{pascalCase propertyName}}(array $options = []){{getSafeType this baseClass}} { return $this->getResourceProperty( self::{{upperSnakeCase propertyName}}, - {{model}}::class, + \\{{baseClass}}\\{{model}}::class, $options ); } @@ -115,7 +115,7 @@ class {{modelName}} extends AbstractResource } {{/unless}} {{else}} - public function get{{pascalCase propertyName}}(){{getSafeType this}} + public function get{{pascalCase propertyName}}(){{getSafeType this baseClass}} { return $this->{{getAccessMethodType this}}(self::{{upperCase (snakeCase propertyName)}}); } @@ -139,21 +139,22 @@ class {{modelName}} extends AbstractResource {{/if}} {{/each}} {{#each methods}} + {{#if operation.isArray}} /** * Get the {{operation.responseModel}} object. * * @param array $options The options for the request. - * @return Collection + * @return {{getCollectionName this}} */ - public function {{getMethodArrayName alias}}({{{getCollectionMethodParams this}}}): Collection + public function {{getMethodArrayName alias}}({{{getCollectionMethodParams this}}}): {{getCollectionName this}} { return $this ->getDataStore() ->getCollection( "{{{getMethodPath this}}}", - {{operation.responseModel}}::class, - Collection::class, + {{getClassNameForCollection this}}::class, + {{getCollectionName this}}::class, $options ); } diff --git a/openapi/package-lock.json b/openapi/package-lock.json new file mode 100644 index 0000000000..2f73ea4b07 --- /dev/null +++ b/openapi/package-lock.json @@ -0,0 +1,295 @@ +{ + "name": "okta-sdk-php-openapi", + "version": "0.2.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@okta/openapi": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@okta/openapi/-/openapi-0.3.0.tgz", + "integrity": "sha1-FycTtv1lk/svzvWsYLPcqNZvjMA=", + "dev": true, + "requires": { + "commander": "2.9.0", + "fs-extra": "3.0.1", + "handlebars": "4.0.8" + } + }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true, + "requires": { + "kind-of": "3.2.2", + "longest": "1.0.1", + "repeat-string": "1.6.1" + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true + }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true, + "optional": true + }, + "center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "dev": true, + "optional": true, + "requires": { + "align-text": "0.1.4", + "lazy-cache": "1.0.4" + } + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "dev": true, + "optional": true, + "requires": { + "center-align": "0.1.3", + "right-align": "0.1.3", + "wordwrap": "0.0.2" + }, + "dependencies": { + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "dev": true, + "optional": true + } + } + }, + "commander": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true, + "requires": { + "graceful-readlink": "1.0.1" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true, + "optional": true + }, + "fs-extra": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-3.0.1.tgz", + "integrity": "sha1-N5TzeMWLNC6n27sjCVEJxLO2IpE=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "jsonfile": "3.0.1", + "universalify": "0.1.1" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", + "dev": true + }, + "handlebars": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.8.tgz", + "integrity": "sha1-Irh1zT8ObL6jAxTxROgrx6cv9CA=", + "dev": true, + "requires": { + "async": "1.5.2", + "optimist": "0.6.1", + "source-map": "0.4.4", + "uglify-js": "2.8.29" + } + }, + "is-buffer": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", + "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", + "dev": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "requires": { + "jsonify": "0.0.0" + } + }, + "jsonfile": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-3.0.1.tgz", + "integrity": "sha1-pezG9l9T9mLEQVx2daAzHQmS7GY=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11" + } + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.5" + } + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "dev": true, + "optional": true + }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "dev": true + }, + "lodash-inflection": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/lodash-inflection/-/lodash-inflection-1.5.0.tgz", + "integrity": "sha1-NE5agDCILVGvmODWE7sFR8i33cc=", + "dev": true + }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "dev": true + }, + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", + "dev": true + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, + "requires": { + "minimist": "0.0.10", + "wordwrap": "0.0.3" + } + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "dev": true, + "optional": true, + "requires": { + "align-text": "0.1.4" + } + }, + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dev": true, + "requires": { + "amdefine": "1.0.1" + } + }, + "uglify-js": { + "version": "2.8.29", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", + "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", + "dev": true, + "optional": true, + "requires": { + "source-map": "0.5.7", + "uglify-to-browserify": "1.0.2", + "yargs": "3.10.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "optional": true + } + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "dev": true, + "optional": true + }, + "universalify": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz", + "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=", + "dev": true + }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "dev": true, + "optional": true + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "dev": true + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "dev": true, + "optional": true, + "requires": { + "camelcase": "1.2.1", + "cliui": "2.1.0", + "decamelize": "1.2.0", + "window-size": "0.1.0" + } + } + } +} diff --git a/openapi/package.json b/openapi/package.json index b702ddabf8..961f4809d1 100644 --- a/openapi/package.json +++ b/openapi/package.json @@ -3,10 +3,10 @@ "private": true, "version": "0.2.0", "scripts": { - "generator": "okta-sdk-generator -t generator -o ../src" + "generator": "okta-sdk-generator -t generator -o ../src/Generated" }, "devDependencies": { - "@okta/openapi": "^0.2.0", + "@okta/openapi": "^0.3.0", "lodash": "^4.17.4", "lodash-inflection": "^1.5.0" }, diff --git a/src/Generated/GroupRules/Collection.php b/src/Generated/GroupRules/Collection.php new file mode 100644 index 0000000000..da2c344f88 --- /dev/null +++ b/src/Generated/GroupRules/Collection.php @@ -0,0 +1,25 @@ +getDataStore() + ->saveResource( + '/groups', + $this, + self::class + ); + } + + public function delete() + { + return \Okta\Client::getInstance() + ->getDataStore() + ->deleteResource( + '/groups', + $this + ); + } + + /** + * Get the id. + * + * @return string + */ + public function getId(): string + { + return $this->getProperty(self::ID); + } + /** + * Get the name. + * + * @return string + */ + public function getName(): string + { + return $this->getProperty(self::NAME); + } + /** + * Set the name. + * + * @param mixed $name The value to set. + * @return self + */ + public function setName($name) + { + $this->setProperty( + self::NAME, + $name + ); + + return $this; + } + /** + * Get the type. + * + * @return string + */ + public function getType(): string + { + return $this->getProperty(self::TYPE); + } + /** + * Set the type. + * + * @param mixed $type The value to set. + * @return self + */ + public function setType($type) + { + $this->setProperty( + self::TYPE, + $type + ); + + return $this; + } + /** + * Get the status. + * + * @return string + */ + public function getStatus(): string + { + return $this->getProperty(self::STATUS); + } + /** + * Get the actions. + * + * @return \Okta\GroupRules\GroupRuleAction + */ + public function getActions(array $options = []): \Okta\GroupRules\GroupRuleAction + { + return $this->getResourceProperty( + self::ACTIONS, + \Okta\GroupRules\GroupRuleAction::class, + $options + ); + } + + /** + * Set the actions. + * + * @param GroupRuleAction $actions The GroupRuleAction instance. + * @return self + */ + public function setActions(GroupRuleAction $actions) + { + $this->setResourceProperty( + self::ACTIONS, + $actions + ); + + return $this; + } + /** + * Get the created. + * + * @return \Carbon\Carbon|null + */ + public function getCreated() + { + return $this->getDateProperty(self::CREATED); + } + /** + * Get the conditions. + * + * @return \Okta\GroupRules\GroupRuleConditions + */ + public function getConditions(array $options = []): \Okta\GroupRules\GroupRuleConditions + { + return $this->getResourceProperty( + self::CONDITIONS, + \Okta\GroupRules\GroupRuleConditions::class, + $options + ); + } + + /** + * Set the conditions. + * + * @param GroupRuleConditions $conditions The GroupRuleConditions instance. + * @return self + */ + public function setConditions(GroupRuleConditions $conditions) + { + $this->setResourceProperty( + self::CONDITIONS, + $conditions + ); + + return $this; + } + /** + * Get the lastUpdated. + * + * @return \Carbon\Carbon|null + */ + public function getLastUpdated() + { + return $this->getDateProperty(self::LAST_UPDATED); + } + + /** + * Sends a request to the activate endpoint. + * + * + * @return mixed|null + */ + public function activate() + { + $uri = "/api/v1/groups/rules/{$this->getId()}/lifecycle/activate"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri); + } + + /** + * Sends a request to the deactivate endpoint. + * + * + * @return mixed|null + */ + public function deactivate() + { + $uri = "/api/v1/groups/rules/{$this->getId()}/lifecycle/deactivate"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri); + } +} diff --git a/src/Generated/GroupRules/GroupRuleAction.php b/src/Generated/GroupRules/GroupRuleAction.php new file mode 100644 index 0000000000..0f8a23ddeb --- /dev/null +++ b/src/Generated/GroupRules/GroupRuleAction.php @@ -0,0 +1,55 @@ +getResourceProperty( + self::ASSIGN_USER_TO_GROUPS, + \Okta\GroupRules\GroupRuleGroupAssignment::class, + $options + ); + } + + /** + * Set the assignUserToGroups. + * + * @param GroupRuleGroupAssignment $assignUserToGroups The GroupRuleGroupAssignment instance. + * @return self + */ + public function setAssignUserToGroups(GroupRuleGroupAssignment $assignUserToGroups) + { + $this->setResourceProperty( + self::ASSIGN_USER_TO_GROUPS, + $assignUserToGroups + ); + + return $this; + } +} diff --git a/src/Generated/GroupRules/GroupRuleConditions.php b/src/Generated/GroupRules/GroupRuleConditions.php new file mode 100644 index 0000000000..9c4d4b19d3 --- /dev/null +++ b/src/Generated/GroupRules/GroupRuleConditions.php @@ -0,0 +1,85 @@ +getResourceProperty( + self::PEOPLE, + \Okta\GroupRules\GroupRulePeopleCondition::class, + $options + ); + } + + /** + * Set the people. + * + * @param GroupRulePeopleCondition $people The GroupRulePeopleCondition instance. + * @return self + */ + public function setPeople(GroupRulePeopleCondition $people) + { + $this->setResourceProperty( + self::PEOPLE, + $people + ); + + return $this; + } + /** + * Get the expression. + * + * @return \Okta\GroupRules\GroupRuleExpression + */ + public function getExpression(array $options = []): \Okta\GroupRules\GroupRuleExpression + { + return $this->getResourceProperty( + self::EXPRESSION, + \Okta\GroupRules\GroupRuleExpression::class, + $options + ); + } + + /** + * Set the expression. + * + * @param GroupRuleExpression $expression The GroupRuleExpression instance. + * @return self + */ + public function setExpression(GroupRuleExpression $expression) + { + $this->setResourceProperty( + self::EXPRESSION, + $expression + ); + + return $this; + } +} diff --git a/src/Generated/GroupRules/GroupRuleExpression.php b/src/Generated/GroupRules/GroupRuleExpression.php new file mode 100644 index 0000000000..07a1084c8e --- /dev/null +++ b/src/Generated/GroupRules/GroupRuleExpression.php @@ -0,0 +1,75 @@ +getProperty(self::TYPE); + } + /** + * Set the type. + * + * @param mixed $type The value to set. + * @return self + */ + public function setType($type) + { + $this->setProperty( + self::TYPE, + $type + ); + + return $this; + } + /** + * Get the value. + * + * @return string + */ + public function getValue(): string + { + return $this->getProperty(self::VALUE); + } + /** + * Set the value. + * + * @param mixed $value The value to set. + * @return self + */ + public function setValue($value) + { + $this->setProperty( + self::VALUE, + $value + ); + + return $this; + } +} diff --git a/src/Generated/GroupRules/GroupRuleGroupAssignment.php b/src/Generated/GroupRules/GroupRuleGroupAssignment.php new file mode 100644 index 0000000000..ad2c09d04e --- /dev/null +++ b/src/Generated/GroupRules/GroupRuleGroupAssignment.php @@ -0,0 +1,50 @@ +getProperty(self::GROUP_IDS); + } + /** + * Set the groupIds. + * + * @param mixed $groupIds The value to set. + * @return self + */ + public function setGroupIds($groupIds) + { + $this->setProperty( + self::GROUP_IDS, + $groupIds + ); + + return $this; + } +} diff --git a/src/Generated/GroupRules/GroupRuleGroupCondition.php b/src/Generated/GroupRules/GroupRuleGroupCondition.php new file mode 100644 index 0000000000..e24f7965d2 --- /dev/null +++ b/src/Generated/GroupRules/GroupRuleGroupCondition.php @@ -0,0 +1,75 @@ +getProperty(self::EXCLUDE); + } + /** + * Set the exclude. + * + * @param mixed $exclude The value to set. + * @return self + */ + public function setExclude($exclude) + { + $this->setProperty( + self::EXCLUDE, + $exclude + ); + + return $this; + } + /** + * Get the include. + * + * @return array + */ + public function getInclude(): array + { + return $this->getProperty(self::INCLUDE); + } + /** + * Set the include. + * + * @param mixed $include The value to set. + * @return self + */ + public function setInclude($include) + { + $this->setProperty( + self::INCLUDE, + $include + ); + + return $this; + } +} diff --git a/src/Generated/GroupRules/GroupRulePeopleCondition.php b/src/Generated/GroupRules/GroupRulePeopleCondition.php new file mode 100644 index 0000000000..ef33a38069 --- /dev/null +++ b/src/Generated/GroupRules/GroupRulePeopleCondition.php @@ -0,0 +1,85 @@ +getResourceProperty( + self::USERS, + \Okta\GroupRules\GroupRuleUserCondition::class, + $options + ); + } + + /** + * Set the users. + * + * @param GroupRuleUserCondition $users The GroupRuleUserCondition instance. + * @return self + */ + public function setUsers(GroupRuleUserCondition $users) + { + $this->setResourceProperty( + self::USERS, + $users + ); + + return $this; + } + /** + * Get the groups. + * + * @return \Okta\GroupRules\GroupRuleGroupCondition + */ + public function getGroups(array $options = []): \Okta\GroupRules\GroupRuleGroupCondition + { + return $this->getResourceProperty( + self::GROUPS, + \Okta\GroupRules\GroupRuleGroupCondition::class, + $options + ); + } + + /** + * Set the groups. + * + * @param GroupRuleGroupCondition $groups The GroupRuleGroupCondition instance. + * @return self + */ + public function setGroups(GroupRuleGroupCondition $groups) + { + $this->setResourceProperty( + self::GROUPS, + $groups + ); + + return $this; + } +} diff --git a/src/Generated/GroupRules/GroupRuleStatus.php b/src/Generated/GroupRules/GroupRuleStatus.php new file mode 100644 index 0000000000..d9bbbd13fc --- /dev/null +++ b/src/Generated/GroupRules/GroupRuleStatus.php @@ -0,0 +1,25 @@ +getProperty(self::EXCLUDE); + } + /** + * Set the exclude. + * + * @param mixed $exclude The value to set. + * @return self + */ + public function setExclude($exclude) + { + $this->setProperty( + self::EXCLUDE, + $exclude + ); + + return $this; + } + /** + * Get the include. + * + * @return array + */ + public function getInclude(): array + { + return $this->getProperty(self::INCLUDE); + } + /** + * Set the include. + * + * @param mixed $include The value to set. + * @return self + */ + public function setInclude($include) + { + $this->setProperty( + self::INCLUDE, + $include + ); + + return $this; + } +} diff --git a/src/Generated/Groups/Collection.php b/src/Generated/Groups/Collection.php new file mode 100644 index 0000000000..4a66f19d48 --- /dev/null +++ b/src/Generated/Groups/Collection.php @@ -0,0 +1,25 @@ +getDataStore() + ->saveResource( + '/groups', + $this, + self::class + ); + } + + public function delete() + { + return \Okta\Client::getInstance() + ->getDataStore() + ->deleteResource( + '/groups', + $this + ); + } + + /** + * Get the id. + * + * @return string + */ + public function getId(): string + { + return $this->getProperty(self::ID); + } + /** + * Get the type. + * + * @return string + */ + public function getType(): string + { + return $this->getProperty(self::TYPE); + } + /** + * Get the _links. + * + * @return \stdClass + */ + public function getLinks(): \stdClass + { + return $this->getProperty(self::LINKS); + } + /** + * Get the created. + * + * @return \Carbon\Carbon|null + */ + public function getCreated() + { + return $this->getDateProperty(self::CREATED); + } + /** + * Get the profile. + * + * @return \Okta\Groups\GroupProfile + */ + public function getProfile(array $options = []): \Okta\Groups\GroupProfile + { + return $this->getResourceProperty( + self::PROFILE, + \Okta\Groups\GroupProfile::class, + $options + ); + } + + /** + * Set the profile. + * + * @param GroupProfile $profile The GroupProfile instance. + * @return self + */ + public function setProfile(GroupProfile $profile) + { + $this->setResourceProperty( + self::PROFILE, + $profile + ); + + return $this; + } + /** + * Get the _embedded. + * + * @return \stdClass + */ + public function getEmbedded(): \stdClass + { + return $this->getProperty(self::EMBEDDED); + } + /** + * Get the lastUpdated. + * + * @return \Carbon\Carbon|null + */ + public function getLastUpdated() + { + return $this->getDateProperty(self::LAST_UPDATED); + } + /** + * Get the objectClass. + * + * @return array + */ + public function getObjectClass(): array + { + return $this->getProperty(self::OBJECT_CLASS); + } + /** + * Get the lastMembershipUpdated. + * + * @return \Carbon\Carbon|null + */ + public function getLastMembershipUpdated() + { + return $this->getDateProperty(self::LAST_MEMBERSHIP_UPDATED); + } + + /** + * Sends a request to the removeUser endpoint. + * + * + * @return mixed|null + */ + public function removeUser($userId) + { + $uri = "/api/v1/groups/{$this->getId()}/users/{$userId}"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('DELETE', $uri); + } + + /** + * Get the User object. + * + * @param array $options The options for the request. + * @return \Okta\Users\Collection + */ + public function getUsers(array $options = []): \Okta\Users\Collection + { + return $this + ->getDataStore() + ->getCollection( + "/api/v1/groups/{$this->getId()}/users", + \Okta\Users\User::class, + \Okta\Users\Collection::class, + $options + ); + } +} diff --git a/src/Generated/Groups/GroupProfile.php b/src/Generated/Groups/GroupProfile.php new file mode 100644 index 0000000000..41f5169939 --- /dev/null +++ b/src/Generated/Groups/GroupProfile.php @@ -0,0 +1,75 @@ +getProperty(self::NAME); + } + /** + * Set the name. + * + * @param mixed $name The value to set. + * @return self + */ + public function setName($name) + { + $this->setProperty( + self::NAME, + $name + ); + + return $this; + } + /** + * Get the description. + * + * @return string + */ + public function getDescription(): string + { + return $this->getProperty(self::DESCRIPTION); + } + /** + * Set the description. + * + * @param mixed $description The value to set. + * @return self + */ + public function setDescription($description) + { + $this->setProperty( + self::DESCRIPTION, + $description + ); + + return $this; + } +} diff --git a/src/Generated/Users/AppLink.php b/src/Generated/Users/AppLink.php new file mode 100644 index 0000000000..f79f19d4e1 --- /dev/null +++ b/src/Generated/Users/AppLink.php @@ -0,0 +1,125 @@ +getProperty(self::ID); + } + /** + * Get the label. + * + * @return string + */ + public function getLabel(): string + { + return $this->getProperty(self::LABEL); + } + /** + * Get the hidden. + * + * @return bool + */ + public function getHidden(): bool + { + return $this->getProperty(self::HIDDEN); + } + /** + * Get the appName. + * + * @return string + */ + public function getAppName(): string + { + return $this->getProperty(self::APP_NAME); + } + /** + * Get the linkUrl. + * + * @return string + */ + public function getLinkUrl(): string + { + return $this->getProperty(self::LINK_URL); + } + /** + * Get the logoUrl. + * + * @return string + */ + public function getLogoUrl(): string + { + return $this->getProperty(self::LOGO_URL); + } + /** + * Get the sortOrder. + * + * @return int + */ + public function getSortOrder(): int + { + return $this->getProperty(self::SORT_ORDER); + } + /** + * Get the appInstanceId. + * + * @return string + */ + public function getAppInstanceId(): string + { + return $this->getProperty(self::APP_INSTANCE_ID); + } + /** + * Get the appAssignmentId. + * + * @return string + */ + public function getAppAssignmentId(): string + { + return $this->getProperty(self::APP_ASSIGNMENT_ID); + } + /** + * Get the credentialsSetup. + * + * @return bool + */ + public function getCredentialsSetup(): bool + { + return $this->getProperty(self::CREDENTIALS_SETUP); + } +} diff --git a/src/Generated/Users/AuthenticationProvider.php b/src/Generated/Users/AuthenticationProvider.php new file mode 100644 index 0000000000..376005250f --- /dev/null +++ b/src/Generated/Users/AuthenticationProvider.php @@ -0,0 +1,75 @@ +getProperty(self::NAME); + } + /** + * Set the name. + * + * @param mixed $name The value to set. + * @return self + */ + public function setName($name) + { + $this->setProperty( + self::NAME, + $name + ); + + return $this; + } + /** + * Get the type. + * + * @return string + */ + public function getType(): string + { + return $this->getProperty(self::TYPE); + } + /** + * Set the type. + * + * @param mixed $type The value to set. + * @return self + */ + public function setType($type) + { + $this->setProperty( + self::TYPE, + $type + ); + + return $this; + } +} diff --git a/src/Generated/Users/AuthenticationProviderType.php b/src/Generated/Users/AuthenticationProviderType.php new file mode 100644 index 0000000000..4ed0a574a5 --- /dev/null +++ b/src/Generated/Users/AuthenticationProviderType.php @@ -0,0 +1,25 @@ +getResourceProperty( + self::NEW_PASSWORD, + \Okta\Users\PasswordCredential::class, + $options + ); + } + + /** + * Set the newPassword. + * + * @param PasswordCredential $newPassword The PasswordCredential instance. + * @return self + */ + public function setNewPassword(PasswordCredential $newPassword) + { + $this->setResourceProperty( + self::NEW_PASSWORD, + $newPassword + ); + + return $this; + } + /** + * Get the oldPassword. + * + * @return \Okta\Users\PasswordCredential + */ + public function getOldPassword(array $options = []): \Okta\Users\PasswordCredential + { + return $this->getResourceProperty( + self::OLD_PASSWORD, + \Okta\Users\PasswordCredential::class, + $options + ); + } + + /** + * Set the oldPassword. + * + * @param PasswordCredential $oldPassword The PasswordCredential instance. + * @return self + */ + public function setOldPassword(PasswordCredential $oldPassword) + { + $this->setResourceProperty( + self::OLD_PASSWORD, + $oldPassword + ); + + return $this; + } +} diff --git a/src/Generated/Users/Collection.php b/src/Generated/Users/Collection.php new file mode 100644 index 0000000000..c9827bf99c --- /dev/null +++ b/src/Generated/Users/Collection.php @@ -0,0 +1,25 @@ +getProperty(self::RESET_PASSWORD_URL); + } +} diff --git a/src/Generated/Users/PasswordCredential.php b/src/Generated/Users/PasswordCredential.php new file mode 100644 index 0000000000..fd5270996c --- /dev/null +++ b/src/Generated/Users/PasswordCredential.php @@ -0,0 +1,50 @@ +getProperty(self::VALUE); + } + /** + * Set the value. + * + * @param mixed $value The value to set. + * @return self + */ + public function setValue($value) + { + $this->setProperty( + self::VALUE, + $value + ); + + return $this; + } +} diff --git a/src/Generated/Users/RecoveryQuestionCredential.php b/src/Generated/Users/RecoveryQuestionCredential.php new file mode 100644 index 0000000000..dec1ff2bfd --- /dev/null +++ b/src/Generated/Users/RecoveryQuestionCredential.php @@ -0,0 +1,75 @@ +getProperty(self::ANSWER); + } + /** + * Set the answer. + * + * @param mixed $answer The value to set. + * @return self + */ + public function setAnswer($answer) + { + $this->setProperty( + self::ANSWER, + $answer + ); + + return $this; + } + /** + * Get the question. + * + * @return string + */ + public function getQuestion(): string + { + return $this->getProperty(self::QUESTION); + } + /** + * Set the question. + * + * @param mixed $question The value to set. + * @return self + */ + public function setQuestion($question) + { + $this->setProperty( + self::QUESTION, + $question + ); + + return $this; + } +} diff --git a/src/Generated/Users/ResetPasswordToken.php b/src/Generated/Users/ResetPasswordToken.php new file mode 100644 index 0000000000..34c1776b85 --- /dev/null +++ b/src/Generated/Users/ResetPasswordToken.php @@ -0,0 +1,35 @@ +getProperty(self::RESET_PASSWORD_URL); + } +} diff --git a/src/Generated/Users/Role.php b/src/Generated/Users/Role.php new file mode 100644 index 0000000000..18f2968792 --- /dev/null +++ b/src/Generated/Users/Role.php @@ -0,0 +1,120 @@ +getProperty(self::ID); + } + /** + * Get the type. + * + * @return string + */ + public function getType(): string + { + return $this->getProperty(self::TYPE); + } + /** + * Get the label. + * + * @return string + */ + public function getLabel(): string + { + return $this->getProperty(self::LABEL); + } + /** + * Get the status. + * + * @return string + */ + public function getStatus(): string + { + return $this->getProperty(self::STATUS); + } + /** + * Get the created. + * + * @return \Carbon\Carbon|null + */ + public function getCreated() + { + return $this->getDateProperty(self::CREATED); + } + /** + * Get the _embedded. + * + * @return \stdClass + */ + public function getEmbedded(): \stdClass + { + return $this->getProperty(self::EMBEDDED); + } + /** + * Get the description. + * + * @return string + */ + public function getDescription(): string + { + return $this->getProperty(self::DESCRIPTION); + } + /** + * Set the description. + * + * @param mixed $description The value to set. + * @return self + */ + public function setDescription($description) + { + $this->setProperty( + self::DESCRIPTION, + $description + ); + + return $this; + } + /** + * Get the lastUpdated. + * + * @return \Carbon\Carbon|null + */ + public function getLastUpdated() + { + return $this->getDateProperty(self::LAST_UPDATED); + } +} diff --git a/src/Generated/Users/RoleStatus.php b/src/Generated/Users/RoleStatus.php new file mode 100644 index 0000000000..79458a9ecc --- /dev/null +++ b/src/Generated/Users/RoleStatus.php @@ -0,0 +1,25 @@ +getProperty(self::TEMP_PASSWORD); + } +} diff --git a/src/Generated/Users/User.php b/src/Generated/Users/User.php new file mode 100644 index 0000000000..27fbf155ec --- /dev/null +++ b/src/Generated/Users/User.php @@ -0,0 +1,583 @@ +getDataStore() + ->createResource( + '/users', + $this, + self::class + ); + } + + public function get($query) + { + return \Okta\Client::getInstance() + ->getDataStore() + ->getResource( + $query, + self::class, + '/users' + ); + } + + public function save() + { + return \Okta\Client::getInstance() + ->getDataStore() + ->saveResource( + '/users', + $this, + self::class + ); + } + + public function delete() + { + return \Okta\Client::getInstance() + ->getDataStore() + ->deleteResource( + '/users', + $this + ); + } + + /** + * Get the id. + * + * @return string + */ + public function getId(): string + { + return $this->getProperty(self::ID); + } + /** + * Get the _links. + * + * @return \stdClass + */ + public function getLinks(): \stdClass + { + return $this->getProperty(self::LINKS); + } + /** + * Get the status. + * + * @return string + */ + public function getStatus(): string + { + return $this->getProperty(self::STATUS); + } + /** + * Get the created. + * + * @return \Carbon\Carbon|null + */ + public function getCreated() + { + return $this->getDateProperty(self::CREATED); + } + /** + * Get the profile. + * + * @return \Okta\Users\UserProfile + */ + public function getProfile(array $options = []): \Okta\Users\UserProfile + { + return $this->getResourceProperty( + self::PROFILE, + \Okta\Users\UserProfile::class, + $options + ); + } + + /** + * Set the profile. + * + * @param UserProfile $profile The UserProfile instance. + * @return self + */ + public function setProfile(UserProfile $profile) + { + $this->setResourceProperty( + self::PROFILE, + $profile + ); + + return $this; + } + /** + * Get the _embedded. + * + * @return \stdClass + */ + public function getEmbedded(): \stdClass + { + return $this->getProperty(self::EMBEDDED); + } + /** + * Get the activated. + * + * @return \Carbon\Carbon|null + */ + public function getActivated() + { + return $this->getDateProperty(self::ACTIVATED); + } + /** + * Get the lastLogin. + * + * @return \Carbon\Carbon|null + */ + public function getLastLogin() + { + return $this->getDateProperty(self::LAST_LOGIN); + } + /** + * Get the credentials. + * + * @return \Okta\Users\UserCredentials + */ + public function getCredentials(array $options = []): \Okta\Users\UserCredentials + { + return $this->getResourceProperty( + self::CREDENTIALS, + \Okta\Users\UserCredentials::class, + $options + ); + } + + /** + * Set the credentials. + * + * @param UserCredentials $credentials The UserCredentials instance. + * @return self + */ + public function setCredentials(UserCredentials $credentials) + { + $this->setResourceProperty( + self::CREDENTIALS, + $credentials + ); + + return $this; + } + /** + * Get the lastUpdated. + * + * @return \Carbon\Carbon|null + */ + public function getLastUpdated() + { + return $this->getDateProperty(self::LAST_UPDATED); + } + /** + * Get the statusChanged. + * + * @return \Carbon\Carbon|null + */ + public function getStatusChanged() + { + return $this->getDateProperty(self::STATUS_CHANGED); + } + /** + * Get the passwordChanged. + * + * @return \Carbon\Carbon|null + */ + public function getPasswordChanged() + { + return $this->getDateProperty(self::PASSWORD_CHANGED); + } + /** + * Get the transitioningToStatus. + * + * @return string + */ + public function getTransitioningToStatus(): string + { + return $this->getProperty(self::TRANSITIONING_TO_STATUS); + } + + /** + * Get the AppLink object. + * + * @param array $options The options for the request. + * @return \Okta\Users\Collection + */ + public function getAppLinks(array $options = []): \Okta\Users\Collection + { + return $this + ->getDataStore() + ->getCollection( + "/api/v1/users/{$this->getId()}/appLinks", + \Okta\Users\AppLink::class, + \Okta\Users\Collection::class, + $options + ); + } + + /** + * Sends a request to the changePassword endpoint. + * + * + * @return mixed|null + */ + public function changePassword(ChangePasswordRequest $changePasswordRequest) + { + $uri = "/api/v1/users/{$this->getId()}/credentials/change_password"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri, $changePasswordRequest); + } + + /** + * Sends a request to the changeRecoveryQuestion endpoint. + * + * + * @return mixed|null + */ + public function changeRecoveryQuestion(UserCredentials $userCredentials) + { + $uri = "/api/v1/users/{$this->getId()}/credentials/change_recovery_question"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri, $userCredentials); + } + + /** + * Sends a request to the forgotPassword endpoint. + * + * @param bool $sendEmail Sets the sendEmail flag. + * @return mixed|null + */ + public function forgotPassword(UserCredentials $userCredentials, $sendEmail = true) + { + $uri = "/api/v1/users/{$this->getId()}/credentials/forgot_password"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri, $userCredentials, ['query' => ['sendEmail' => $sendEmail]]); + } + + /** + * Get the Role object. + * + * @param array $options The options for the request. + * @return \Okta\Users\Collection + */ + public function getRoles(array $options = []): \Okta\Users\Collection + { + return $this + ->getDataStore() + ->getCollection( + "/api/v1/users/{$this->getId()}/roles", + \Okta\Users\Role::class, + \Okta\Users\Collection::class, + $options + ); + } + + /** + * Sends a request to the addRole endpoint. + * + * + * @return mixed|null + */ + public function addRole(Role $role) + { + $uri = "/api/v1/users/{$this->getId()}/roles"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri, $role); + } + + /** + * Sends a request to the removeRole endpoint. + * + * + * @return mixed|null + */ + public function removeRole($roleId) + { + $uri = "/api/v1/users/{$this->getId()}/roles/{$roleId}"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('DELETE', $uri); + } + + /** + * Get the Group object. + * + * @param array $options The options for the request. + * @return \Okta\Groups\Collection + */ + public function getGroupTargetsForRole($roleId, array $options = []): \Okta\Groups\Collection + { + return $this + ->getDataStore() + ->getCollection( + "/api/v1/users/{$this->getId()}/roles/{$roleId}/targets/groups", + \Okta\Groups\Group::class, + \Okta\Groups\Collection::class, + $options + ); + } + + /** + * Sends a request to the removeGroupTargetFromRole endpoint. + * + * + * @return mixed|null + */ + public function removeGroupTargetFromRole($roleId, $groupId) + { + $uri = "/api/v1/users/{$this->getId()}/roles/{$roleId}/targets/groups/{$groupId}"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('DELETE', $uri); + } + + /** + * Sends a request to the addGroupTargetToRole endpoint. + * + * + * @return mixed|null + */ + public function addGroupTargetToRole($roleId, $groupId) + { + $uri = "/api/v1/users/{$this->getId()}/roles/{$roleId}/targets/groups/{$groupId}"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('PUT', $uri); + } + + /** + * Get the Group object. + * + * @param array $options The options for the request. + * @return \Okta\Groups\Collection + */ + public function getGroups(array $options = []): \Okta\Groups\Collection + { + return $this + ->getDataStore() + ->getCollection( + "/api/v1/users/{$this->getId()}/groups", + \Okta\Groups\Group::class, + \Okta\Groups\Collection::class, + $options + ); + } + + /** + * Sends a request to the activate endpoint. + * + * @param bool $sendEmail Sets the sendEmail flag. + * @return mixed|null + */ + public function activate($sendEmail = true) + { + $uri = "/api/v1/users/{$this->getId()}/lifecycle/activate"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri, '', ['query' => ['sendEmail' => $sendEmail]]); + } + + /** + * Sends a request to the deactivate endpoint. + * + * + * @return mixed|null + */ + public function deactivate() + { + $uri = "/api/v1/users/{$this->getId()}/lifecycle/deactivate"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri); + } + + /** + * Sends a request to the suspend endpoint. + * + * + * @return mixed|null + */ + public function suspend() + { + $uri = "/api/v1/users/{$this->getId()}/lifecycle/suspend"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri); + } + + /** + * Sends a request to the unsuspend endpoint. + * + * + * @return mixed|null + */ + public function unsuspend() + { + $uri = "/api/v1/users/{$this->getId()}/lifecycle/unsuspend"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri); + } + + /** + * Sends a request to the resetPassword endpoint. + * + * + * @return mixed|null + */ + public function resetPassword() + { + $uri = "/api/v1/users/{$this->getId()}/lifecycle/reset_password"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri); + } + + /** + * Sends a request to the expirePassword endpoint. + * + * + * @return mixed|null + */ + public function expirePassword($tempPassword = false) + { + $uri = "/api/v1/users/{$this->getId()}/lifecycle/expire_password"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri, '', ['query' => ['tempPassword' => $tempPassword]]); + } + + /** + * Sends a request to the unlock endpoint. + * + * + * @return mixed|null + */ + public function unlock() + { + $uri = "/api/v1/users/{$this->getId()}/lifecycle/unlock"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri); + } + + /** + * Sends a request to the resetFactors endpoint. + * + * + * @return mixed|null + */ + public function resetFactors() + { + $uri = "/api/v1/users/{$this->getId()}/lifecycle/reset_factors"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri); + } + + /** + * Sends a request to the addToGroup endpoint. + * + * + * @return mixed|null + */ + public function addToGroup($groupId) + { + $uri = "/api/v1/groups/{$groupId}/users/{$this->getId()}"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('PUT', $uri); + } +} diff --git a/src/Generated/Users/UserActivationToken.php b/src/Generated/Users/UserActivationToken.php new file mode 100644 index 0000000000..027264811c --- /dev/null +++ b/src/Generated/Users/UserActivationToken.php @@ -0,0 +1,45 @@ +getProperty(self::ACTIVATION_URL); + } + /** + * Get the activationToken. + * + * @return string + */ + public function getActivationToken(): string + { + return $this->getProperty(self::ACTIVATION_TOKEN); + } +} diff --git a/src/Generated/Users/UserCredentials.php b/src/Generated/Users/UserCredentials.php new file mode 100644 index 0000000000..9f38aa6c93 --- /dev/null +++ b/src/Generated/Users/UserCredentials.php @@ -0,0 +1,115 @@ +getResourceProperty( + self::PASSWORD, + \Okta\Users\PasswordCredential::class, + $options + ); + } + + /** + * Set the password. + * + * @param PasswordCredential $password The PasswordCredential instance. + * @return self + */ + public function setPassword(PasswordCredential $password) + { + $this->setResourceProperty( + self::PASSWORD, + $password + ); + + return $this; + } + /** + * Get the provider. + * + * @return \Okta\Users\AuthenticationProvider + */ + public function getProvider(array $options = []): \Okta\Users\AuthenticationProvider + { + return $this->getResourceProperty( + self::PROVIDER, + \Okta\Users\AuthenticationProvider::class, + $options + ); + } + + /** + * Set the provider. + * + * @param AuthenticationProvider $provider The AuthenticationProvider instance. + * @return self + */ + public function setProvider(AuthenticationProvider $provider) + { + $this->setResourceProperty( + self::PROVIDER, + $provider + ); + + return $this; + } + /** + * Get the recovery_question. + * + * @return \Okta\Users\RecoveryQuestionCredential + */ + public function getRecoveryQuestion(array $options = []): \Okta\Users\RecoveryQuestionCredential + { + return $this->getResourceProperty( + self::RECOVERY_QUESTION, + \Okta\Users\RecoveryQuestionCredential::class, + $options + ); + } + + /** + * Set the recovery_question. + * + * @param RecoveryQuestionCredential $recovery_question The RecoveryQuestionCredential instance. + * @return self + */ + public function setRecoveryQuestion(RecoveryQuestionCredential $recovery_question) + { + $this->setResourceProperty( + self::RECOVERY_QUESTION, + $recovery_question + ); + + return $this; + } +} diff --git a/src/Generated/Users/UserProfile.php b/src/Generated/Users/UserProfile.php new file mode 100644 index 0000000000..edc98821b0 --- /dev/null +++ b/src/Generated/Users/UserProfile.php @@ -0,0 +1,175 @@ +getProperty(self::EMAIL); + } + /** + * Set the email. + * + * @param mixed $email The value to set. + * @return self + */ + public function setEmail($email) + { + $this->setProperty( + self::EMAIL, + $email + ); + + return $this; + } + /** + * Get the login. + * + * @return string + */ + public function getLogin(): string + { + return $this->getProperty(self::LOGIN); + } + /** + * Set the login. + * + * @param mixed $login The value to set. + * @return self + */ + public function setLogin($login) + { + $this->setProperty( + self::LOGIN, + $login + ); + + return $this; + } + /** + * Get the lastName. + * + * @return string + */ + public function getLastName(): string + { + return $this->getProperty(self::LAST_NAME); + } + /** + * Set the lastName. + * + * @param mixed $lastName The value to set. + * @return self + */ + public function setLastName($lastName) + { + $this->setProperty( + self::LAST_NAME, + $lastName + ); + + return $this; + } + /** + * Get the firstName. + * + * @return string + */ + public function getFirstName(): string + { + return $this->getProperty(self::FIRST_NAME); + } + /** + * Set the firstName. + * + * @param mixed $firstName The value to set. + * @return self + */ + public function setFirstName($firstName) + { + $this->setProperty( + self::FIRST_NAME, + $firstName + ); + + return $this; + } + /** + * Get the mobilePhone. + * + * @return string + */ + public function getMobilePhone(): string + { + return $this->getProperty(self::MOBILE_PHONE); + } + /** + * Set the mobilePhone. + * + * @param mixed $mobilePhone The value to set. + * @return self + */ + public function setMobilePhone($mobilePhone) + { + $this->setProperty( + self::MOBILE_PHONE, + $mobilePhone + ); + + return $this; + } + /** + * Get the secondEmail. + * + * @return string + */ + public function getSecondEmail(): string + { + return $this->getProperty(self::SECOND_EMAIL); + } + /** + * Set the secondEmail. + * + * @param mixed $secondEmail The value to set. + * @return self + */ + public function setSecondEmail($secondEmail) + { + $this->setProperty( + self::SECOND_EMAIL, + $secondEmail + ); + + return $this; + } +} diff --git a/src/Generated/Users/UserStatus.php b/src/Generated/Users/UserStatus.php new file mode 100644 index 0000000000..9f068af8e4 --- /dev/null +++ b/src/Generated/Users/UserStatus.php @@ -0,0 +1,25 @@ +getDataStore() - ->saveResource( - '/groups', - $this, - self::class - ); - } - - public function delete() - { - return \Okta\Client::getInstance() - ->getDataStore() - ->deleteResource( - '/groups', - $this - ); - } - - /** - * Get the id. - * - * @return string - */ - public function getId(): string - { - return $this->getProperty(self::ID); - } - /** - * Get the name. - * - * @return string - */ - public function getName(): string - { - return $this->getProperty(self::NAME); - } - /** - * Set the name. - * - * @param mixed $name The value to set. - * @return self - */ - public function setName($name) - { - $this->setProperty( - self::NAME, - $name - ); - - return $this; - } - /** - * Get the type. - * - * @return string - */ - public function getType(): string - { - return $this->getProperty(self::TYPE); - } - /** - * Set the type. - * - * @param mixed $type The value to set. - * @return self - */ - public function setType($type) - { - $this->setProperty( - self::TYPE, - $type - ); - - return $this; - } - /** - * Get the status. - * - * @return string - */ - public function getStatus(): string - { - return $this->getProperty(self::STATUS); - } - /** - * Get the actions. - * - * @return GroupRuleAction - */ - public function getActions(array $options = []): GroupRuleAction - { - return $this->getResourceProperty( - self::ACTIONS, - GroupRuleAction::class, - $options - ); - } - - /** - * Set the actions. - * - * @param GroupRuleAction $actions The GroupRuleAction instance. - * @return self - */ - public function setActions(GroupRuleAction $actions) - { - $this->setResourceProperty( - self::ACTIONS, - $actions - ); - - return $this; - } - /** - * Get the created. - * - * @return \Carbon\Carbon|null - */ - public function getCreated() - { - return $this->getDateProperty(self::CREATED); - } - /** - * Get the conditions. - * - * @return GroupRuleConditions - */ - public function getConditions(array $options = []): GroupRuleConditions - { - return $this->getResourceProperty( - self::CONDITIONS, - GroupRuleConditions::class, - $options - ); - } - /** - * Set the conditions. - * - * @param GroupRuleConditions $conditions The GroupRuleConditions instance. - * @return self - */ - public function setConditions(GroupRuleConditions $conditions) - { - $this->setResourceProperty( - self::CONDITIONS, - $conditions - ); - - return $this; - } - /** - * Get the lastUpdated. - * - * @return \Carbon\Carbon|null - */ - public function getLastUpdated() - { - return $this->getDateProperty(self::LAST_UPDATED); - } - /** - * Sends a request to the activate endpoint. - * - * - * @return mixed|null - */ - public function activate() - { - $uri = "/api/v1/groups/rules/{$this->getId()}/lifecycle/activate"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('POST', $uri); - } - /** - * Sends a request to the deactivate endpoint. - * - * - * @return mixed|null - */ - public function deactivate() - { - $uri = "/api/v1/groups/rules/{$this->getId()}/lifecycle/deactivate"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('POST', $uri); - } -} +} \ No newline at end of file diff --git a/src/GroupRules/GroupRuleAction.php b/src/GroupRules/GroupRuleAction.php index ed8e8d614c..deec01160a 100644 --- a/src/GroupRules/GroupRuleAction.php +++ b/src/GroupRules/GroupRuleAction.php @@ -1,55 +1,23 @@ getResourceProperty( - self::ASSIGN_USER_TO_GROUPS, - GroupRuleGroupAssignment::class, - $options - ); - } - /** - * Set the assignUserToGroups. - * - * @param GroupRuleGroupAssignment $assignUserToGroups The GroupRuleGroupAssignment instance. - * @return self - */ - public function setAssignUserToGroups(GroupRuleGroupAssignment $assignUserToGroups) - { - $this->setResourceProperty( - self::ASSIGN_USER_TO_GROUPS, - $assignUserToGroups - ); - - return $this; - } -} +} \ No newline at end of file diff --git a/src/GroupRules/GroupRuleConditions.php b/src/GroupRules/GroupRuleConditions.php index 8b83c6643a..9f2fdb7353 100644 --- a/src/GroupRules/GroupRuleConditions.php +++ b/src/GroupRules/GroupRuleConditions.php @@ -1,85 +1,23 @@ getResourceProperty( - self::PEOPLE, - GroupRulePeopleCondition::class, - $options - ); - } - - /** - * Set the people. - * - * @param GroupRulePeopleCondition $people The GroupRulePeopleCondition instance. - * @return self - */ - public function setPeople(GroupRulePeopleCondition $people) - { - $this->setResourceProperty( - self::PEOPLE, - $people - ); - - return $this; - } - /** - * Get the expression. - * - * @return GroupRuleExpression - */ - public function getExpression(array $options = []): GroupRuleExpression - { - return $this->getResourceProperty( - self::EXPRESSION, - GroupRuleExpression::class, - $options - ); - } - /** - * Set the expression. - * - * @param GroupRuleExpression $expression The GroupRuleExpression instance. - * @return self - */ - public function setExpression(GroupRuleExpression $expression) - { - $this->setResourceProperty( - self::EXPRESSION, - $expression - ); - - return $this; - } -} +} \ No newline at end of file diff --git a/src/GroupRules/GroupRuleExpression.php b/src/GroupRules/GroupRuleExpression.php index b13118e101..cd117a9e9a 100644 --- a/src/GroupRules/GroupRuleExpression.php +++ b/src/GroupRules/GroupRuleExpression.php @@ -1,75 +1,23 @@ getProperty(self::TYPE); - } - /** - * Set the type. - * - * @param mixed $type The value to set. - * @return self - */ - public function setType($type) - { - $this->setProperty( - self::TYPE, - $type - ); - - return $this; - } - /** - * Get the value. - * - * @return string - */ - public function getValue(): string - { - return $this->getProperty(self::VALUE); - } - /** - * Set the value. - * - * @param mixed $value The value to set. - * @return self - */ - public function setValue($value) - { - $this->setProperty( - self::VALUE, - $value - ); - return $this; - } -} +} \ No newline at end of file diff --git a/src/GroupRules/GroupRuleGroupAssignment.php b/src/GroupRules/GroupRuleGroupAssignment.php index 7e3f1e492d..d1d74afcef 100644 --- a/src/GroupRules/GroupRuleGroupAssignment.php +++ b/src/GroupRules/GroupRuleGroupAssignment.php @@ -1,50 +1,23 @@ getProperty(self::GROUP_IDS); - } - /** - * Set the groupIds. - * - * @param mixed $groupIds The value to set. - * @return self - */ - public function setGroupIds($groupIds) - { - $this->setProperty( - self::GROUP_IDS, - $groupIds - ); - return $this; - } -} +} \ No newline at end of file diff --git a/src/GroupRules/GroupRuleGroupCondition.php b/src/GroupRules/GroupRuleGroupCondition.php index 4a1dc68af7..81bad6bf84 100644 --- a/src/GroupRules/GroupRuleGroupCondition.php +++ b/src/GroupRules/GroupRuleGroupCondition.php @@ -1,75 +1,23 @@ getProperty(self::EXCLUDE); - } - /** - * Set the exclude. - * - * @param mixed $exclude The value to set. - * @return self - */ - public function setExclude($exclude) - { - $this->setProperty( - self::EXCLUDE, - $exclude - ); - - return $this; - } - /** - * Get the include. - * - * @return array - */ - public function getInclude(): array - { - return $this->getProperty(self::INCLUDE); - } - /** - * Set the include. - * - * @param mixed $include The value to set. - * @return self - */ - public function setInclude($include) - { - $this->setProperty( - self::INCLUDE, - $include - ); - return $this; - } -} +} \ No newline at end of file diff --git a/src/GroupRules/GroupRulePeopleCondition.php b/src/GroupRules/GroupRulePeopleCondition.php index 05d3c6347a..a5c1045298 100644 --- a/src/GroupRules/GroupRulePeopleCondition.php +++ b/src/GroupRules/GroupRulePeopleCondition.php @@ -1,85 +1,23 @@ getResourceProperty( - self::USERS, - GroupRuleUserCondition::class, - $options - ); - } - - /** - * Set the users. - * - * @param GroupRuleUserCondition $users The GroupRuleUserCondition instance. - * @return self - */ - public function setUsers(GroupRuleUserCondition $users) - { - $this->setResourceProperty( - self::USERS, - $users - ); - - return $this; - } - /** - * Get the groups. - * - * @return GroupRuleGroupCondition - */ - public function getGroups(array $options = []): GroupRuleGroupCondition - { - return $this->getResourceProperty( - self::GROUPS, - GroupRuleGroupCondition::class, - $options - ); - } - /** - * Set the groups. - * - * @param GroupRuleGroupCondition $groups The GroupRuleGroupCondition instance. - * @return self - */ - public function setGroups(GroupRuleGroupCondition $groups) - { - $this->setResourceProperty( - self::GROUPS, - $groups - ); - - return $this; - } -} +} \ No newline at end of file diff --git a/src/GroupRules/GroupRuleStatus.php b/src/GroupRules/GroupRuleStatus.php index d99c94eee1..e9fb133aa1 100644 --- a/src/GroupRules/GroupRuleStatus.php +++ b/src/GroupRules/GroupRuleStatus.php @@ -1,25 +1,23 @@ getProperty(self::EXCLUDE); - } - /** - * Set the exclude. - * - * @param mixed $exclude The value to set. - * @return self - */ - public function setExclude($exclude) - { - $this->setProperty( - self::EXCLUDE, - $exclude - ); - - return $this; - } - /** - * Get the include. - * - * @return array - */ - public function getInclude(): array - { - return $this->getProperty(self::INCLUDE); - } - /** - * Set the include. - * - * @param mixed $include The value to set. - * @return self - */ - public function setInclude($include) - { - $this->setProperty( - self::INCLUDE, - $include - ); - return $this; - } -} +} \ No newline at end of file diff --git a/src/Groups/Collection.php b/src/Groups/Collection.php index b4f758619a..62768ecba8 100644 --- a/src/Groups/Collection.php +++ b/src/Groups/Collection.php @@ -1,25 +1,23 @@ getDataStore() - ->saveResource( - '/groups', - $this, - self::class - ); - } - - public function delete() - { - return \Okta\Client::getInstance() - ->getDataStore() - ->deleteResource( - '/groups', - $this - ); - } - - /** - * Get the id. - * - * @return string - */ - public function getId(): string - { - return $this->getProperty(self::ID); - } - /** - * Get the type. - * - * @return string - */ - public function getType(): string - { - return $this->getProperty(self::TYPE); - } - /** - * Get the _links. - * - * @return \stdClass - */ - public function getLinks(): \stdClass - { - return $this->getProperty(self::LINKS); - } - /** - * Get the created. - * - * @return \Carbon\Carbon|null - */ - public function getCreated() - { - return $this->getDateProperty(self::CREATED); - } - /** - * Get the profile. - * - * @return GroupProfile - */ - public function getProfile(array $options = []): GroupProfile - { - return $this->getResourceProperty( - self::PROFILE, - GroupProfile::class, - $options - ); - } - /** - * Set the profile. - * - * @param GroupProfile $profile The GroupProfile instance. - * @return self - */ - public function setProfile(GroupProfile $profile) - { - $this->setResourceProperty( - self::PROFILE, - $profile - ); - - return $this; - } - /** - * Get the _embedded. - * - * @return \stdClass - */ - public function getEmbedded(): \stdClass - { - return $this->getProperty(self::EMBEDDED); - } - /** - * Get the lastUpdated. - * - * @return \Carbon\Carbon|null - */ - public function getLastUpdated() - { - return $this->getDateProperty(self::LAST_UPDATED); - } - /** - * Get the objectClass. - * - * @return array - */ - public function getObjectClass(): array - { - return $this->getProperty(self::OBJECT_CLASS); - } - /** - * Get the lastMembershipUpdated. - * - * @return \Carbon\Carbon|null - */ - public function getLastMembershipUpdated() - { - return $this->getDateProperty(self::LAST_MEMBERSHIP_UPDATED); - } - /** - * Sends a request to the removeUser endpoint. - * - * - * @return mixed|null - */ - public function removeUser($userId) - { - $uri = "/api/v1/groups/{$this->getId()}/users/{$userId}"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('DELETE', $uri); - } - /** - * Get the User object. - * - * @param array $options The options for the request. - * @return Collection - */ - public function getUsers(array $options = []): Collection - { - return $this - ->getDataStore() - ->getCollection( - "/api/v1/groups/{$this->getId()}/users", - User::class, - Collection::class, - $options - ); - } -} +} \ No newline at end of file diff --git a/src/Groups/GroupProfile.php b/src/Groups/GroupProfile.php index d7aeb0a1da..2312757bcb 100644 --- a/src/Groups/GroupProfile.php +++ b/src/Groups/GroupProfile.php @@ -1,75 +1,23 @@ getProperty(self::NAME); - } - /** - * Set the name. - * - * @param mixed $name The value to set. - * @return self - */ - public function setName($name) - { - $this->setProperty( - self::NAME, - $name - ); - - return $this; - } - /** - * Get the description. - * - * @return string - */ - public function getDescription(): string - { - return $this->getProperty(self::DESCRIPTION); - } - /** - * Set the description. - * - * @param mixed $description The value to set. - * @return self - */ - public function setDescription($description) - { - $this->setProperty( - self::DESCRIPTION, - $description - ); - return $this; - } -} +} \ No newline at end of file diff --git a/src/Resource/AbstractCollection.php b/src/Resource/AbstractCollection.php index e84b1b4990..189033b72d 100644 --- a/src/Resource/AbstractCollection.php +++ b/src/Resource/AbstractCollection.php @@ -19,7 +19,7 @@ use Illuminate\Support\Arr; use Illuminate\Support\Collection; -use Okta\Users\User; +use Okta\Generated\Users\User; class AbstractCollection extends Collection { diff --git a/src/Users/AppLink.php b/src/Users/AppLink.php index 7f07ae0117..5cf2e37634 100644 --- a/src/Users/AppLink.php +++ b/src/Users/AppLink.php @@ -1,125 +1,23 @@ getProperty(self::ID); - } - /** - * Get the label. - * - * @return string - */ - public function getLabel(): string - { - return $this->getProperty(self::LABEL); - } - /** - * Get the hidden. - * - * @return bool - */ - public function getHidden(): bool - { - return $this->getProperty(self::HIDDEN); - } - /** - * Get the appName. - * - * @return string - */ - public function getAppName(): string - { - return $this->getProperty(self::APP_NAME); - } - /** - * Get the linkUrl. - * - * @return string - */ - public function getLinkUrl(): string - { - return $this->getProperty(self::LINK_URL); - } - /** - * Get the logoUrl. - * - * @return string - */ - public function getLogoUrl(): string - { - return $this->getProperty(self::LOGO_URL); - } - /** - * Get the sortOrder. - * - * @return int - */ - public function getSortOrder(): int - { - return $this->getProperty(self::SORT_ORDER); - } - /** - * Get the appInstanceId. - * - * @return string - */ - public function getAppInstanceId(): string - { - return $this->getProperty(self::APP_INSTANCE_ID); - } - /** - * Get the appAssignmentId. - * - * @return string - */ - public function getAppAssignmentId(): string - { - return $this->getProperty(self::APP_ASSIGNMENT_ID); - } - /** - * Get the credentialsSetup. - * - * @return bool - */ - public function getCredentialsSetup(): bool - { - return $this->getProperty(self::CREDENTIALS_SETUP); - } -} +} \ No newline at end of file diff --git a/src/Users/AuthenticationProvider.php b/src/Users/AuthenticationProvider.php index 1b69887294..9894f37f18 100644 --- a/src/Users/AuthenticationProvider.php +++ b/src/Users/AuthenticationProvider.php @@ -1,75 +1,23 @@ getProperty(self::NAME); - } - /** - * Set the name. - * - * @param mixed $name The value to set. - * @return self - */ - public function setName($name) - { - $this->setProperty( - self::NAME, - $name - ); - - return $this; - } - /** - * Get the type. - * - * @return string - */ - public function getType(): string - { - return $this->getProperty(self::TYPE); - } - /** - * Set the type. - * - * @param mixed $type The value to set. - * @return self - */ - public function setType($type) - { - $this->setProperty( - self::TYPE, - $type - ); - return $this; - } -} +} \ No newline at end of file diff --git a/src/Users/AuthenticationProviderType.php b/src/Users/AuthenticationProviderType.php index 6a6bf68d27..d668f06660 100644 --- a/src/Users/AuthenticationProviderType.php +++ b/src/Users/AuthenticationProviderType.php @@ -1,25 +1,23 @@ getResourceProperty( - self::NEW_PASSWORD, - PasswordCredential::class, - $options - ); - } - - /** - * Set the newPassword. - * - * @param PasswordCredential $newPassword The PasswordCredential instance. - * @return self - */ - public function setNewPassword(PasswordCredential $newPassword) - { - $this->setResourceProperty( - self::NEW_PASSWORD, - $newPassword - ); - - return $this; - } - /** - * Get the oldPassword. - * - * @return PasswordCredential - */ - public function getOldPassword(array $options = []): PasswordCredential - { - return $this->getResourceProperty( - self::OLD_PASSWORD, - PasswordCredential::class, - $options - ); - } - /** - * Set the oldPassword. - * - * @param PasswordCredential $oldPassword The PasswordCredential instance. - * @return self - */ - public function setOldPassword(PasswordCredential $oldPassword) - { - $this->setResourceProperty( - self::OLD_PASSWORD, - $oldPassword - ); - - return $this; - } -} +} \ No newline at end of file diff --git a/src/Users/Collection.php b/src/Users/Collection.php index a25f696e97..4abca5bebb 100644 --- a/src/Users/Collection.php +++ b/src/Users/Collection.php @@ -1,25 +1,23 @@ getProperty(self::RESET_PASSWORD_URL); - } -} +} \ No newline at end of file diff --git a/src/Users/PasswordCredential.php b/src/Users/PasswordCredential.php index f2975fa64d..d15b66dcde 100644 --- a/src/Users/PasswordCredential.php +++ b/src/Users/PasswordCredential.php @@ -1,50 +1,23 @@ getProperty(self::VALUE); - } - /** - * Set the value. - * - * @param mixed $value The value to set. - * @return self - */ - public function setValue($value) - { - $this->setProperty( - self::VALUE, - $value - ); - return $this; - } -} +} \ No newline at end of file diff --git a/src/Users/RecoveryQuestionCredential.php b/src/Users/RecoveryQuestionCredential.php index ec2bda984e..2f02b3f97e 100644 --- a/src/Users/RecoveryQuestionCredential.php +++ b/src/Users/RecoveryQuestionCredential.php @@ -1,75 +1,23 @@ getProperty(self::ANSWER); - } - /** - * Set the answer. - * - * @param mixed $answer The value to set. - * @return self - */ - public function setAnswer($answer) - { - $this->setProperty( - self::ANSWER, - $answer - ); - - return $this; - } - /** - * Get the question. - * - * @return string - */ - public function getQuestion(): string - { - return $this->getProperty(self::QUESTION); - } - /** - * Set the question. - * - * @param mixed $question The value to set. - * @return self - */ - public function setQuestion($question) - { - $this->setProperty( - self::QUESTION, - $question - ); - return $this; - } -} +} \ No newline at end of file diff --git a/src/Users/ResetPasswordToken.php b/src/Users/ResetPasswordToken.php index 163cb59560..48d296b8a1 100644 --- a/src/Users/ResetPasswordToken.php +++ b/src/Users/ResetPasswordToken.php @@ -1,35 +1,23 @@ getProperty(self::RESET_PASSWORD_URL); - } -} +} \ No newline at end of file diff --git a/src/Users/Role.php b/src/Users/Role.php index fdd96d8a3e..6e741bc1b6 100644 --- a/src/Users/Role.php +++ b/src/Users/Role.php @@ -1,120 +1,23 @@ getProperty(self::ID); - } - /** - * Get the type. - * - * @return string - */ - public function getType(): string - { - return $this->getProperty(self::TYPE); - } - /** - * Get the label. - * - * @return string - */ - public function getLabel(): string - { - return $this->getProperty(self::LABEL); - } - /** - * Get the status. - * - * @return string - */ - public function getStatus(): string - { - return $this->getProperty(self::STATUS); - } - /** - * Get the created. - * - * @return \Carbon\Carbon|null - */ - public function getCreated() - { - return $this->getDateProperty(self::CREATED); - } - /** - * Get the _embedded. - * - * @return \stdClass - */ - public function getEmbedded(): \stdClass - { - return $this->getProperty(self::EMBEDDED); - } - /** - * Get the description. - * - * @return string - */ - public function getDescription(): string - { - return $this->getProperty(self::DESCRIPTION); - } - /** - * Set the description. - * - * @param mixed $description The value to set. - * @return self - */ - public function setDescription($description) - { - $this->setProperty( - self::DESCRIPTION, - $description - ); - return $this; - } - /** - * Get the lastUpdated. - * - * @return \Carbon\Carbon|null - */ - public function getLastUpdated() - { - return $this->getDateProperty(self::LAST_UPDATED); - } -} +} \ No newline at end of file diff --git a/src/Users/RoleStatus.php b/src/Users/RoleStatus.php index c3ef144671..bc4c644078 100644 --- a/src/Users/RoleStatus.php +++ b/src/Users/RoleStatus.php @@ -1,25 +1,23 @@ getProperty(self::TEMP_PASSWORD); - } -} +} \ No newline at end of file diff --git a/src/Users/User.php b/src/Users/User.php index bba8e73c67..aafa33d1f4 100644 --- a/src/Users/User.php +++ b/src/Users/User.php @@ -1,563 +1,23 @@ getDataStore() - ->createResource( - '/users', - $this, - self::class - ); - } - - public function get($query) - { - return \Okta\Client::getInstance() - ->getDataStore() - ->getResource( - $query, - self::class, - '/users' - ); - } - - public function save() - { - return \Okta\Client::getInstance() - ->getDataStore() - ->saveResource( - '/users', - $this, - self::class - ); - } - - public function delete() - { - return \Okta\Client::getInstance() - ->getDataStore() - ->deleteResource( - '/users', - $this - ); - } - - /** - * Get the id. - * - * @return string - */ - public function getId(): string - { - return $this->getProperty(self::ID); - } - /** - * Get the _links. - * - * @return \stdClass - */ - public function getLinks(): \stdClass - { - return $this->getProperty(self::LINKS); - } - /** - * Get the status. - * - * @return string - */ - public function getStatus(): string - { - return $this->getProperty(self::STATUS); - } - /** - * Get the created. - * - * @return \Carbon\Carbon|null - */ - public function getCreated() - { - return $this->getDateProperty(self::CREATED); - } - /** - * Get the profile. - * - * @return UserProfile - */ - public function getProfile(array $options = []): UserProfile - { - return $this->getResourceProperty( - self::PROFILE, - UserProfile::class, - $options - ); - } - - /** - * Set the profile. - * - * @param UserProfile $profile The UserProfile instance. - * @return self - */ - public function setProfile(UserProfile $profile) - { - $this->setResourceProperty( - self::PROFILE, - $profile - ); - - return $this; - } - /** - * Get the _embedded. - * - * @return \stdClass - */ - public function getEmbedded(): \stdClass - { - return $this->getProperty(self::EMBEDDED); - } - /** - * Get the activated. - * - * @return \Carbon\Carbon|null - */ - public function getActivated() - { - return $this->getDateProperty(self::ACTIVATED); - } - /** - * Get the lastLogin. - * - * @return \Carbon\Carbon|null - */ - public function getLastLogin() - { - return $this->getDateProperty(self::LAST_LOGIN); - } - /** - * Get the credentials. - * - * @return UserCredentials - */ - public function getCredentials(array $options = []): UserCredentials - { - return $this->getResourceProperty( - self::CREDENTIALS, - UserCredentials::class, - $options - ); - } - /** - * Set the credentials. - * - * @param UserCredentials $credentials The UserCredentials instance. - * @return self - */ - public function setCredentials(UserCredentials $credentials) - { - $this->setResourceProperty( - self::CREDENTIALS, - $credentials - ); - - return $this; - } - /** - * Get the lastUpdated. - * - * @return \Carbon\Carbon|null - */ - public function getLastUpdated() - { - return $this->getDateProperty(self::LAST_UPDATED); - } - /** - * Get the statusChanged. - * - * @return \Carbon\Carbon|null - */ - public function getStatusChanged() - { - return $this->getDateProperty(self::STATUS_CHANGED); - } - /** - * Get the passwordChanged. - * - * @return \Carbon\Carbon|null - */ - public function getPasswordChanged() - { - return $this->getDateProperty(self::PASSWORD_CHANGED); - } - /** - * Get the transitioningToStatus. - * - * @return string - */ - public function getTransitioningToStatus(): string - { - return $this->getProperty(self::TRANSITIONING_TO_STATUS); - } - /** - * Get the AppLink object. - * - * @param array $options The options for the request. - * @return Collection - */ - public function getAppLinks(array $options = []): Collection - { - return $this - ->getDataStore() - ->getCollection( - "/api/v1/users/{$this->getId()}/appLinks", - AppLink::class, - Collection::class, - $options - ); - } - /** - * Sends a request to the changePassword endpoint. - * - * - * @return mixed|null - */ - public function changePassword(ChangePasswordRequest $changePasswordRequest) - { - $uri = "/api/v1/users/{$this->getId()}/credentials/change_password"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('POST', $uri, $changePasswordRequest); - } - /** - * Sends a request to the changeRecoveryQuestion endpoint. - * - * - * @return mixed|null - */ - public function changeRecoveryQuestion(UserCredentials $userCredentials) - { - $uri = "/api/v1/users/{$this->getId()}/credentials/change_recovery_question"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('POST', $uri, $userCredentials); - } - /** - * Sends a request to the forgotPassword endpoint. - * - * @param bool $sendEmail Sets the sendEmail flag. - * @return mixed|null - */ - public function forgotPassword(UserCredentials $userCredentials, $sendEmail = true) - { - $uri = "/api/v1/users/{$this->getId()}/credentials/forgot_password"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('POST', $uri, $userCredentials, ['query' => ['sendEmail' => $sendEmail]]); - } - /** - * Get the Role object. - * - * @param array $options The options for the request. - * @return Collection - */ - public function getRoles(array $options = []): Collection - { - return $this - ->getDataStore() - ->getCollection( - "/api/v1/users/{$this->getId()}/roles", - Role::class, - Collection::class, - $options - ); - } - /** - * Sends a request to the addRole endpoint. - * - * - * @return mixed|null - */ - public function addRole(Role $role) - { - $uri = "/api/v1/users/{$this->getId()}/roles"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('POST', $uri, $role); - } - /** - * Sends a request to the removeRole endpoint. - * - * - * @return mixed|null - */ - public function removeRole($roleId) - { - $uri = "/api/v1/users/{$this->getId()}/roles/{$roleId}"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('DELETE', $uri); - } - /** - * Get the Group object. - * - * @param array $options The options for the request. - * @return Collection - */ - public function getGroupTargetsForRole($roleId, array $options = []): Collection - { - return $this - ->getDataStore() - ->getCollection( - "/api/v1/users/{$this->getId()}/roles/{$roleId}/targets/groups", - Group::class, - Collection::class, - $options - ); - } - /** - * Sends a request to the removeGroupTargetFromRole endpoint. - * - * - * @return mixed|null - */ - public function removeGroupTargetFromRole($roleId, $groupId) - { - $uri = "/api/v1/users/{$this->getId()}/roles/{$roleId}/targets/groups/{$groupId}"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('DELETE', $uri); - } - /** - * Sends a request to the addGroupTargetToRole endpoint. - * - * - * @return mixed|null - */ - public function addGroupTargetToRole($roleId, $groupId) - { - $uri = "/api/v1/users/{$this->getId()}/roles/{$roleId}/targets/groups/{$groupId}"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('PUT', $uri); - } - /** - * Get the Group object. - * - * @param array $options The options for the request. - * @return Collection - */ - public function getGroups(array $options = []): Collection - { - return $this - ->getDataStore() - ->getCollection( - "/api/v1/users/{$this->getId()}/groups", - Group::class, - Collection::class, - $options - ); - } - /** - * Sends a request to the activate endpoint. - * - * @param bool $sendEmail Sets the sendEmail flag. - * @return mixed|null - */ - public function activate($sendEmail = true) - { - $uri = "/api/v1/users/{$this->getId()}/lifecycle/activate"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('POST', $uri, '', ['query' => ['sendEmail' => $sendEmail]]); - } - /** - * Sends a request to the deactivate endpoint. - * - * - * @return mixed|null - */ - public function deactivate() - { - $uri = "/api/v1/users/{$this->getId()}/lifecycle/deactivate"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('POST', $uri); - } - /** - * Sends a request to the suspend endpoint. - * - * - * @return mixed|null - */ - public function suspend() - { - $uri = "/api/v1/users/{$this->getId()}/lifecycle/suspend"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('POST', $uri); - } - /** - * Sends a request to the unsuspend endpoint. - * - * - * @return mixed|null - */ - public function unsuspend() - { - $uri = "/api/v1/users/{$this->getId()}/lifecycle/unsuspend"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('POST', $uri); - } - /** - * Sends a request to the resetPassword endpoint. - * - * - * @return mixed|null - */ - public function resetPassword() - { - $uri = "/api/v1/users/{$this->getId()}/lifecycle/reset_password"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('POST', $uri); - } - /** - * Sends a request to the expirePassword endpoint. - * - * - * @return mixed|null - */ - public function expirePassword($tempPassword = false) - { - $uri = "/api/v1/users/{$this->getId()}/lifecycle/expire_password"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('POST', $uri, '', ['query' => ['tempPassword' => $tempPassword]]); - } - /** - * Sends a request to the unlock endpoint. - * - * - * @return mixed|null - */ - public function unlock() - { - $uri = "/api/v1/users/{$this->getId()}/lifecycle/unlock"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('POST', $uri); - } - /** - * Sends a request to the resetFactors endpoint. - * - * - * @return mixed|null - */ - public function resetFactors() - { - $uri = "/api/v1/users/{$this->getId()}/lifecycle/reset_factors"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('POST', $uri); - } - /** - * Sends a request to the addToGroup endpoint. - * - * - * @return mixed|null - */ - public function addToGroup($groupId) - { - $uri = "/api/v1/groups/{$groupId}/users/{$this->getId()}"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('PUT', $uri); - } -} +} \ No newline at end of file diff --git a/src/Users/UserActivationToken.php b/src/Users/UserActivationToken.php index 852be3efdf..53458b49e5 100644 --- a/src/Users/UserActivationToken.php +++ b/src/Users/UserActivationToken.php @@ -1,45 +1,23 @@ getProperty(self::ACTIVATION_URL); - } - /** - * Get the activationToken. - * - * @return string - */ - public function getActivationToken(): string - { - return $this->getProperty(self::ACTIVATION_TOKEN); - } -} +} \ No newline at end of file diff --git a/src/Users/UserCredentials.php b/src/Users/UserCredentials.php index e3fcd13368..80e53ec6fa 100644 --- a/src/Users/UserCredentials.php +++ b/src/Users/UserCredentials.php @@ -1,115 +1,23 @@ getResourceProperty( - self::PASSWORD, - PasswordCredential::class, - $options - ); - } - - /** - * Set the password. - * - * @param PasswordCredential $password The PasswordCredential instance. - * @return self - */ - public function setPassword(PasswordCredential $password) - { - $this->setResourceProperty( - self::PASSWORD, - $password - ); - - return $this; - } - /** - * Get the provider. - * - * @return AuthenticationProvider - */ - public function getProvider(array $options = []): AuthenticationProvider - { - return $this->getResourceProperty( - self::PROVIDER, - AuthenticationProvider::class, - $options - ); - } - - /** - * Set the provider. - * - * @param AuthenticationProvider $provider The AuthenticationProvider instance. - * @return self - */ - public function setProvider(AuthenticationProvider $provider) - { - $this->setResourceProperty( - self::PROVIDER, - $provider - ); - - return $this; - } - /** - * Get the recovery_question. - * - * @return RecoveryQuestionCredential - */ - public function getRecoveryQuestion(array $options = []): RecoveryQuestionCredential - { - return $this->getResourceProperty( - self::RECOVERY_QUESTION, - RecoveryQuestionCredential::class, - $options - ); - } - /** - * Set the recovery_question. - * - * @param RecoveryQuestionCredential $recovery_question The RecoveryQuestionCredential instance. - * @return self - */ - public function setRecoveryQuestion(RecoveryQuestionCredential $recovery_question) - { - $this->setResourceProperty( - self::RECOVERY_QUESTION, - $recovery_question - ); - - return $this; - } -} +} \ No newline at end of file diff --git a/src/Users/UserProfile.php b/src/Users/UserProfile.php index c159f98b90..44b415ad75 100644 --- a/src/Users/UserProfile.php +++ b/src/Users/UserProfile.php @@ -1,175 +1,23 @@ getProperty(self::EMAIL); - } - /** - * Set the email. - * - * @param mixed $email The value to set. - * @return self - */ - public function setEmail($email) - { - $this->setProperty( - self::EMAIL, - $email - ); - - return $this; - } - /** - * Get the login. - * - * @return string - */ - public function getLogin(): string - { - return $this->getProperty(self::LOGIN); - } - /** - * Set the login. - * - * @param mixed $login The value to set. - * @return self - */ - public function setLogin($login) - { - $this->setProperty( - self::LOGIN, - $login - ); - - return $this; - } - /** - * Get the lastName. - * - * @return string - */ - public function getLastName(): string - { - return $this->getProperty(self::LAST_NAME); - } - /** - * Set the lastName. - * - * @param mixed $lastName The value to set. - * @return self - */ - public function setLastName($lastName) - { - $this->setProperty( - self::LAST_NAME, - $lastName - ); - - return $this; - } - /** - * Get the firstName. - * - * @return string - */ - public function getFirstName(): string - { - return $this->getProperty(self::FIRST_NAME); - } - /** - * Set the firstName. - * - * @param mixed $firstName The value to set. - * @return self - */ - public function setFirstName($firstName) - { - $this->setProperty( - self::FIRST_NAME, - $firstName - ); - - return $this; - } - /** - * Get the mobilePhone. - * - * @return string - */ - public function getMobilePhone(): string - { - return $this->getProperty(self::MOBILE_PHONE); - } - /** - * Set the mobilePhone. - * - * @param mixed $mobilePhone The value to set. - * @return self - */ - public function setMobilePhone($mobilePhone) - { - $this->setProperty( - self::MOBILE_PHONE, - $mobilePhone - ); - - return $this; - } - /** - * Get the secondEmail. - * - * @return string - */ - public function getSecondEmail(): string - { - return $this->getProperty(self::SECOND_EMAIL); - } - /** - * Set the secondEmail. - * - * @param mixed $secondEmail The value to set. - * @return self - */ - public function setSecondEmail($secondEmail) - { - $this->setProperty( - self::SECOND_EMAIL, - $secondEmail - ); - return $this; - } -} +} \ No newline at end of file diff --git a/src/Users/UserStatus.php b/src/Users/UserStatus.php index ab43128ea8..4adf80571b 100644 --- a/src/Users/UserStatus.php +++ b/src/Users/UserStatus.php @@ -1,25 +1,23 @@ getUri()->getPath() ); $this->assertInstanceOf( - \Okta\Groups\Collection::class, + \Okta\Users\Collection::class, $groupUsers ); From 32d0b4c71c580533ea9f67b112642d3d447cbda2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Franusic?= Date: Tue, 19 Sep 2017 10:06:06 -0700 Subject: [PATCH 02/22] Fix spelling mitseak --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a69cb43ecb..91d2176533 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ $foundUser = $user->get('email@example.com'); dump($foundUser); ``` -### Craeating a User +### Creating a User ```php $user = new \Okta\Users\User(); $profile = new \Okta\Users\Profile(); From 85c15475f547fd707bc9ea41859300b790e9ad66 Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Tue, 19 Sep 2017 17:42:21 -0400 Subject: [PATCH 03/22] Adds Enum support --- src/Utilities/Enum.php | 191 +++++++++++++++++++++++ tests/Unit/Utilities/EnumTest.php | 247 ++++++++++++++++++++++++++++++ 2 files changed, 438 insertions(+) create mode 100644 src/Utilities/Enum.php create mode 100644 tests/Unit/Utilities/EnumTest.php diff --git a/src/Utilities/Enum.php b/src/Utilities/Enum.php new file mode 100644 index 0000000000..87c187ebc6 --- /dev/null +++ b/src/Utilities/Enum.php @@ -0,0 +1,191 @@ +isValid($value)) { + throw new \UnexpectedValueException("Value '$value' is not part of the enum " . get_called_class()); + } + $this->value = $value; + } + + /** + * @return mixed + */ + public function getValue() + { + return $this->value; + } + + /** + * Returns the enum key (i.e. the constant name). + * + * @return mixed + */ + public function getKey() + { + return static::search($this->value); + } + + /** + * @return string + */ + public function __toString() + { + return (string)$this->value; + } + + /** + * Returns the names (keys) of all constants in the Enum class + * + * @return array + */ + public static function keys() + { + return array_keys(static::toArray()); + } + + /** + * Returns instances of the Enum class of all Enum constants + * + * @return static[] Constant name in key, Enum instance in value + */ + public static function values() + { + $values = array(); + foreach (static::toArray() as $key => $value) { + $values[$key] = new static($value); + } + return $values; + } + + /** + * Returns all possible values as an array + * + * @return array Constant name in key, constant value in value + */ + public static function toArray() + { + $class = get_called_class(); + if (!array_key_exists($class, static::$cache)) { + $reflection = new \ReflectionClass($class); + static::$cache[$class] = $reflection->getConstants(); + } + return static::$cache[$class]; + } + + /** + * Check if is valid enum value + * + * @param $value + * + * @return bool + */ + public static function isValid($value) + { + return in_array($value, static::toArray(), true); + } + + /** + * Is this a valid key for the Enum + * + * @param string $key The key to test + * + * @return bool + */ + public static function isValidKey($key) + { + $array = static::toArray(); + return isset($array[$key]); + } + + /** + * Search for a key based on the value. + * + * @param string $value The value you are searching for. + * + * @return mixed + */ + public static function search($value) + { + return array_search($value, static::toArray(), true); + } + + /** + * Returns a value when called statically like so: MyEnum::SOME_VALUE() given SOME_VALUE is a class constant + * + * @param string $name + * @param array $arguments + * + * @return static + * @throws \BadMethodCallException + */ + public static function __callStatic($name, $arguments) + { + $array = static::toArray(); + if (isset($array[$name])) { + return new static($array[$name]); + } + throw new \BadMethodCallException("No static method or enum constant '$name' in class " . get_called_class()); + } + + /** + * Allows you to call methods off one of the enums. + * Methods names are either global (isWorkDay), or prefixed with the enum value (mondayIsStartOfWeek). + * + * @param string $method + * @param mixed $args + * + * @return mixed + * @throws \BadMethodCallException + */ + public function __call($method, $args) + { + $methodStart = lcfirst(str_replace('_', '', ucwords(strtolower($this->getKey()), '_'))); + + $method = ucfirst($method); + if(method_exists($this, $methodStart.$method)) { + return call_user_func_array([$this, $methodStart.$method], $args); + } + throw new \BadMethodCallException("Method {$methodStart}{$method} does not exist"); + } +} \ No newline at end of file diff --git a/tests/Unit/Utilities/EnumTest.php b/tests/Unit/Utilities/EnumTest.php new file mode 100644 index 0000000000..afac086550 --- /dev/null +++ b/tests/Unit/Utilities/EnumTest.php @@ -0,0 +1,247 @@ +assertEquals(DaysOfWeek::MONDAY, $monday->getValue()); + } + + /** + * @test + * @expectedException \BadMethodCallException + */ + public function invalid_values_will_throw_exception() + { + DaysOfWeek::BAD(); + } + + /** @test */ + public function can_get_key_from_enum() + { + $monday = new DaysOfWeek(DaysOfWeek::MONDAY); + $this->assertEquals('MONDAY', $monday->getKey()); + } + + /** @test */ + public function will_render_as_a_string() + { + $monday = new DaysOfWeek(DaysOfWeek::MONDAY); + $this->assertEquals('Monday', $monday); + } + + /** @test */ + public function all_keys_can_be_returned() + { + $keys = DaysOfWeek::keys(); + + $this->assertCount(7, $keys); + $this->assertEquals([ + 'SUNDAY','MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY','SATURDAY' + ], $keys); + } + + /** @test */ + public function all_values_can_be_returned() + { + $values = DaysOfWeek::values(); + + $this->assertCount(7, $values); + $this->assertEquals([ + 'SUNDAY' => new DaysOfWeek(DaysOfWeek::SUNDAY), + 'MONDAY' => new DaysOfWeek(DaysOfWeek::MONDAY), + 'TUESDAY' => new DaysOfWeek(DaysOfWeek::TUESDAY), + 'WEDNESDAY' => new DaysOfWeek(DaysOfWeek::WEDNESDAY), + 'THURSDAY' => new DaysOfWeek(DaysOfWeek::THURSDAY), + 'FRIDAY' => new DaysOfWeek(DaysOfWeek::FRIDAY), + 'SATURDAY' => new DaysOfWeek(DaysOfWeek::SATURDAY) + ], $values); + } + + /** @test */ + public function can_be_converted_to_array() + { + $array = DaysOfWeek::toArray(); + + $this->assertCount(7, $array); + $this->assertEquals([ + 'SUNDAY' => new DaysOfWeek(DaysOfWeek::SUNDAY), + 'MONDAY' => new DaysOfWeek(DaysOfWeek::MONDAY), + 'TUESDAY' => new DaysOfWeek(DaysOfWeek::TUESDAY), + 'WEDNESDAY' => new DaysOfWeek(DaysOfWeek::WEDNESDAY), + 'THURSDAY' => new DaysOfWeek(DaysOfWeek::THURSDAY), + 'FRIDAY' => new DaysOfWeek(DaysOfWeek::FRIDAY), + 'SATURDAY' => new DaysOfWeek(DaysOfWeek::SATURDAY) + ], $array); + } + + /** @test */ + public function can_check_if_value_is_valid_enum() + { + $valid = 'Monday'; + $invalid = 'Invalid'; + + $this->assertTrue(DaysOfWeek::isValid($valid)); + $this->assertFalse(DaysOfWeek::isValid($invalid)); + } + + /** @test */ + public function can_check_if_key_is_valid_on_enum() + { + $valid = 'MONDAY'; + $invalid = 'INVALID'; + $invalid2 = 'Monday'; + + $this->assertTrue(DaysOfWeek::isValidKey($valid)); + $this->assertFalse(DaysOfWeek::isValidKey($invalid)); + $this->assertFalse(DaysOfWeek::isValidKey($invalid2)); + } + + /** @test */ + public function can_search_for_key_based_on_value() + { + $this->assertEquals( + (new DaysOfWeek(DaysOfWeek::MONDAY))->getKey(), + DaysOfWeek::search('Monday') + ); + } + + /** @test */ + public function can_call_enum_method() + { + $monday = DaysOfWeek::MONDAY(); + + $this->assertTrue($monday->isStartOfWeek()); + } + + /** + * @test + * @expectedException \BadMethodCallException + */ + public function will_throw_exception_if_method_does_not_exist_for_enum() + { + $tuesday = DaysOfWeek::TUESDAY(); + + $this->assertTrue($tuesday->isStartOfWeek()); + } + + /** @test */ + public function able_to_handle_wildcard_methods_for_enums() + { + $sunday = DaysOfWeek::SUNDAY(); + $monday = DaysOfWeek::MONDAY(); + + $this->assertFalse($sunday->isWorkDay()); + $this->assertTrue($monday->isWorkDay()); + } + + /** @test */ + public function can_handle_multiple_word_enums() + { + $enum = MultiWordEnum::MULTI_WORD_ENUM(); + + $this->assertEquals('Multiple Word Enum', $enum->getValue()); + + $this->assertTrue($enum->testFunction()); + + $this->assertFalse($enum->alwaysFalseExceptSomethingElse()); + $this->assertTrue((MultiWordEnum::SOMETHING_ELSE())->alwaysFalseExceptSomethingElse()); + + } + + + /** + * @test + * @expectedException \UnexpectedValueException + */ + public function throws_exception_if_created_without_valid_value() + { + new MultiWordEnum('FOO_BAR'); + } + + + + + + +} + +class MultiWordEnum extends \Okta\Utilities\Enum +{ + const MULTI_WORD_ENUM = 'Multiple Word Enum'; + const SOMETHING_ELSE = 'Foo Bar'; + + public function multiWordEnumTestFunction() + { + return true; + } + + public function alwaysFalseExceptSomethingElse() + { + if($this->getKey() == 'SOMETHING_ELSE') + { + return true; + } + return false; + } +} + +/** + * Class DaysOfWeek + * + * @method static DaysOfWeek SUNDAY() + * @method static DaysOfWeek MONDAY() + * @method static DaysOfWeek TUESDAY() + * @method static DaysOfWeek WEDNESDAY() + * @method static DaysOfWeek THURSDAY() + * @method static DaysOfWeek FRIDAY() + * @method static DaysOfWeek SATURDAY() + * @method bool isStartOfWeek() + * @method bool isWorkDay() + * + */ +class DaysOfWeek extends \Okta\Utilities\Enum +{ + const SUNDAY = "Sunday"; + const MONDAY = "Monday"; + const TUESDAY = "Tuesday"; + const WEDNESDAY = "Wednesday"; + const THURSDAY = "Thursday"; + const FRIDAY = "Friday"; + const SATURDAY = "Saturday"; + + public function mondayIsStartOfWeek() + { + return true; + } + + public function isWorkDay() + { + switch($this->getKey()) { + case 'SUNDAY': + case 'SATURDAY': + return false; + default: + return true; + } + } +} From d9b8d724d51cd3397199de8d658fb8ab1754aa09 Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Wed, 20 Sep 2017 10:22:31 -0400 Subject: [PATCH 04/22] Updates return types for crud actions --- openapi/generator/index.js | 2 +- openapi/generator/templates/model.php.hbs | 8 +++++--- src/Generated/GroupRules/GroupRule.php | 4 +++- src/Generated/Groups/Group.php | 5 ++++- src/Generated/Users/User.php | 14 +++++++++++--- tests/Unit/GroupRules/GroupRuleTest.php | 5 ++++- 6 files changed, 28 insertions(+), 10 deletions(-) diff --git a/openapi/generator/index.js b/openapi/generator/index.js index 0621bcf99b..e78917a83d 100644 --- a/openapi/generator/index.js +++ b/openapi/generator/index.js @@ -200,7 +200,6 @@ function getCrudMethodName(alias) { } function getClassNameForCollection(obj) { - console.log(obj); switch(obj.operation.operationId) { case 'listUserGroups': case 'listGroupTargetsForRole': @@ -291,6 +290,7 @@ php.process = ({ spec, operations, models, handlebars }) => { if (model.crud) { for (let crud of model.crud) { + crud.defaultReturnType = `Okta\\${model.namespace}\\${model.modelName}` model.crudOperations.push(crud); } } diff --git a/openapi/generator/templates/model.php.hbs b/openapi/generator/templates/model.php.hbs index dc9de6e040..a4012e32be 100644 --- a/openapi/generator/templates/model.php.hbs +++ b/openapi/generator/templates/model.php.hbs @@ -29,6 +29,7 @@ class {{modelName}} extends AbstractResource {{/each}} {{#each crudOperations}} + {{customLog this}} {{#if (eq alias "read")}} public function get($query) { @@ -36,7 +37,7 @@ class {{modelName}} extends AbstractResource ->getDataStore() ->getResource( $query, - self::class, + \\{{this.defaultReturnType}}::class, '{{getCrudOperationPath this}}' ); } @@ -50,7 +51,7 @@ class {{modelName}} extends AbstractResource ->createResource( '{{getCrudOperationPath this}}', $this, - self::class + \\{{this.defaultReturnType}}::class ); } @@ -63,7 +64,7 @@ class {{modelName}} extends AbstractResource ->saveResource( '{{getCrudOperationPath this}}', $this, - self::class + \\{{this.defaultReturnType}}::class ); } @@ -149,6 +150,7 @@ class {{modelName}} extends AbstractResource */ public function {{getMethodArrayName alias}}({{{getCollectionMethodParams this}}}): {{getCollectionName this}} { + return $this ->getDataStore() ->getCollection( diff --git a/src/Generated/GroupRules/GroupRule.php b/src/Generated/GroupRules/GroupRule.php index ebcd3b39d5..36479a4d97 100644 --- a/src/Generated/GroupRules/GroupRule.php +++ b/src/Generated/GroupRules/GroupRule.php @@ -30,6 +30,7 @@ class GroupRule extends AbstractResource const CONDITIONS = 'conditions'; const LAST_UPDATED = 'lastUpdated'; + public function save() { return \Okta\Client::getInstance() @@ -37,10 +38,11 @@ public function save() ->saveResource( '/groups', $this, - self::class + \Okta\GroupRules\GroupRule::class ); } + public function delete() { return \Okta\Client::getInstance() diff --git a/src/Generated/Groups/Group.php b/src/Generated/Groups/Group.php index b43661ee5b..cdba54fe10 100644 --- a/src/Generated/Groups/Group.php +++ b/src/Generated/Groups/Group.php @@ -32,6 +32,7 @@ class Group extends AbstractResource const OBJECT_CLASS = 'objectClass'; const LAST_MEMBERSHIP_UPDATED = 'lastMembershipUpdated'; + public function save() { return \Okta\Client::getInstance() @@ -39,10 +40,11 @@ public function save() ->saveResource( '/groups', $this, - self::class + \Okta\Groups\Group::class ); } + public function delete() { return \Okta\Client::getInstance() @@ -180,6 +182,7 @@ public function removeUser($userId) */ public function getUsers(array $options = []): \Okta\Users\Collection { + return $this ->getDataStore() ->getCollection( diff --git a/src/Generated/Users/User.php b/src/Generated/Users/User.php index 27fbf155ec..4db40ce562 100644 --- a/src/Generated/Users/User.php +++ b/src/Generated/Users/User.php @@ -36,6 +36,7 @@ class User extends AbstractResource const PASSWORD_CHANGED = 'passwordChanged'; const TRANSITIONING_TO_STATUS = 'transitioningToStatus'; + public function create() { return \Okta\Client::getInstance() @@ -43,21 +44,23 @@ public function create() ->createResource( '/users', $this, - self::class + \Okta\Users\User::class ); } + public function get($query) { return \Okta\Client::getInstance() ->getDataStore() ->getResource( $query, - self::class, + \Okta\Users\User::class, '/users' ); } + public function save() { return \Okta\Client::getInstance() @@ -65,10 +68,11 @@ public function save() ->saveResource( '/users', $this, - self::class + \Okta\Users\User::class ); } + public function delete() { return \Okta\Client::getInstance() @@ -245,6 +249,7 @@ public function getTransitioningToStatus(): string */ public function getAppLinks(array $options = []): \Okta\Users\Collection { + return $this ->getDataStore() ->getCollection( @@ -314,6 +319,7 @@ public function forgotPassword(UserCredentials $userCredentials, $sendEmail = tr */ public function getRoles(array $options = []): \Okta\Users\Collection { + return $this ->getDataStore() ->getCollection( @@ -366,6 +372,7 @@ public function removeRole($roleId) */ public function getGroupTargetsForRole($roleId, array $options = []): \Okta\Groups\Collection { + return $this ->getDataStore() ->getCollection( @@ -418,6 +425,7 @@ public function addGroupTargetToRole($roleId, $groupId) */ public function getGroups(array $options = []): \Okta\Groups\Collection { + return $this ->getDataStore() ->getCollection( diff --git a/tests/Unit/GroupRules/GroupRuleTest.php b/tests/Unit/GroupRules/GroupRuleTest.php index 6f967ed34e..e182feb47e 100644 --- a/tests/Unit/GroupRules/GroupRuleTest.php +++ b/tests/Unit/GroupRules/GroupRuleTest.php @@ -187,15 +187,18 @@ public function save_makes_a_request_to_save_endpoint() $httpClient = $this->createNewHttpClient(); $groupRule = $this->createNewGroupRule(); - $groupRule->save(); + $response = $groupRule->save(); $request = $httpClient->getRequests(); $this->assertEquals('POST', $request[0]->getMethod()); + $this->assertEquals( "/api/v1/groups/{$groupRule->getId()}", $request[0]->getUri()->getPath() ); + + $this->assertInstanceOf(GroupRule::class, $response); } /** @test */ From 7ba491225c342f95ec40a75abae4a43930c2342a Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Wed, 27 Sep 2017 15:12:31 -0400 Subject: [PATCH 05/22] WIP --- openapi/generator/index.js | 28 +- openapi/generator/templates/enum.php.hbs | 30 ++ openapi/generator/templates/model.php.hbs | 3 +- src/Generated/GroupRules/GroupRule.php | 6 +- src/Generated/GroupRules/GroupRuleStatus.php | 8 +- src/Generated/Groups/Group.php | 4 +- src/Generated/UserFactors/CallFactor.php | 55 +++ .../UserFactors/CallFactorProfile.php | 75 ++++ src/Generated/UserFactors/Collection.php | 25 ++ src/Generated/UserFactors/EmailFactor.php | 55 +++ .../UserFactors/EmailFactorProfile.php | 50 +++ src/Generated/UserFactors/Factor.php | 350 ++++++++++++++++++ src/Generated/UserFactors/FactorProfile.php | 25 ++ .../UserFactors/FactorResultType.php | 33 ++ src/Generated/UserFactors/FactorType.php | 32 ++ src/Generated/UserFactors/HardwareFactor.php | 55 +++ .../UserFactors/HardwareFactorProfile.php | 50 +++ src/Generated/UserFactors/PushFactor.php | 55 +++ .../UserFactors/PushFactorProfile.php | 150 ++++++++ .../UserFactors/SecurityQuestion.php | 100 +++++ .../UserFactors/SecurityQuestionFactor.php | 55 +++ .../SecurityQuestionFactorProfile.php | 100 +++++ src/Generated/UserFactors/SmsFactor.php | 55 +++ .../UserFactors/SmsFactorProfile.php | 50 +++ src/Generated/UserFactors/TokenFactor.php | 55 +++ .../UserFactors/TokenFactorProfile.php | 50 +++ src/Generated/UserFactors/TotpFactor.php | 55 +++ .../UserFactors/TotpFactorProfile.php | 50 +++ .../UserFactors/VerifyFactorRequest.php | 100 +++++ .../UserFactors/VerifyFactorResponse.php | 75 ++++ src/Generated/UserFactors/WebFactor.php | 55 +++ .../UserFactors/WebFactorProfile.php | 50 +++ .../Users/AuthenticationProviderType.php | 11 +- src/Generated/Users/RoleStatus.php | 7 +- src/Generated/Users/User.php | 92 ++++- src/Generated/Users/UserStatus.php | 13 +- src/GroupRules/Collection.php | 2 +- src/GroupRules/GroupRule.php | 2 +- src/GroupRules/GroupRuleAction.php | 2 +- src/GroupRules/GroupRuleConditions.php | 2 +- src/GroupRules/GroupRuleExpression.php | 2 +- src/GroupRules/GroupRuleGroupAssignment.php | 2 +- src/GroupRules/GroupRuleGroupCondition.php | 2 +- src/GroupRules/GroupRulePeopleCondition.php | 2 +- src/GroupRules/GroupRuleStatus.php | 2 +- src/GroupRules/GroupRuleUserCondition.php | 2 +- src/Groups/Collection.php | 2 +- src/Groups/Group.php | 2 +- src/Groups/GroupProfile.php | 2 +- src/Resource/AbstractResource.php | 1 + src/UserFactors/CallFactor.php | 23 ++ src/UserFactors/CallFactorProfile.php | 23 ++ src/UserFactors/Collection.php | 23 ++ src/UserFactors/EmailFactor.php | 23 ++ src/UserFactors/EmailFactorProfile.php | 23 ++ src/UserFactors/Factor.php | 39 ++ src/UserFactors/FactorProfile.php | 23 ++ src/UserFactors/FactorResultType.php | 23 ++ src/UserFactors/FactorType.php | 44 +++ src/UserFactors/HardwareFactor.php | 23 ++ src/UserFactors/HardwareFactorProfile.php | 23 ++ src/UserFactors/PushFactor.php | 23 ++ src/UserFactors/PushFactorProfile.php | 23 ++ src/UserFactors/SecurityQuestion.php | 23 ++ src/UserFactors/SecurityQuestionFactor.php | 23 ++ .../SecurityQuestionFactorProfile.php | 23 ++ src/UserFactors/SmsFactor.php | 23 ++ src/UserFactors/SmsFactorProfile.php | 23 ++ src/UserFactors/TokenFactor.php | 23 ++ src/UserFactors/TokenFactorProfile.php | 23 ++ src/UserFactors/TotpFactor.php | 23 ++ src/UserFactors/TotpFactorProfile.php | 23 ++ src/UserFactors/VerifyFactorRequest.php | 23 ++ src/UserFactors/VerifyFactorResponse.php | 23 ++ src/UserFactors/WebFactor.php | 23 ++ src/UserFactors/WebFactorProfile.php | 23 ++ src/Users/AppLink.php | 2 +- src/Users/AuthenticationProvider.php | 2 +- src/Users/AuthenticationProviderType.php | 2 +- src/Users/ChangePasswordRequest.php | 2 +- src/Users/Collection.php | 2 +- src/Users/ForgotPasswordResponse.php | 2 +- src/Users/PasswordCredential.php | 2 +- src/Users/RecoveryQuestionCredential.php | 2 +- src/Users/ResetPasswordToken.php | 2 +- src/Users/Role.php | 2 +- src/Users/RoleStatus.php | 2 +- src/Users/TempPassword.php | 2 +- src/Users/User.php | 16 +- src/Users/UserActivationToken.php | 2 +- src/Users/UserCredentials.php | 2 +- src/Users/UserProfile.php | 2 +- src/Users/UserStatus.php | 2 +- src/Utilities/Enum.php | 4 +- tests/Unit/Users/UserTest.php | 91 ++++- 95 files changed, 2786 insertions(+), 81 deletions(-) create mode 100644 openapi/generator/templates/enum.php.hbs create mode 100644 src/Generated/UserFactors/CallFactor.php create mode 100644 src/Generated/UserFactors/CallFactorProfile.php create mode 100644 src/Generated/UserFactors/Collection.php create mode 100644 src/Generated/UserFactors/EmailFactor.php create mode 100644 src/Generated/UserFactors/EmailFactorProfile.php create mode 100644 src/Generated/UserFactors/Factor.php create mode 100644 src/Generated/UserFactors/FactorProfile.php create mode 100644 src/Generated/UserFactors/FactorResultType.php create mode 100644 src/Generated/UserFactors/FactorType.php create mode 100644 src/Generated/UserFactors/HardwareFactor.php create mode 100644 src/Generated/UserFactors/HardwareFactorProfile.php create mode 100644 src/Generated/UserFactors/PushFactor.php create mode 100644 src/Generated/UserFactors/PushFactorProfile.php create mode 100644 src/Generated/UserFactors/SecurityQuestion.php create mode 100644 src/Generated/UserFactors/SecurityQuestionFactor.php create mode 100644 src/Generated/UserFactors/SecurityQuestionFactorProfile.php create mode 100644 src/Generated/UserFactors/SmsFactor.php create mode 100644 src/Generated/UserFactors/SmsFactorProfile.php create mode 100644 src/Generated/UserFactors/TokenFactor.php create mode 100644 src/Generated/UserFactors/TokenFactorProfile.php create mode 100644 src/Generated/UserFactors/TotpFactor.php create mode 100644 src/Generated/UserFactors/TotpFactorProfile.php create mode 100644 src/Generated/UserFactors/VerifyFactorRequest.php create mode 100644 src/Generated/UserFactors/VerifyFactorResponse.php create mode 100644 src/Generated/UserFactors/WebFactor.php create mode 100644 src/Generated/UserFactors/WebFactorProfile.php create mode 100644 src/UserFactors/CallFactor.php create mode 100644 src/UserFactors/CallFactorProfile.php create mode 100644 src/UserFactors/Collection.php create mode 100644 src/UserFactors/EmailFactor.php create mode 100644 src/UserFactors/EmailFactorProfile.php create mode 100644 src/UserFactors/Factor.php create mode 100644 src/UserFactors/FactorProfile.php create mode 100644 src/UserFactors/FactorResultType.php create mode 100644 src/UserFactors/FactorType.php create mode 100644 src/UserFactors/HardwareFactor.php create mode 100644 src/UserFactors/HardwareFactorProfile.php create mode 100644 src/UserFactors/PushFactor.php create mode 100644 src/UserFactors/PushFactorProfile.php create mode 100644 src/UserFactors/SecurityQuestion.php create mode 100644 src/UserFactors/SecurityQuestionFactor.php create mode 100644 src/UserFactors/SecurityQuestionFactorProfile.php create mode 100644 src/UserFactors/SmsFactor.php create mode 100644 src/UserFactors/SmsFactorProfile.php create mode 100644 src/UserFactors/TokenFactor.php create mode 100644 src/UserFactors/TokenFactorProfile.php create mode 100644 src/UserFactors/TotpFactor.php create mode 100644 src/UserFactors/TotpFactorProfile.php create mode 100644 src/UserFactors/VerifyFactorRequest.php create mode 100644 src/UserFactors/VerifyFactorResponse.php create mode 100644 src/UserFactors/WebFactor.php create mode 100644 src/UserFactors/WebFactorProfile.php diff --git a/openapi/generator/index.js b/openapi/generator/index.js index e78917a83d..615317606e 100644 --- a/openapi/generator/index.js +++ b/openapi/generator/index.js @@ -97,7 +97,7 @@ function getParams(method) { function getMethodParams(method) { const params = getParams(method); const pathParams = params.requiredPathParams.map(param => `$${param.name}`); - const queryParams = params.defaultQueryParams.map(param => `$${param.name} = ${param.default}`); + const queryParams = params.defaultQueryParams.map(param => `$${param.name} = ` + (param.default !== '' ? `${param.default}` : `''`)); let methodParams = [].concat(pathParams); if (params.bodyModel) { @@ -206,6 +206,9 @@ function getClassNameForCollection(obj) { return '\\Okta\\Groups\\Group'; case 'listGroupUsers': return '\\Okta\\Users\\User'; + case 'listFactors': + case 'listSupportedFactors': + return '\\Okta\\UserFactors\\Factor'; default: return `\\${obj.baseClass}\\${obj.operation.responseModel}`; } @@ -219,6 +222,9 @@ function getCollectionName(obj) { return '\\Okta\\Groups\\Collection'; case 'listGroupUsers': return '\\Okta\\Users\\Collection'; + case 'listFactors': + case 'listSupportedFactors': + return '\\Okta\\UserFactors\\Collection'; default: return `\\${obj.baseClass}\\Collection`; } @@ -295,12 +301,20 @@ php.process = ({ spec, operations, models, handlebars }) => { } } - - templates.push({ - src: 'templates/model.php.hbs', - dest: `${model.namespace}/${model.modelName}.php`, - context: model - }); + if(model.enum) { + model.enum = _.sortBy(model.enum); + templates.push({ + src: 'templates/enum.php.hbs', + dest: `${model.namespace}/${model.modelName}.php`, + context: model + }); + } else { + templates.push({ + src: 'templates/model.php.hbs', + dest: `${model.namespace}/${model.modelName}.php`, + context: model + }); + } } for (let namespace of _.uniqBy(namespaces)) { diff --git a/openapi/generator/templates/enum.php.hbs b/openapi/generator/templates/enum.php.hbs new file mode 100644 index 0000000000..59ef4e7f98 --- /dev/null +++ b/openapi/generator/templates/enum.php.hbs @@ -0,0 +1,30 @@ +getResourceProperty( + self::PROFILE, + \Okta\UserFactors\CallFactorProfile::class, + $options + ); + } + + /** + * Set the profile. + * + * @param CallFactorProfile $profile The CallFactorProfile instance. + * @return self + */ + public function setProfile(CallFactorProfile $profile) + { + $this->setResourceProperty( + self::PROFILE, + $profile + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/CallFactorProfile.php b/src/Generated/UserFactors/CallFactorProfile.php new file mode 100644 index 0000000000..a1a17b84ca --- /dev/null +++ b/src/Generated/UserFactors/CallFactorProfile.php @@ -0,0 +1,75 @@ +getProperty(self::PHONE_NUMBER); + } + /** + * Set the phoneNumber. + * + * @param mixed $phoneNumber The value to set. + * @return self + */ + public function setPhoneNumber($phoneNumber) + { + $this->setProperty( + self::PHONE_NUMBER, + $phoneNumber + ); + + return $this; + } + /** + * Get the phoneExtension. + * + * @return string + */ + public function getPhoneExtension(): string + { + return $this->getProperty(self::PHONE_EXTENSION); + } + /** + * Set the phoneExtension. + * + * @param mixed $phoneExtension The value to set. + * @return self + */ + public function setPhoneExtension($phoneExtension) + { + $this->setProperty( + self::PHONE_EXTENSION, + $phoneExtension + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/Collection.php b/src/Generated/UserFactors/Collection.php new file mode 100644 index 0000000000..cbfc1b9779 --- /dev/null +++ b/src/Generated/UserFactors/Collection.php @@ -0,0 +1,25 @@ +getResourceProperty( + self::PROFILE, + \Okta\UserFactors\EmailFactorProfile::class, + $options + ); + } + + /** + * Set the profile. + * + * @param EmailFactorProfile $profile The EmailFactorProfile instance. + * @return self + */ + public function setProfile(EmailFactorProfile $profile) + { + $this->setResourceProperty( + self::PROFILE, + $profile + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/EmailFactorProfile.php b/src/Generated/UserFactors/EmailFactorProfile.php new file mode 100644 index 0000000000..a954f55a9d --- /dev/null +++ b/src/Generated/UserFactors/EmailFactorProfile.php @@ -0,0 +1,50 @@ +getProperty(self::EMAIL); + } + /** + * Set the email. + * + * @param mixed $email The value to set. + * @return self + */ + public function setEmail($email) + { + $this->setProperty( + self::EMAIL, + $email + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/Factor.php b/src/Generated/UserFactors/Factor.php new file mode 100644 index 0000000000..35f7b21652 --- /dev/null +++ b/src/Generated/UserFactors/Factor.php @@ -0,0 +1,350 @@ +getDataStore() + ->getResource( + $query, + \Okta\UserFactors\Factor::class, + '/users' + ); + } + + public function delete() + { + return \Okta\Client::getInstance() + ->getDataStore() + ->deleteResource( + '/users', + $this + ); + } + + /** + * Get the id. + * + * @return string + */ + public function getId(): string + { + return $this->getProperty(self::ID); + } + /** + * Set the id. + * + * @param mixed $id The value to set. + * @return self + */ + public function setId($id) + { + $this->setProperty( + self::ID, + $id + ); + + return $this; + } + /** + * Get the device. + * + * @return string + */ + public function getDevice(): string + { + return $this->getProperty(self::DEVICE); + } + /** + * Set the device. + * + * @param mixed $device The value to set. + * @return self + */ + public function setDevice($device) + { + $this->setProperty( + self::DEVICE, + $device + ); + + return $this; + } + /** + * Get the userId. + * + * @return string + */ + public function getUserId(): string + { + return $this->getProperty(self::USER_ID); + } + /** + * Set the userId. + * + * @param mixed $userId The value to set. + * @return self + */ + public function setUserId($userId) + { + $this->setProperty( + self::USER_ID, + $userId + ); + + return $this; + } + /** + * Get the verify. + * + * @return \Okta\UserFactors\VerifyFactorRequest + */ + public function getVerify(array $options = []): \Okta\UserFactors\VerifyFactorRequest + { + return $this->getResourceProperty( + self::VERIFY, + \Okta\UserFactors\VerifyFactorRequest::class, + $options + ); + } + + /** + * Set the verify. + * + * @param VerifyFactorRequest $verify The VerifyFactorRequest instance. + * @return self + */ + public function setVerify(VerifyFactorRequest $verify) + { + $this->setResourceProperty( + self::VERIFY, + $verify + ); + + return $this; + } + /** + * Get the profile. + * + * @return \Okta\UserFactors\FactorProfile + */ + public function getProfile(array $options = []): \Okta\UserFactors\FactorProfile + { + return $this->getResourceProperty( + self::PROFILE, + \Okta\UserFactors\FactorProfile::class, + $options + ); + } + + /** + * Set the profile. + * + * @param FactorProfile $profile The FactorProfile instance. + * @return self + */ + public function setProfile(FactorProfile $profile) + { + $this->setResourceProperty( + self::PROFILE, + $profile + ); + + return $this; + } + /** + * Get the provider. + * + * @return string + */ + public function getProvider(): string + { + return $this->getProperty(self::PROVIDER); + } + /** + * Set the provider. + * + * @param mixed $provider The value to set. + * @return self + */ + public function setProvider($provider) + { + $this->setProperty( + self::PROVIDER, + $provider + ); + + return $this; + } + /** + * Get the sessionId. + * + * @return string + */ + public function getSessionId(): string + { + return $this->getProperty(self::SESSION_ID); + } + /** + * Set the sessionId. + * + * @param mixed $sessionId The value to set. + * @return self + */ + public function setSessionId($sessionId) + { + $this->setProperty( + self::SESSION_ID, + $sessionId + ); + + return $this; + } + /** + * Get the deviceType. + * + * @return string + */ + public function getDeviceType(): string + { + return $this->getProperty(self::DEVICE_TYPE); + } + /** + * Get the factorType. + * + * @return string + */ + public function getFactorType(): string + { + return $this->getProperty(self::FACTOR_TYPE); + } + /** + * Set the factorType. + * + * @param mixed $factorType The value to set. + * @return self + */ + public function setFactorType($factorType) + { + $this->setProperty( + self::FACTOR_TYPE, + $factorType + ); + + return $this; + } + /** + * Get the mfaStateTokenId. + * + * @return string + */ + public function getMfaStateTokenId(): string + { + return $this->getProperty(self::MFA_STATE_TOKEN_ID); + } + /** + * Set the mfaStateTokenId. + * + * @param mixed $mfaStateTokenId The value to set. + * @return self + */ + public function setMfaStateTokenId($mfaStateTokenId) + { + $this->setProperty( + self::MFA_STATE_TOKEN_ID, + $mfaStateTokenId + ); + + return $this; + } + /** + * Get the rechallengeExistingFactor. + * + * @return bool + */ + public function getRechallengeExistingFactor(): bool + { + return $this->getProperty(self::RECHALLENGE_EXISTING_FACTOR); + } + /** + * Set the rechallengeExistingFactor. + * + * @param mixed $rechallengeExistingFactor The value to set. + * @return self + */ + public function setRechallengeExistingFactor($rechallengeExistingFactor) + { + $this->setProperty( + self::RECHALLENGE_EXISTING_FACTOR, + $rechallengeExistingFactor + ); + + return $this; + } + + /** + * The `sms` and `token:software:totp` [factor types](#factor-type) require activation to complete the enrollment process. + * + * + * @return mixed|null + */ + public function activate($userId, VerifyFactorRequest $verifyFactorRequest) + { + $uri = "/api/v1/users/{$userId}/factors/{$this->getId()}/lifecycle/activate"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri, $verifyFactorRequest); + } + + /** + * Verifies an OTP for a `token` or `token:hardware` factor + * + * + * @return mixed|null + */ + public function verify($userId, VerifyFactorRequest $verifyFactorRequest) + { + $uri = "/api/v1/users/{$userId}/factors/{$this->getId()}/verify"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri, $verifyFactorRequest); + } +} diff --git a/src/Generated/UserFactors/FactorProfile.php b/src/Generated/UserFactors/FactorProfile.php new file mode 100644 index 0000000000..9212ed40dc --- /dev/null +++ b/src/Generated/UserFactors/FactorProfile.php @@ -0,0 +1,25 @@ +getResourceProperty( + self::PROFILE, + \Okta\UserFactors\HardwareFactorProfile::class, + $options + ); + } + + /** + * Set the profile. + * + * @param HardwareFactorProfile $profile The HardwareFactorProfile instance. + * @return self + */ + public function setProfile(HardwareFactorProfile $profile) + { + $this->setResourceProperty( + self::PROFILE, + $profile + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/HardwareFactorProfile.php b/src/Generated/UserFactors/HardwareFactorProfile.php new file mode 100644 index 0000000000..de2af8b713 --- /dev/null +++ b/src/Generated/UserFactors/HardwareFactorProfile.php @@ -0,0 +1,50 @@ +getProperty(self::CREDENTIAL_ID); + } + /** + * Set the credentialId. + * + * @param mixed $credentialId The value to set. + * @return self + */ + public function setCredentialId($credentialId) + { + $this->setProperty( + self::CREDENTIAL_ID, + $credentialId + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/PushFactor.php b/src/Generated/UserFactors/PushFactor.php new file mode 100644 index 0000000000..70b2a556fe --- /dev/null +++ b/src/Generated/UserFactors/PushFactor.php @@ -0,0 +1,55 @@ +getResourceProperty( + self::PROFILE, + \Okta\UserFactors\PushFactorProfile::class, + $options + ); + } + + /** + * Set the profile. + * + * @param PushFactorProfile $profile The PushFactorProfile instance. + * @return self + */ + public function setProfile(PushFactorProfile $profile) + { + $this->setResourceProperty( + self::PROFILE, + $profile + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/PushFactorProfile.php b/src/Generated/UserFactors/PushFactorProfile.php new file mode 100644 index 0000000000..25182dae42 --- /dev/null +++ b/src/Generated/UserFactors/PushFactorProfile.php @@ -0,0 +1,150 @@ +getProperty(self::NAME); + } + /** + * Set the name. + * + * @param mixed $name The value to set. + * @return self + */ + public function setName($name) + { + $this->setProperty( + self::NAME, + $name + ); + + return $this; + } + /** + * Get the version. + * + * @return string + */ + public function getVersion(): string + { + return $this->getProperty(self::VERSION); + } + /** + * Set the version. + * + * @param mixed $version The value to set. + * @return self + */ + public function setVersion($version) + { + $this->setProperty( + self::VERSION, + $version + ); + + return $this; + } + /** + * Get the platform. + * + * @return string + */ + public function getPlatform(): string + { + return $this->getProperty(self::PLATFORM); + } + /** + * Set the platform. + * + * @param mixed $platform The value to set. + * @return self + */ + public function setPlatform($platform) + { + $this->setProperty( + self::PLATFORM, + $platform + ); + + return $this; + } + /** + * Get the deviceType. + * + * @return string + */ + public function getDeviceType(): string + { + return $this->getProperty(self::DEVICE_TYPE); + } + /** + * Set the deviceType. + * + * @param mixed $deviceType The value to set. + * @return self + */ + public function setDeviceType($deviceType) + { + $this->setProperty( + self::DEVICE_TYPE, + $deviceType + ); + + return $this; + } + /** + * Get the credentialId. + * + * @return string + */ + public function getCredentialId(): string + { + return $this->getProperty(self::CREDENTIAL_ID); + } + /** + * Set the credentialId. + * + * @param mixed $credentialId The value to set. + * @return self + */ + public function setCredentialId($credentialId) + { + $this->setProperty( + self::CREDENTIAL_ID, + $credentialId + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/SecurityQuestion.php b/src/Generated/UserFactors/SecurityQuestion.php new file mode 100644 index 0000000000..387e4add3d --- /dev/null +++ b/src/Generated/UserFactors/SecurityQuestion.php @@ -0,0 +1,100 @@ +getProperty(self::ANSWER); + } + /** + * Set the answer. + * + * @param mixed $answer The value to set. + * @return self + */ + public function setAnswer($answer) + { + $this->setProperty( + self::ANSWER, + $answer + ); + + return $this; + } + /** + * Get the question. + * + * @return string + */ + public function getQuestion(): string + { + return $this->getProperty(self::QUESTION); + } + /** + * Set the question. + * + * @param mixed $question The value to set. + * @return self + */ + public function setQuestion($question) + { + $this->setProperty( + self::QUESTION, + $question + ); + + return $this; + } + /** + * Get the questionText. + * + * @return string + */ + public function getQuestionText(): string + { + return $this->getProperty(self::QUESTION_TEXT); + } + /** + * Set the questionText. + * + * @param mixed $questionText The value to set. + * @return self + */ + public function setQuestionText($questionText) + { + $this->setProperty( + self::QUESTION_TEXT, + $questionText + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/SecurityQuestionFactor.php b/src/Generated/UserFactors/SecurityQuestionFactor.php new file mode 100644 index 0000000000..57d9ca70b7 --- /dev/null +++ b/src/Generated/UserFactors/SecurityQuestionFactor.php @@ -0,0 +1,55 @@ +getResourceProperty( + self::PROFILE, + \Okta\UserFactors\SecurityQuestionFactorProfile::class, + $options + ); + } + + /** + * Set the profile. + * + * @param SecurityQuestionFactorProfile $profile The SecurityQuestionFactorProfile instance. + * @return self + */ + public function setProfile(SecurityQuestionFactorProfile $profile) + { + $this->setResourceProperty( + self::PROFILE, + $profile + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/SecurityQuestionFactorProfile.php b/src/Generated/UserFactors/SecurityQuestionFactorProfile.php new file mode 100644 index 0000000000..289dac8fbb --- /dev/null +++ b/src/Generated/UserFactors/SecurityQuestionFactorProfile.php @@ -0,0 +1,100 @@ +getProperty(self::ANSWER); + } + /** + * Set the answer. + * + * @param mixed $answer The value to set. + * @return self + */ + public function setAnswer($answer) + { + $this->setProperty( + self::ANSWER, + $answer + ); + + return $this; + } + /** + * Get the question. + * + * @return string + */ + public function getQuestion(): string + { + return $this->getProperty(self::QUESTION); + } + /** + * Set the question. + * + * @param mixed $question The value to set. + * @return self + */ + public function setQuestion($question) + { + $this->setProperty( + self::QUESTION, + $question + ); + + return $this; + } + /** + * Get the questionText. + * + * @return string + */ + public function getQuestionText(): string + { + return $this->getProperty(self::QUESTION_TEXT); + } + /** + * Set the questionText. + * + * @param mixed $questionText The value to set. + * @return self + */ + public function setQuestionText($questionText) + { + $this->setProperty( + self::QUESTION_TEXT, + $questionText + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/SmsFactor.php b/src/Generated/UserFactors/SmsFactor.php new file mode 100644 index 0000000000..1adac0627f --- /dev/null +++ b/src/Generated/UserFactors/SmsFactor.php @@ -0,0 +1,55 @@ +getResourceProperty( + self::PROFILE, + \Okta\UserFactors\SmsFactorProfile::class, + $options + ); + } + + /** + * Set the profile. + * + * @param SmsFactorProfile $profile The SmsFactorProfile instance. + * @return self + */ + public function setProfile(SmsFactorProfile $profile) + { + $this->setResourceProperty( + self::PROFILE, + $profile + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/SmsFactorProfile.php b/src/Generated/UserFactors/SmsFactorProfile.php new file mode 100644 index 0000000000..ce6ed39c40 --- /dev/null +++ b/src/Generated/UserFactors/SmsFactorProfile.php @@ -0,0 +1,50 @@ +getProperty(self::PHONE_NUMBER); + } + /** + * Set the phoneNumber. + * + * @param mixed $phoneNumber The value to set. + * @return self + */ + public function setPhoneNumber($phoneNumber) + { + $this->setProperty( + self::PHONE_NUMBER, + $phoneNumber + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/TokenFactor.php b/src/Generated/UserFactors/TokenFactor.php new file mode 100644 index 0000000000..3af3ece702 --- /dev/null +++ b/src/Generated/UserFactors/TokenFactor.php @@ -0,0 +1,55 @@ +getResourceProperty( + self::PROFILE, + \Okta\UserFactors\TokenFactorProfile::class, + $options + ); + } + + /** + * Set the profile. + * + * @param TokenFactorProfile $profile The TokenFactorProfile instance. + * @return self + */ + public function setProfile(TokenFactorProfile $profile) + { + $this->setResourceProperty( + self::PROFILE, + $profile + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/TokenFactorProfile.php b/src/Generated/UserFactors/TokenFactorProfile.php new file mode 100644 index 0000000000..fa92418f2d --- /dev/null +++ b/src/Generated/UserFactors/TokenFactorProfile.php @@ -0,0 +1,50 @@ +getProperty(self::CREDENTIAL_ID); + } + /** + * Set the credentialId. + * + * @param mixed $credentialId The value to set. + * @return self + */ + public function setCredentialId($credentialId) + { + $this->setProperty( + self::CREDENTIAL_ID, + $credentialId + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/TotpFactor.php b/src/Generated/UserFactors/TotpFactor.php new file mode 100644 index 0000000000..a919e172b0 --- /dev/null +++ b/src/Generated/UserFactors/TotpFactor.php @@ -0,0 +1,55 @@ +getResourceProperty( + self::PROFILE, + \Okta\UserFactors\TotpFactorProfile::class, + $options + ); + } + + /** + * Set the profile. + * + * @param TotpFactorProfile $profile The TotpFactorProfile instance. + * @return self + */ + public function setProfile(TotpFactorProfile $profile) + { + $this->setResourceProperty( + self::PROFILE, + $profile + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/TotpFactorProfile.php b/src/Generated/UserFactors/TotpFactorProfile.php new file mode 100644 index 0000000000..2bec4bcbc3 --- /dev/null +++ b/src/Generated/UserFactors/TotpFactorProfile.php @@ -0,0 +1,50 @@ +getProperty(self::CREDENTIAL_ID); + } + /** + * Set the credentialId. + * + * @param mixed $credentialId The value to set. + * @return self + */ + public function setCredentialId($credentialId) + { + $this->setProperty( + self::CREDENTIAL_ID, + $credentialId + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/VerifyFactorRequest.php b/src/Generated/UserFactors/VerifyFactorRequest.php new file mode 100644 index 0000000000..60fbbd2f1d --- /dev/null +++ b/src/Generated/UserFactors/VerifyFactorRequest.php @@ -0,0 +1,100 @@ +getProperty(self::PASS_CODE); + } + /** + * Set the passCode. + * + * @param mixed $passCode The value to set. + * @return self + */ + public function setPassCode($passCode) + { + $this->setProperty( + self::PASS_CODE, + $passCode + ); + + return $this; + } + /** + * Get the nextPassCode. + * + * @return string + */ + public function getNextPassCode(): string + { + return $this->getProperty(self::NEXT_PASS_CODE); + } + /** + * Set the nextPassCode. + * + * @param mixed $nextPassCode The value to set. + * @return self + */ + public function setNextPassCode($nextPassCode) + { + $this->setProperty( + self::NEXT_PASS_CODE, + $nextPassCode + ); + + return $this; + } + /** + * Get the activationToken. + * + * @return string + */ + public function getActivationToken(): string + { + return $this->getProperty(self::ACTIVATION_TOKEN); + } + /** + * Set the activationToken. + * + * @param mixed $activationToken The value to set. + * @return self + */ + public function setActivationToken($activationToken) + { + $this->setProperty( + self::ACTIVATION_TOKEN, + $activationToken + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/VerifyFactorResponse.php b/src/Generated/UserFactors/VerifyFactorResponse.php new file mode 100644 index 0000000000..729aac16bf --- /dev/null +++ b/src/Generated/UserFactors/VerifyFactorResponse.php @@ -0,0 +1,75 @@ +getProperty(self::LINKS); + } + /** + * Get the _embedded. + * + * @return \stdClass + */ + public function getEmbedded(): \stdClass + { + return $this->getProperty(self::EMBEDDED); + } + /** + * Get the expiresAt. + * + * @return string + */ + public function getExpiresAt(): string + { + return $this->getProperty(self::EXPIRES_AT); + } + /** + * Get the factorResult. + * + * @return string + */ + public function getFactorResult(): string + { + return $this->getProperty(self::FACTOR_RESULT); + } + /** + * Get the factorResultMessage. + * + * @return string + */ + public function getFactorResultMessage(): string + { + return $this->getProperty(self::FACTOR_RESULT_MESSAGE); + } +} diff --git a/src/Generated/UserFactors/WebFactor.php b/src/Generated/UserFactors/WebFactor.php new file mode 100644 index 0000000000..ab808fdd17 --- /dev/null +++ b/src/Generated/UserFactors/WebFactor.php @@ -0,0 +1,55 @@ +getResourceProperty( + self::PROFILE, + \Okta\UserFactors\WebFactorProfile::class, + $options + ); + } + + /** + * Set the profile. + * + * @param WebFactorProfile $profile The WebFactorProfile instance. + * @return self + */ + public function setProfile(WebFactorProfile $profile) + { + $this->setResourceProperty( + self::PROFILE, + $profile + ); + + return $this; + } +} diff --git a/src/Generated/UserFactors/WebFactorProfile.php b/src/Generated/UserFactors/WebFactorProfile.php new file mode 100644 index 0000000000..cffd0c5021 --- /dev/null +++ b/src/Generated/UserFactors/WebFactorProfile.php @@ -0,0 +1,50 @@ +getProperty(self::CREDENTIAL_ID); + } + /** + * Set the credentialId. + * + * @param mixed $credentialId The value to set. + * @return self + */ + public function setCredentialId($credentialId) + { + $this->setProperty( + self::CREDENTIAL_ID, + $credentialId + ); + + return $this; + } +} diff --git a/src/Generated/Users/AuthenticationProviderType.php b/src/Generated/Users/AuthenticationProviderType.php index 4ed0a574a5..2fa9cf5c3c 100644 --- a/src/Generated/Users/AuthenticationProviderType.php +++ b/src/Generated/Users/AuthenticationProviderType.php @@ -17,9 +17,14 @@ namespace Okta\Generated\Users; -use Okta\Resource\AbstractResource; +use Okta\Utilities\Enum; -class AuthenticationProviderType extends AbstractResource +class AuthenticationProviderType extends Enum { - + const ACTIVE_DIRECTORY = 'ACTIVE_DIRECTORY'; + const FEDERATION = 'FEDERATION'; + const IMPORT = 'IMPORT'; + const LDAP = 'LDAP'; + const OKTA = 'OKTA'; + const SOCIAL = 'SOCIAL'; } diff --git a/src/Generated/Users/RoleStatus.php b/src/Generated/Users/RoleStatus.php index 79458a9ecc..baacc10200 100644 --- a/src/Generated/Users/RoleStatus.php +++ b/src/Generated/Users/RoleStatus.php @@ -17,9 +17,10 @@ namespace Okta\Generated\Users; -use Okta\Resource\AbstractResource; +use Okta\Utilities\Enum; -class RoleStatus extends AbstractResource +class RoleStatus extends Enum { - + const ACTIVE = 'ACTIVE'; + const INACTIVE = 'INACTIVE'; } diff --git a/src/Generated/Users/User.php b/src/Generated/Users/User.php index 4db40ce562..06bc3f14ca 100644 --- a/src/Generated/Users/User.php +++ b/src/Generated/Users/User.php @@ -18,6 +18,7 @@ namespace Okta\Generated\Users; use Okta\Groups\Group; +use Okta\UserFactors\Factor; use Okta\Resource\AbstractResource; class User extends AbstractResource @@ -36,7 +37,6 @@ class User extends AbstractResource const PASSWORD_CHANGED = 'passwordChanged'; const TRANSITIONING_TO_STATUS = 'transitioningToStatus'; - public function create() { return \Okta\Client::getInstance() @@ -48,7 +48,6 @@ public function create() ); } - public function get($query) { return \Okta\Client::getInstance() @@ -60,7 +59,6 @@ public function get($query) ); } - public function save() { return \Okta\Client::getInstance() @@ -72,7 +70,6 @@ public function save() ); } - public function delete() { return \Okta\Client::getInstance() @@ -261,7 +258,7 @@ public function getAppLinks(array $options = []): \Okta\Users\Collection } /** - * Sends a request to the changePassword endpoint. + * Changes a user's password by validating the user's current password. This operation can only be performed on users in `STAGED`, `ACTIVE`, `PASSWORD_EXPIRED`, or `RECOVERY` status that have a valid [password credential](#password-object) * * * @return mixed|null @@ -278,7 +275,7 @@ public function changePassword(ChangePasswordRequest $changePasswordRequest) } /** - * Sends a request to the changeRecoveryQuestion endpoint. + * Changes a user's recovery question & answer credential by validating the user's current password. This operation can only be performed on users in **STAGED**, **ACTIVE** or **RECOVERY** `status` that have a valid [password credential](#password-object) * * * @return mixed|null @@ -295,7 +292,7 @@ public function changeRecoveryQuestion(UserCredentials $userCredentials) } /** - * Sends a request to the forgotPassword endpoint. + * Generates a one-time token (OTT) that can be used to reset a user's password. The user will be required to validate their security question's answer when visiting the reset link. This operation can only be performed on users with a valid [recovery question credential](#recovery-question-object) and have an `ACTIVE` status. * * @param bool $sendEmail Sets the sendEmail flag. * @return mixed|null @@ -331,7 +328,7 @@ public function getRoles(array $options = []): \Okta\Users\Collection } /** - * Sends a request to the addRole endpoint. + * Assigns a role to a user. * * * @return mixed|null @@ -348,7 +345,7 @@ public function addRole(Role $role) } /** - * Sends a request to the removeRole endpoint. + * Unassigns a role from a user. * * * @return mixed|null @@ -384,7 +381,7 @@ public function getGroupTargetsForRole($roleId, array $options = []): \Okta\Grou } /** - * Sends a request to the removeGroupTargetFromRole endpoint. + * * * * @return mixed|null @@ -401,7 +398,7 @@ public function removeGroupTargetFromRole($roleId, $groupId) } /** - * Sends a request to the addGroupTargetToRole endpoint. + * * * * @return mixed|null @@ -437,7 +434,7 @@ public function getGroups(array $options = []): \Okta\Groups\Collection } /** - * Sends a request to the activate endpoint. + * Activates a user. This operation can only be performed on users with a `STAGED` status. Activation of a user is an asynchronous operation. The user will have the `transitioningToStatus` property with a value of `ACTIVE` during activation to indicate that the user hasn't completed the asynchronous operation. The user will have a status of `ACTIVE` when the activation process is complete. * * @param bool $sendEmail Sets the sendEmail flag. * @return mixed|null @@ -454,7 +451,7 @@ public function activate($sendEmail = true) } /** - * Sends a request to the deactivate endpoint. + * Deactivates a user. This operation can only be performed on users that do not have a `DEPROVISIONED` status. Deactivation of a user is an asynchronous operation. The user will have the `transitioningToStatus` property with a value of `DEPROVISIONED` during deactivation to indicate that the user hasn't completed the asynchronous operation. The user will have a status of `DEPROVISIONED` when the deactivation process is complete. * * * @return mixed|null @@ -471,7 +468,7 @@ public function deactivate() } /** - * Sends a request to the suspend endpoint. + * Suspends a user. This operation can only be performed on users with an `ACTIVE` status. The user will have a status of `SUSPENDED` when the process is complete. * * * @return mixed|null @@ -488,7 +485,7 @@ public function suspend() } /** - * Sends a request to the unsuspend endpoint. + * Unsuspends a user and returns them to the `ACTIVE` state. This operation can only be performed on users that have a `SUSPENDED` status. * * * @return mixed|null @@ -505,7 +502,7 @@ public function unsuspend() } /** - * Sends a request to the resetPassword endpoint. + * Generates a one-time token (OTT) that can be used to reset a user's password. The OTT link can be automatically emailed to the user or returned to the API caller and distributed using a custom flow. * * * @return mixed|null @@ -522,7 +519,7 @@ public function resetPassword() } /** - * Sends a request to the expirePassword endpoint. + * This operation transitions the user to the status of `PASSWORD_EXPIRED` so that the user is required to change their password at their next login. * * * @return mixed|null @@ -539,7 +536,7 @@ public function expirePassword($tempPassword = false) } /** - * Sends a request to the unlock endpoint. + * Unlocks a user with a `LOCKED_OUT` status and returns them to `ACTIVE` status. Users will be able to login with their current password. * * * @return mixed|null @@ -556,7 +553,7 @@ public function unlock() } /** - * Sends a request to the resetFactors endpoint. + * This operation resets all factors for the specified user. All MFA factor enrollments returned to the unenrolled state. The user's status remains ACTIVE. This link is present only if the user is currently enrolled in one or more MFA factors. * * * @return mixed|null @@ -573,7 +570,7 @@ public function resetFactors() } /** - * Sends a request to the addToGroup endpoint. + * Adds a [user](users.html#user-model) to a group with `OKTA_GROUP` type. * * * @return mixed|null @@ -588,4 +585,59 @@ public function addToGroup($groupId) ->getDataStore() ->executeRequest('PUT', $uri); } + + /** + * Enrolls a user with a supported [factor](#list-factors-to-enroll) + * + * + * @return mixed|null + */ + public function addFactor(Factor $factor, $templateId = '', $updatePhone = false) + { + $uri = "/api/v1/users/{$this->getId()}/factors"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri, $factor, ['query' => ['templateId' => $templateId,'updatePhone' => $updatePhone]]); + } + + /** + * Get the Factor object. + * + * @param array $options The options for the request. + * @return \Okta\UserFactors\Collection + */ + public function getSupportedFactors(array $options = []): \Okta\UserFactors\Collection + { + + return $this + ->getDataStore() + ->getCollection( + "/api/v1/users/{$this->getId()}/factors/catalog", + \Okta\UserFactors\Factor::class, + \Okta\UserFactors\Collection::class, + $options + ); + } + + /** + * Get the Factor object. + * + * @param array $options The options for the request. + * @return \Okta\UserFactors\Collection + */ + public function getFactors(array $options = []): \Okta\UserFactors\Collection + { + + return $this + ->getDataStore() + ->getCollection( + "/api/v1/users/{$this->getId()}/factors", + \Okta\UserFactors\Factor::class, + \Okta\UserFactors\Collection::class, + $options + ); + } } diff --git a/src/Generated/Users/UserStatus.php b/src/Generated/Users/UserStatus.php index 9f068af8e4..55500b111d 100644 --- a/src/Generated/Users/UserStatus.php +++ b/src/Generated/Users/UserStatus.php @@ -17,9 +17,16 @@ namespace Okta\Generated\Users; -use Okta\Resource\AbstractResource; +use Okta\Utilities\Enum; -class UserStatus extends AbstractResource +class UserStatus extends Enum { - + const ACTIVE = 'ACTIVE'; + const DEPROVISIONED = 'DEPROVISIONED'; + const LOCKED_OUT = 'LOCKED_OUT'; + const PASSWORD_EXPIRED = 'PASSWORD_EXPIRED'; + const PROVISIONED = 'PROVISIONED'; + const RECOVERY = 'RECOVERY'; + const STAGED = 'STAGED'; + const SUSPENDED = 'SUSPENDED'; } diff --git a/src/GroupRules/Collection.php b/src/GroupRules/Collection.php index 35d1bf6b9e..8411b92e67 100644 --- a/src/GroupRules/Collection.php +++ b/src/GroupRules/Collection.php @@ -20,4 +20,4 @@ class Collection extends \Okta\Generated\GroupRules\Collection { -} \ No newline at end of file +} diff --git a/src/GroupRules/GroupRule.php b/src/GroupRules/GroupRule.php index 50e1877dbb..c8c470c568 100644 --- a/src/GroupRules/GroupRule.php +++ b/src/GroupRules/GroupRule.php @@ -20,4 +20,4 @@ class GroupRule extends \Okta\Generated\GroupRules\GroupRule { -} \ No newline at end of file +} diff --git a/src/GroupRules/GroupRuleAction.php b/src/GroupRules/GroupRuleAction.php index deec01160a..0abbcd0216 100644 --- a/src/GroupRules/GroupRuleAction.php +++ b/src/GroupRules/GroupRuleAction.php @@ -20,4 +20,4 @@ class GroupRuleAction extends \Okta\Generated\GroupRules\GroupRuleAction { -} \ No newline at end of file +} diff --git a/src/GroupRules/GroupRuleConditions.php b/src/GroupRules/GroupRuleConditions.php index 9f2fdb7353..3421f3a392 100644 --- a/src/GroupRules/GroupRuleConditions.php +++ b/src/GroupRules/GroupRuleConditions.php @@ -20,4 +20,4 @@ class GroupRuleConditions extends \Okta\Generated\GroupRules\GroupRuleConditions { -} \ No newline at end of file +} diff --git a/src/GroupRules/GroupRuleExpression.php b/src/GroupRules/GroupRuleExpression.php index cd117a9e9a..6f1b1fd9c3 100644 --- a/src/GroupRules/GroupRuleExpression.php +++ b/src/GroupRules/GroupRuleExpression.php @@ -20,4 +20,4 @@ class GroupRuleExpression extends \Okta\Generated\GroupRules\GroupRuleExpression { -} \ No newline at end of file +} diff --git a/src/GroupRules/GroupRuleGroupAssignment.php b/src/GroupRules/GroupRuleGroupAssignment.php index d1d74afcef..fdad06b681 100644 --- a/src/GroupRules/GroupRuleGroupAssignment.php +++ b/src/GroupRules/GroupRuleGroupAssignment.php @@ -20,4 +20,4 @@ class GroupRuleGroupAssignment extends \Okta\Generated\GroupRules\GroupRuleGroupAssignment { -} \ No newline at end of file +} diff --git a/src/GroupRules/GroupRuleGroupCondition.php b/src/GroupRules/GroupRuleGroupCondition.php index 81bad6bf84..a91a45a219 100644 --- a/src/GroupRules/GroupRuleGroupCondition.php +++ b/src/GroupRules/GroupRuleGroupCondition.php @@ -20,4 +20,4 @@ class GroupRuleGroupCondition extends \Okta\Generated\GroupRules\GroupRuleGroupCondition { -} \ No newline at end of file +} diff --git a/src/GroupRules/GroupRulePeopleCondition.php b/src/GroupRules/GroupRulePeopleCondition.php index a5c1045298..4f0ab87220 100644 --- a/src/GroupRules/GroupRulePeopleCondition.php +++ b/src/GroupRules/GroupRulePeopleCondition.php @@ -20,4 +20,4 @@ class GroupRulePeopleCondition extends \Okta\Generated\GroupRules\GroupRulePeopleCondition { -} \ No newline at end of file +} diff --git a/src/GroupRules/GroupRuleStatus.php b/src/GroupRules/GroupRuleStatus.php index e9fb133aa1..3e9d780fff 100644 --- a/src/GroupRules/GroupRuleStatus.php +++ b/src/GroupRules/GroupRuleStatus.php @@ -20,4 +20,4 @@ class GroupRuleStatus extends \Okta\Generated\GroupRules\GroupRuleStatus { -} \ No newline at end of file +} diff --git a/src/GroupRules/GroupRuleUserCondition.php b/src/GroupRules/GroupRuleUserCondition.php index 77e7023699..c12b194c43 100644 --- a/src/GroupRules/GroupRuleUserCondition.php +++ b/src/GroupRules/GroupRuleUserCondition.php @@ -20,4 +20,4 @@ class GroupRuleUserCondition extends \Okta\Generated\GroupRules\GroupRuleUserCondition { -} \ No newline at end of file +} diff --git a/src/Groups/Collection.php b/src/Groups/Collection.php index 62768ecba8..4483e5eb4a 100644 --- a/src/Groups/Collection.php +++ b/src/Groups/Collection.php @@ -20,4 +20,4 @@ class Collection extends \Okta\Generated\Users\Collection { -} \ No newline at end of file +} diff --git a/src/Groups/Group.php b/src/Groups/Group.php index e0892d837e..8eb7f50de0 100644 --- a/src/Groups/Group.php +++ b/src/Groups/Group.php @@ -20,4 +20,4 @@ class Group extends \Okta\Generated\Groups\Group { -} \ No newline at end of file +} diff --git a/src/Groups/GroupProfile.php b/src/Groups/GroupProfile.php index 2312757bcb..57de6e411c 100644 --- a/src/Groups/GroupProfile.php +++ b/src/Groups/GroupProfile.php @@ -20,4 +20,4 @@ class GroupProfile extends \Okta\Generated\Groups\GroupProfile { -} \ No newline at end of file +} diff --git a/src/Resource/AbstractResource.php b/src/Resource/AbstractResource.php index 7345329f8c..3c813fc910 100644 --- a/src/Resource/AbstractResource.php +++ b/src/Resource/AbstractResource.php @@ -384,4 +384,5 @@ public function __toString() } return json_encode($properties, true); } + } diff --git a/src/UserFactors/CallFactor.php b/src/UserFactors/CallFactor.php new file mode 100644 index 0000000000..db18c4c43c --- /dev/null +++ b/src/UserFactors/CallFactor.php @@ -0,0 +1,23 @@ +getFactorType(); + + $factorEnum = (new FactorType($factorType)); + + $realFactor = $factorEnum->mapToFactorType(); + + $properties = new \stdClass(); + foreach ($this->getPropertyNames() as $name) { + $properties->$name = $this->getProperty($name); + } + + return new $realFactor(null, $properties); + + } +} diff --git a/src/UserFactors/FactorProfile.php b/src/UserFactors/FactorProfile.php new file mode 100644 index 0000000000..415856e02f --- /dev/null +++ b/src/UserFactors/FactorProfile.php @@ -0,0 +1,23 @@ +getValue()) { + case 'call': + return \Okta\UserFactors\CallFactor::class; + case 'push': + return \Okta\UserFactors\PushFactor::class; + case 'question': + return \Okta\UserFactors\SecurityQuestionFactor::class; + case 'sms': + return \Okta\UserFactors\SmsFactor::class; + case 'token': + case 'token:hardware': + return \Okta\UserFactors\TokenFactor::class; + case 'token:software:totp': + return \Okta\UserFactors\TotpFactor::class; + case 'web': + return \Okta\UserFactors\WebFactor::class; + default: + return \Okta\UserFactors\Factor::class; + } + } +} diff --git a/src/UserFactors/HardwareFactor.php b/src/UserFactors/HardwareFactor.php new file mode 100644 index 0000000000..eea74ae03a --- /dev/null +++ b/src/UserFactors/HardwareFactor.php @@ -0,0 +1,23 @@ +each(function(Factor $factor, $key) use ($supportedFactors) { + + $supportedFactors[$key] = $factor->convertFromGenericFactor(); + + }); + + } + +} diff --git a/src/Users/UserActivationToken.php b/src/Users/UserActivationToken.php index 53458b49e5..524d81bdda 100644 --- a/src/Users/UserActivationToken.php +++ b/src/Users/UserActivationToken.php @@ -20,4 +20,4 @@ class UserActivationToken extends \Okta\Generated\Users\UserActivationToken { -} \ No newline at end of file +} diff --git a/src/Users/UserCredentials.php b/src/Users/UserCredentials.php index 80e53ec6fa..62b439f2b2 100644 --- a/src/Users/UserCredentials.php +++ b/src/Users/UserCredentials.php @@ -20,4 +20,4 @@ class UserCredentials extends \Okta\Generated\Users\UserCredentials { -} \ No newline at end of file +} diff --git a/src/Users/UserProfile.php b/src/Users/UserProfile.php index 44b415ad75..4e0f4c8e28 100644 --- a/src/Users/UserProfile.php +++ b/src/Users/UserProfile.php @@ -20,4 +20,4 @@ class UserProfile extends \Okta\Generated\Users\UserProfile { -} \ No newline at end of file +} diff --git a/src/Users/UserStatus.php b/src/Users/UserStatus.php index 4adf80571b..413f26177b 100644 --- a/src/Users/UserStatus.php +++ b/src/Users/UserStatus.php @@ -20,4 +20,4 @@ class UserStatus extends \Okta\Generated\Users\UserStatus { -} \ No newline at end of file +} diff --git a/src/Utilities/Enum.php b/src/Utilities/Enum.php index 87c187ebc6..9b93378b42 100644 --- a/src/Utilities/Enum.php +++ b/src/Utilities/Enum.php @@ -183,9 +183,9 @@ public function __call($method, $args) $methodStart = lcfirst(str_replace('_', '', ucwords(strtolower($this->getKey()), '_'))); $method = ucfirst($method); - if(method_exists($this, $methodStart.$method)) { + if (method_exists($this, $methodStart.$method)) { return call_user_func_array([$this, $methodStart.$method], $args); } throw new \BadMethodCallException("Method {$methodStart}{$method} does not exist"); } -} \ No newline at end of file +} diff --git a/tests/Unit/Users/UserTest.php b/tests/Unit/Users/UserTest.php index 7f7728b824..009d762cec 100644 --- a/tests/Unit/Users/UserTest.php +++ b/tests/Unit/Users/UserTest.php @@ -415,7 +415,7 @@ public function get_groups_makes_request_to_correct_location() $user->getGroups(); $request = $httpClient->getRequests(); - + dump($request[0]->getBody()->getContents()); $this->assertEquals('GET', $request[0]->getMethod()); $this->assertEquals( "/api/v1/users/{$user->getId()}/groups", @@ -782,6 +782,95 @@ public function expire_password_makes_request_to_correct_location() } + /** @test */ + public function adding_factor_makes_request_to_correct_location() + { + $httpClient = $this->createNewHttpClient(); + $user = $this->createNewUser(); + + $factor = new\Okta\UserFactors\Factor; + $factor->setUserId($user->getId()); + + $user->addFactor($factor); + + $request = $httpClient->getRequests(); + $this->assertEquals('POST', $request[0]->getMethod()); + + $this->assertEquals( + "/api/v1/users/{$user->getId()}/factors", + $request[0]->getUri()->getPath() + ); + + $this->assertEquals( + (string)$factor, + $request[0]->getBody()->getContents() + ); + } + + /** @test */ + public function get_supported_factors_makes_request_to_correct_location() + { + $httpClient = $this->createNewHttpClient([ + 'getBody' => '[{"factorType":"question"}, {"factorType": "token:software:totp"}]' + ]); + $user = $this->createNewUser(); + + $supportedFactors = $user->getSupportedFactors(); + + $request = $httpClient->getRequests(); + $this->assertEquals('GET', $request[0]->getMethod()); + + $this->assertEquals( + "/api/v1/users/{$user->getId()}/factors/catalog", + $request[0]->getUri()->getPath() + ); + + $this->assertCount(2, $supportedFactors); + + $this->assertInstanceOf( + \Okta\UserFactors\Collection::class, + $supportedFactors + ); + + $this->assertInstanceOf( + \Okta\UserFactors\SecurityQuestionFactor::class, + $supportedFactors->first() + ); + + $this->assertInstanceOf( + \Okta\UserFactors\TotpFactor::class, + $supportedFactors[1] + ); + + } + + + /** @test */ + public function getting_factors_makes_request_to_correct_endpoint() + { + $httpClient = $this->createNewHttpClient([ + 'getBody' => '[{"id":"ufs2bysphxKODSZKWVCT","factorType":"question"}]' + ]); + $user = $this->createNewUser(); + + $factors = $user->getFactors(); + + $request = $httpClient->getRequests(); + $this->assertEquals('GET', $request[0]->getMethod()); + + $this->assertEquals( + "/api/v1/users/{$user->getId()}/factors", + $request[0]->getUri()->getPath() + ); + + $this->assertInstanceOf( + \Okta\UserFactors\Collection::class, + $factors + ); + } + + + /** * @return User From 122c02cb4f8778674446d6ed1b4ef748a9d87156 Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Thu, 5 Oct 2017 13:43:01 -0400 Subject: [PATCH 06/22] WIP-Tests --- openapi/generator/index.js | 98 ++++++++++++++++++- openapi/generator/templates/model.php.hbs | 28 ++++-- src/Generated/GroupRules/GroupRule.php | 7 +- src/Generated/GroupRules/GroupRuleAction.php | 3 +- .../GroupRules/GroupRuleConditions.php | 3 +- .../GroupRules/GroupRuleExpression.php | 3 +- .../GroupRules/GroupRuleGroupAssignment.php | 3 +- .../GroupRules/GroupRuleGroupCondition.php | 3 +- .../GroupRules/GroupRulePeopleCondition.php | 3 +- .../GroupRules/GroupRuleUserCondition.php | 3 +- src/Generated/Groups/Group.php | 7 +- src/Generated/Groups/GroupProfile.php | 3 +- src/Generated/UserFactors/CallFactor.php | 9 +- .../UserFactors/CallFactorProfile.php | 3 +- src/Generated/UserFactors/EmailFactor.php | 9 +- .../UserFactors/EmailFactorProfile.php | 3 +- src/Generated/UserFactors/Factor.php | 19 ++-- src/Generated/UserFactors/FactorProfile.php | 3 +- src/Generated/UserFactors/HardwareFactor.php | 9 +- .../UserFactors/HardwareFactorProfile.php | 3 +- src/Generated/UserFactors/PushFactor.php | 9 +- .../UserFactors/PushFactorProfile.php | 3 +- .../UserFactors/SecurityQuestion.php | 3 +- .../UserFactors/SecurityQuestionFactor.php | 9 +- .../SecurityQuestionFactorProfile.php | 3 +- src/Generated/UserFactors/SmsFactor.php | 9 +- .../UserFactors/SmsFactorProfile.php | 3 +- src/Generated/UserFactors/TokenFactor.php | 9 +- .../UserFactors/TokenFactorProfile.php | 3 +- src/Generated/UserFactors/TotpFactor.php | 9 +- .../UserFactors/TotpFactorProfile.php | 3 +- .../UserFactors/VerifyFactorRequest.php | 3 +- .../UserFactors/VerifyFactorResponse.php | 3 +- src/Generated/UserFactors/WebFactor.php | 9 +- .../UserFactors/WebFactorProfile.php | 3 +- src/Generated/Users/AppLink.php | 3 +- .../Users/AuthenticationProvider.php | 3 +- src/Generated/Users/ChangePasswordRequest.php | 3 +- .../Users/ForgotPasswordResponse.php | 3 +- src/Generated/Users/PasswordCredential.php | 3 +- .../Users/RecoveryQuestionCredential.php | 3 +- src/Generated/Users/ResetPasswordToken.php | 3 +- src/Generated/Users/Role.php | 3 +- src/Generated/Users/TempPassword.php | 3 +- src/Generated/Users/User.php | 12 +-- src/Generated/Users/UserActivationToken.php | 3 +- src/Generated/Users/UserCredentials.php | 3 +- src/Generated/Users/UserProfile.php | 3 +- src/Resource/AbstractResource.php | 1 - src/UserFactors/Factor.php | 1 - src/UserFactors/FactorType.php | 2 +- src/Users/User.php | 16 ++- tests/BaseTestCase.php | 48 +++++++++ tests/Unit/Users/UserTest.php | 2 +- 54 files changed, 269 insertions(+), 152 deletions(-) diff --git a/openapi/generator/index.js b/openapi/generator/index.js index 615317606e..7c5db55c03 100644 --- a/openapi/generator/index.js +++ b/openapi/generator/index.js @@ -8,7 +8,21 @@ function getType(obj, model) { case 'dateTime': return String.raw`\Carbon\Carbon|null`; case 'object': - return `\\${model}\\${obj.model}`; + switch (obj.model) { + case 'CallFactorProfile': + case 'EmailFactorProfile': + case 'HardwareFactorProfile': + case 'PushFactorProfile': + case 'SecurityQuestionFactorProfile': + case 'SmsFactorProfile': + case 'TokenFactorProfile': + case 'TotpFactorProfile': + case 'WebFactorProfile': + case 'FactorProfile': + return '\\Okta\\Contracts\\FactorProfile'; + default: + return `\\${model}\\${obj.model}`; + } case 'hash': return String.raw`\stdClass`; case 'boolean': @@ -27,7 +41,21 @@ function getSafeType(obj, model) { case 'dateTime': return ``; case 'object': - return `: \\${model}\\${obj.model}`; + switch (obj.model) { + case 'CallFactorProfile': + case 'EmailFactorProfile': + case 'HardwareFactorProfile': + case 'PushFactorProfile': + case 'SecurityQuestionFactorProfile': + case 'SmsFactorProfile': + case 'TokenFactorProfile': + case 'TotpFactorProfile': + case 'WebFactorProfile': + case 'FactorProfile': + return ': \\Okta\\Contracts\\FactorProfile'; + default: + return `: \\${model}\\${obj.model}`; + } case 'hash': return String.raw`: \stdClass`; case 'boolean': @@ -44,6 +72,66 @@ function getSafeType(obj, model) { } } +function getTypeHint(model) { + switch(model) { + case 'CallFactorProfile': + case 'EmailFactorProfile': + case 'HardwareFactorProfile': + case 'PushFactorProfile': + case 'SecurityQuestionFactorProfile': + case 'SmsFactorProfile': + case 'TokenFactorProfile': + case 'TotpFactorProfile': + case 'WebFactorProfile': + case 'FactorProfile': + return '\\Okta\\Contracts\\FactorProfile'; + default: + return model; + } +} + +function getExtends(modelName) { + switch (modelName) { + case 'CallFactor': + case 'EmailFactor': + case 'HardwareFactor': + case 'PushFactor': + case 'SecurityQuestionFactor': + case 'SmsFactor': + case 'TokenFactor': + case 'TotpFactor': + case 'WebFactor': + return '\\Okta\\UserFactors\\Factor'; + case 'CallFactorProfile': + case 'EmailFactorProfile': + case 'HardwareFactorProfile': + case 'PushFactorProfile': + case 'SecurityQuestionFactorProfile': + case 'SmsFactorProfile': + case 'TokenFactorProfile': + case 'TotpFactorProfile': + case 'WebFactorProfile': + return '\\Okta\\UserFactors\\FactorProfile'; + default: + return '\\Okta\\Resource\\AbstractResource'; + } +} + +function getInterfaces(modelName) { + switch (modelName) { + case 'CallFactorProfile': + case 'EmailFactorProfile': + case 'HardwareFactorProfile': + case 'PushFactorProfile': + case 'SecurityQuestionFactorProfile': + case 'SmsFactorProfile': + case 'TokenFactorProfile': + case 'TotpFactorProfile': + case 'WebFactorProfile': + return 'implements \\Okta\\Contracts\\FactorProfile'; + } +} + function getAccessMethodType(obj) { switch (obj.commonType) { case 'dateTime': @@ -232,6 +320,9 @@ function getCollectionName(obj) { function getCrudOperationPath(method) { let parts = _.split(method.operation.path, '/'); + if(method.operation.operationId === 'getFactor') { + return '/' + parts[3] + '/{$userId}/' + parts[5] + '/{$factorId}'; + } return '/' + parts[3]; } @@ -328,9 +419,12 @@ php.process = ({ spec, operations, models, handlebars }) => { handlebars.registerHelper({ getType, getSafeType, + getTypeHint, getAccessMethodType, getMethodPath, getMethodParams, + getExtends, + getInterfaces, getCollectionMethodParams, getMethodRequestParams, getMethodArrayName, diff --git a/openapi/generator/templates/model.php.hbs b/openapi/generator/templates/model.php.hbs index 85a167027f..8e9d33c326 100644 --- a/openapi/generator/templates/model.php.hbs +++ b/openapi/generator/templates/model.php.hbs @@ -20,9 +20,8 @@ namespace Okta\Generated\\{{namespace}}; {{#each namespacedModels as |namespacedModel|}} use Okta\\{{namespacedModel.namespace}}\\{{namespacedModel.modelName}}; {{/each}} -use Okta\Resource\AbstractResource; -class {{modelName}} extends AbstractResource +class {{modelName}} extends {{getExtends modelName}} { {{#each properties}} const {{upperSnakeCase propertyName}} = '{{propertyName}}'; @@ -30,6 +29,19 @@ class {{modelName}} extends AbstractResource {{#each crudOperations}} {{#if (eq alias "read")}} + {{#if (eq this.operation.operationId "getFactor")}} + public function get($userId, $factorId, $query) + { + $factor = \Okta\Client::getInstance() + ->getDataStore() + ->getResource( + $query, + \\{{this.defaultReturnType}}::class, + "{{getCrudOperationPath this}}" + ); + return $factor->convertFromGenericFactor(); + } + {{else}} public function get($query) { return \Okta\Client::getInstance() @@ -37,10 +49,10 @@ class {{modelName}} extends AbstractResource ->getResource( $query, \\{{this.defaultReturnType}}::class, - '{{getCrudOperationPath this}}' + "{{getCrudOperationPath this}}" ); } - + {{/if}} {{/if}} {{#if (eq alias "create")}} public function create() @@ -48,7 +60,7 @@ class {{modelName}} extends AbstractResource return \Okta\Client::getInstance() ->getDataStore() ->createResource( - '{{getCrudOperationPath this}}', + "{{getCrudOperationPath this}}", $this, \\{{this.defaultReturnType}}::class ); @@ -61,7 +73,7 @@ class {{modelName}} extends AbstractResource return \Okta\Client::getInstance() ->getDataStore() ->saveResource( - '{{getCrudOperationPath this}}', + "{{getCrudOperationPath this}}", $this, \\{{this.defaultReturnType}}::class ); @@ -74,7 +86,7 @@ class {{modelName}} extends AbstractResource return \Okta\Client::getInstance() ->getDataStore() ->deleteResource( - '{{getCrudOperationPath this}}', + "{{getCrudOperationPath this}}", $this ); } @@ -104,7 +116,7 @@ class {{modelName}} extends AbstractResource * @param {{model}} ${{propertyName}} The {{model}} instance. * @return self */ - public function set{{pascalCase propertyName}}({{model}} ${{propertyName}}) + public function set{{pascalCase propertyName}}({{getTypeHint model}} ${{propertyName}}) { $this->setResourceProperty( self::{{upperSnakeCase propertyName}}, diff --git a/src/Generated/GroupRules/GroupRule.php b/src/Generated/GroupRules/GroupRule.php index 4e60f019e8..4df5900c21 100644 --- a/src/Generated/GroupRules/GroupRule.php +++ b/src/Generated/GroupRules/GroupRule.php @@ -17,9 +17,8 @@ namespace Okta\Generated\GroupRules; -use Okta\Resource\AbstractResource; -class GroupRule extends AbstractResource +class GroupRule extends \Okta\Resource\AbstractResource { const ID = 'id'; const NAME = 'name'; @@ -35,7 +34,7 @@ public function save() return \Okta\Client::getInstance() ->getDataStore() ->saveResource( - '/groups', + "/groups", $this, \Okta\GroupRules\GroupRule::class ); @@ -46,7 +45,7 @@ public function delete() return \Okta\Client::getInstance() ->getDataStore() ->deleteResource( - '/groups', + "/groups", $this ); } diff --git a/src/Generated/GroupRules/GroupRuleAction.php b/src/Generated/GroupRules/GroupRuleAction.php index 0f8a23ddeb..e8ba3fd236 100644 --- a/src/Generated/GroupRules/GroupRuleAction.php +++ b/src/Generated/GroupRules/GroupRuleAction.php @@ -17,9 +17,8 @@ namespace Okta\Generated\GroupRules; -use Okta\Resource\AbstractResource; -class GroupRuleAction extends AbstractResource +class GroupRuleAction extends \Okta\Resource\AbstractResource { const ASSIGN_USER_TO_GROUPS = 'assignUserToGroups'; diff --git a/src/Generated/GroupRules/GroupRuleConditions.php b/src/Generated/GroupRules/GroupRuleConditions.php index 9c4d4b19d3..d273005dde 100644 --- a/src/Generated/GroupRules/GroupRuleConditions.php +++ b/src/Generated/GroupRules/GroupRuleConditions.php @@ -17,9 +17,8 @@ namespace Okta\Generated\GroupRules; -use Okta\Resource\AbstractResource; -class GroupRuleConditions extends AbstractResource +class GroupRuleConditions extends \Okta\Resource\AbstractResource { const PEOPLE = 'people'; const EXPRESSION = 'expression'; diff --git a/src/Generated/GroupRules/GroupRuleExpression.php b/src/Generated/GroupRules/GroupRuleExpression.php index 07a1084c8e..6b9d6a4cc8 100644 --- a/src/Generated/GroupRules/GroupRuleExpression.php +++ b/src/Generated/GroupRules/GroupRuleExpression.php @@ -17,9 +17,8 @@ namespace Okta\Generated\GroupRules; -use Okta\Resource\AbstractResource; -class GroupRuleExpression extends AbstractResource +class GroupRuleExpression extends \Okta\Resource\AbstractResource { const TYPE = 'type'; const VALUE = 'value'; diff --git a/src/Generated/GroupRules/GroupRuleGroupAssignment.php b/src/Generated/GroupRules/GroupRuleGroupAssignment.php index ad2c09d04e..f07721e3ea 100644 --- a/src/Generated/GroupRules/GroupRuleGroupAssignment.php +++ b/src/Generated/GroupRules/GroupRuleGroupAssignment.php @@ -17,9 +17,8 @@ namespace Okta\Generated\GroupRules; -use Okta\Resource\AbstractResource; -class GroupRuleGroupAssignment extends AbstractResource +class GroupRuleGroupAssignment extends \Okta\Resource\AbstractResource { const GROUP_IDS = 'groupIds'; diff --git a/src/Generated/GroupRules/GroupRuleGroupCondition.php b/src/Generated/GroupRules/GroupRuleGroupCondition.php index e24f7965d2..66b9b6a126 100644 --- a/src/Generated/GroupRules/GroupRuleGroupCondition.php +++ b/src/Generated/GroupRules/GroupRuleGroupCondition.php @@ -17,9 +17,8 @@ namespace Okta\Generated\GroupRules; -use Okta\Resource\AbstractResource; -class GroupRuleGroupCondition extends AbstractResource +class GroupRuleGroupCondition extends \Okta\Resource\AbstractResource { const EXCLUDE = 'exclude'; const INCLUDE = 'include'; diff --git a/src/Generated/GroupRules/GroupRulePeopleCondition.php b/src/Generated/GroupRules/GroupRulePeopleCondition.php index ef33a38069..b083728fc2 100644 --- a/src/Generated/GroupRules/GroupRulePeopleCondition.php +++ b/src/Generated/GroupRules/GroupRulePeopleCondition.php @@ -17,9 +17,8 @@ namespace Okta\Generated\GroupRules; -use Okta\Resource\AbstractResource; -class GroupRulePeopleCondition extends AbstractResource +class GroupRulePeopleCondition extends \Okta\Resource\AbstractResource { const USERS = 'users'; const GROUPS = 'groups'; diff --git a/src/Generated/GroupRules/GroupRuleUserCondition.php b/src/Generated/GroupRules/GroupRuleUserCondition.php index 8fb02a7eaf..d1ec29760a 100644 --- a/src/Generated/GroupRules/GroupRuleUserCondition.php +++ b/src/Generated/GroupRules/GroupRuleUserCondition.php @@ -17,9 +17,8 @@ namespace Okta\Generated\GroupRules; -use Okta\Resource\AbstractResource; -class GroupRuleUserCondition extends AbstractResource +class GroupRuleUserCondition extends \Okta\Resource\AbstractResource { const EXCLUDE = 'exclude'; const INCLUDE = 'include'; diff --git a/src/Generated/Groups/Group.php b/src/Generated/Groups/Group.php index a73201887c..d07cfa0c92 100644 --- a/src/Generated/Groups/Group.php +++ b/src/Generated/Groups/Group.php @@ -18,9 +18,8 @@ namespace Okta\Generated\Groups; use Okta\Users\User; -use Okta\Resource\AbstractResource; -class Group extends AbstractResource +class Group extends \Okta\Resource\AbstractResource { const ID = 'id'; const TYPE = 'type'; @@ -37,7 +36,7 @@ public function save() return \Okta\Client::getInstance() ->getDataStore() ->saveResource( - '/groups', + "/groups", $this, \Okta\Groups\Group::class ); @@ -48,7 +47,7 @@ public function delete() return \Okta\Client::getInstance() ->getDataStore() ->deleteResource( - '/groups', + "/groups", $this ); } diff --git a/src/Generated/Groups/GroupProfile.php b/src/Generated/Groups/GroupProfile.php index 41f5169939..8d624301eb 100644 --- a/src/Generated/Groups/GroupProfile.php +++ b/src/Generated/Groups/GroupProfile.php @@ -17,9 +17,8 @@ namespace Okta\Generated\Groups; -use Okta\Resource\AbstractResource; -class GroupProfile extends AbstractResource +class GroupProfile extends \Okta\Resource\AbstractResource { const NAME = 'name'; const DESCRIPTION = 'description'; diff --git a/src/Generated/UserFactors/CallFactor.php b/src/Generated/UserFactors/CallFactor.php index f272960f80..63b864eaa1 100644 --- a/src/Generated/UserFactors/CallFactor.php +++ b/src/Generated/UserFactors/CallFactor.php @@ -17,18 +17,17 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class CallFactor extends AbstractResource +class CallFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; /** * Get the profile. * - * @return \Okta\UserFactors\CallFactorProfile + * @return \Okta\Contracts\FactorProfile */ - public function getProfile(array $options = []): \Okta\UserFactors\CallFactorProfile + public function getProfile(array $options = []): \Okta\Contracts\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -43,7 +42,7 @@ public function getProfile(array $options = []): \Okta\UserFactors\CallFactorPro * @param CallFactorProfile $profile The CallFactorProfile instance. * @return self */ - public function setProfile(CallFactorProfile $profile) + public function setProfile(\Okta\Contracts\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/CallFactorProfile.php b/src/Generated/UserFactors/CallFactorProfile.php index a1a17b84ca..26d4731201 100644 --- a/src/Generated/UserFactors/CallFactorProfile.php +++ b/src/Generated/UserFactors/CallFactorProfile.php @@ -17,9 +17,8 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class CallFactorProfile extends AbstractResource +class CallFactorProfile extends \Okta\UserFactors\FactorProfile { const PHONE_NUMBER = 'phoneNumber'; const PHONE_EXTENSION = 'phoneExtension'; diff --git a/src/Generated/UserFactors/EmailFactor.php b/src/Generated/UserFactors/EmailFactor.php index 97ffccb272..cdc7ff2fb6 100644 --- a/src/Generated/UserFactors/EmailFactor.php +++ b/src/Generated/UserFactors/EmailFactor.php @@ -17,18 +17,17 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class EmailFactor extends AbstractResource +class EmailFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; /** * Get the profile. * - * @return \Okta\UserFactors\EmailFactorProfile + * @return \Okta\Contracts\FactorProfile */ - public function getProfile(array $options = []): \Okta\UserFactors\EmailFactorProfile + public function getProfile(array $options = []): \Okta\Contracts\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -43,7 +42,7 @@ public function getProfile(array $options = []): \Okta\UserFactors\EmailFactorPr * @param EmailFactorProfile $profile The EmailFactorProfile instance. * @return self */ - public function setProfile(EmailFactorProfile $profile) + public function setProfile(\Okta\Contracts\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/EmailFactorProfile.php b/src/Generated/UserFactors/EmailFactorProfile.php index a954f55a9d..589c8670d8 100644 --- a/src/Generated/UserFactors/EmailFactorProfile.php +++ b/src/Generated/UserFactors/EmailFactorProfile.php @@ -17,9 +17,8 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class EmailFactorProfile extends AbstractResource +class EmailFactorProfile extends \Okta\UserFactors\FactorProfile { const EMAIL = 'email'; diff --git a/src/Generated/UserFactors/Factor.php b/src/Generated/UserFactors/Factor.php index 35f7b21652..f856cad017 100644 --- a/src/Generated/UserFactors/Factor.php +++ b/src/Generated/UserFactors/Factor.php @@ -17,9 +17,8 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class Factor extends AbstractResource +class Factor extends \Okta\Resource\AbstractResource { const ID = 'id'; const DEVICE = 'device'; @@ -33,23 +32,23 @@ class Factor extends AbstractResource const MFA_STATE_TOKEN_ID = 'mfaStateTokenId'; const RECHALLENGE_EXISTING_FACTOR = 'rechallengeExistingFactor'; - public function get($query) + public function get($userId, $factorId, $query) { - return \Okta\Client::getInstance() + $factor = \Okta\Client::getInstance() ->getDataStore() ->getResource( $query, \Okta\UserFactors\Factor::class, - '/users' + "/users/{$userId}/factors/{$factorId}" ); + return $factor->convertFromGenericFactor(); } - public function delete() { return \Okta\Client::getInstance() ->getDataStore() ->deleteResource( - '/users', + "/users", $this ); } @@ -158,9 +157,9 @@ public function setVerify(VerifyFactorRequest $verify) /** * Get the profile. * - * @return \Okta\UserFactors\FactorProfile + * @return \Okta\Contracts\FactorProfile */ - public function getProfile(array $options = []): \Okta\UserFactors\FactorProfile + public function getProfile(array $options = []): \Okta\Contracts\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -175,7 +174,7 @@ public function getProfile(array $options = []): \Okta\UserFactors\FactorProfile * @param FactorProfile $profile The FactorProfile instance. * @return self */ - public function setProfile(FactorProfile $profile) + public function setProfile(\Okta\Contracts\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/FactorProfile.php b/src/Generated/UserFactors/FactorProfile.php index 9212ed40dc..921947e5a9 100644 --- a/src/Generated/UserFactors/FactorProfile.php +++ b/src/Generated/UserFactors/FactorProfile.php @@ -17,9 +17,8 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class FactorProfile extends AbstractResource +class FactorProfile extends \Okta\Resource\AbstractResource { } diff --git a/src/Generated/UserFactors/HardwareFactor.php b/src/Generated/UserFactors/HardwareFactor.php index b5aed81b8b..dddc928ba1 100644 --- a/src/Generated/UserFactors/HardwareFactor.php +++ b/src/Generated/UserFactors/HardwareFactor.php @@ -17,18 +17,17 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class HardwareFactor extends AbstractResource +class HardwareFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; /** * Get the profile. * - * @return \Okta\UserFactors\HardwareFactorProfile + * @return \Okta\Contracts\FactorProfile */ - public function getProfile(array $options = []): \Okta\UserFactors\HardwareFactorProfile + public function getProfile(array $options = []): \Okta\Contracts\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -43,7 +42,7 @@ public function getProfile(array $options = []): \Okta\UserFactors\HardwareFacto * @param HardwareFactorProfile $profile The HardwareFactorProfile instance. * @return self */ - public function setProfile(HardwareFactorProfile $profile) + public function setProfile(\Okta\Contracts\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/HardwareFactorProfile.php b/src/Generated/UserFactors/HardwareFactorProfile.php index de2af8b713..df0da5c460 100644 --- a/src/Generated/UserFactors/HardwareFactorProfile.php +++ b/src/Generated/UserFactors/HardwareFactorProfile.php @@ -17,9 +17,8 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class HardwareFactorProfile extends AbstractResource +class HardwareFactorProfile extends \Okta\UserFactors\FactorProfile { const CREDENTIAL_ID = 'credentialId'; diff --git a/src/Generated/UserFactors/PushFactor.php b/src/Generated/UserFactors/PushFactor.php index 70b2a556fe..f1ebb16497 100644 --- a/src/Generated/UserFactors/PushFactor.php +++ b/src/Generated/UserFactors/PushFactor.php @@ -17,18 +17,17 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class PushFactor extends AbstractResource +class PushFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; /** * Get the profile. * - * @return \Okta\UserFactors\PushFactorProfile + * @return \Okta\Contracts\FactorProfile */ - public function getProfile(array $options = []): \Okta\UserFactors\PushFactorProfile + public function getProfile(array $options = []): \Okta\Contracts\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -43,7 +42,7 @@ public function getProfile(array $options = []): \Okta\UserFactors\PushFactorPro * @param PushFactorProfile $profile The PushFactorProfile instance. * @return self */ - public function setProfile(PushFactorProfile $profile) + public function setProfile(\Okta\Contracts\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/PushFactorProfile.php b/src/Generated/UserFactors/PushFactorProfile.php index 25182dae42..757695018a 100644 --- a/src/Generated/UserFactors/PushFactorProfile.php +++ b/src/Generated/UserFactors/PushFactorProfile.php @@ -17,9 +17,8 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class PushFactorProfile extends AbstractResource +class PushFactorProfile extends \Okta\UserFactors\FactorProfile { const NAME = 'name'; const VERSION = 'version'; diff --git a/src/Generated/UserFactors/SecurityQuestion.php b/src/Generated/UserFactors/SecurityQuestion.php index 387e4add3d..a7dc5cdde3 100644 --- a/src/Generated/UserFactors/SecurityQuestion.php +++ b/src/Generated/UserFactors/SecurityQuestion.php @@ -17,9 +17,8 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class SecurityQuestion extends AbstractResource +class SecurityQuestion extends \Okta\Resource\AbstractResource { const ANSWER = 'answer'; const QUESTION = 'question'; diff --git a/src/Generated/UserFactors/SecurityQuestionFactor.php b/src/Generated/UserFactors/SecurityQuestionFactor.php index 57d9ca70b7..f6adf63a96 100644 --- a/src/Generated/UserFactors/SecurityQuestionFactor.php +++ b/src/Generated/UserFactors/SecurityQuestionFactor.php @@ -17,18 +17,17 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class SecurityQuestionFactor extends AbstractResource +class SecurityQuestionFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; /** * Get the profile. * - * @return \Okta\UserFactors\SecurityQuestionFactorProfile + * @return \Okta\Contracts\FactorProfile */ - public function getProfile(array $options = []): \Okta\UserFactors\SecurityQuestionFactorProfile + public function getProfile(array $options = []): \Okta\Contracts\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -43,7 +42,7 @@ public function getProfile(array $options = []): \Okta\UserFactors\SecurityQuest * @param SecurityQuestionFactorProfile $profile The SecurityQuestionFactorProfile instance. * @return self */ - public function setProfile(SecurityQuestionFactorProfile $profile) + public function setProfile(\Okta\Contracts\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/SecurityQuestionFactorProfile.php b/src/Generated/UserFactors/SecurityQuestionFactorProfile.php index 289dac8fbb..67f7e64a1f 100644 --- a/src/Generated/UserFactors/SecurityQuestionFactorProfile.php +++ b/src/Generated/UserFactors/SecurityQuestionFactorProfile.php @@ -17,9 +17,8 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class SecurityQuestionFactorProfile extends AbstractResource +class SecurityQuestionFactorProfile extends \Okta\UserFactors\FactorProfile { const ANSWER = 'answer'; const QUESTION = 'question'; diff --git a/src/Generated/UserFactors/SmsFactor.php b/src/Generated/UserFactors/SmsFactor.php index 1adac0627f..8afe9f480b 100644 --- a/src/Generated/UserFactors/SmsFactor.php +++ b/src/Generated/UserFactors/SmsFactor.php @@ -17,18 +17,17 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class SmsFactor extends AbstractResource +class SmsFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; /** * Get the profile. * - * @return \Okta\UserFactors\SmsFactorProfile + * @return \Okta\Contracts\FactorProfile */ - public function getProfile(array $options = []): \Okta\UserFactors\SmsFactorProfile + public function getProfile(array $options = []): \Okta\Contracts\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -43,7 +42,7 @@ public function getProfile(array $options = []): \Okta\UserFactors\SmsFactorProf * @param SmsFactorProfile $profile The SmsFactorProfile instance. * @return self */ - public function setProfile(SmsFactorProfile $profile) + public function setProfile(\Okta\Contracts\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/SmsFactorProfile.php b/src/Generated/UserFactors/SmsFactorProfile.php index ce6ed39c40..8a8125c388 100644 --- a/src/Generated/UserFactors/SmsFactorProfile.php +++ b/src/Generated/UserFactors/SmsFactorProfile.php @@ -17,9 +17,8 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class SmsFactorProfile extends AbstractResource +class SmsFactorProfile extends \Okta\UserFactors\FactorProfile { const PHONE_NUMBER = 'phoneNumber'; diff --git a/src/Generated/UserFactors/TokenFactor.php b/src/Generated/UserFactors/TokenFactor.php index 3af3ece702..08305ac933 100644 --- a/src/Generated/UserFactors/TokenFactor.php +++ b/src/Generated/UserFactors/TokenFactor.php @@ -17,18 +17,17 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class TokenFactor extends AbstractResource +class TokenFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; /** * Get the profile. * - * @return \Okta\UserFactors\TokenFactorProfile + * @return \Okta\Contracts\FactorProfile */ - public function getProfile(array $options = []): \Okta\UserFactors\TokenFactorProfile + public function getProfile(array $options = []): \Okta\Contracts\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -43,7 +42,7 @@ public function getProfile(array $options = []): \Okta\UserFactors\TokenFactorPr * @param TokenFactorProfile $profile The TokenFactorProfile instance. * @return self */ - public function setProfile(TokenFactorProfile $profile) + public function setProfile(\Okta\Contracts\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/TokenFactorProfile.php b/src/Generated/UserFactors/TokenFactorProfile.php index fa92418f2d..3d9e8df78e 100644 --- a/src/Generated/UserFactors/TokenFactorProfile.php +++ b/src/Generated/UserFactors/TokenFactorProfile.php @@ -17,9 +17,8 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class TokenFactorProfile extends AbstractResource +class TokenFactorProfile extends \Okta\UserFactors\FactorProfile { const CREDENTIAL_ID = 'credentialId'; diff --git a/src/Generated/UserFactors/TotpFactor.php b/src/Generated/UserFactors/TotpFactor.php index a919e172b0..d893e19c0a 100644 --- a/src/Generated/UserFactors/TotpFactor.php +++ b/src/Generated/UserFactors/TotpFactor.php @@ -17,18 +17,17 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class TotpFactor extends AbstractResource +class TotpFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; /** * Get the profile. * - * @return \Okta\UserFactors\TotpFactorProfile + * @return \Okta\Contracts\FactorProfile */ - public function getProfile(array $options = []): \Okta\UserFactors\TotpFactorProfile + public function getProfile(array $options = []): \Okta\Contracts\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -43,7 +42,7 @@ public function getProfile(array $options = []): \Okta\UserFactors\TotpFactorPro * @param TotpFactorProfile $profile The TotpFactorProfile instance. * @return self */ - public function setProfile(TotpFactorProfile $profile) + public function setProfile(\Okta\Contracts\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/TotpFactorProfile.php b/src/Generated/UserFactors/TotpFactorProfile.php index 2bec4bcbc3..cb59223fb9 100644 --- a/src/Generated/UserFactors/TotpFactorProfile.php +++ b/src/Generated/UserFactors/TotpFactorProfile.php @@ -17,9 +17,8 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class TotpFactorProfile extends AbstractResource +class TotpFactorProfile extends \Okta\UserFactors\FactorProfile { const CREDENTIAL_ID = 'credentialId'; diff --git a/src/Generated/UserFactors/VerifyFactorRequest.php b/src/Generated/UserFactors/VerifyFactorRequest.php index 60fbbd2f1d..170ee4e8ab 100644 --- a/src/Generated/UserFactors/VerifyFactorRequest.php +++ b/src/Generated/UserFactors/VerifyFactorRequest.php @@ -17,9 +17,8 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class VerifyFactorRequest extends AbstractResource +class VerifyFactorRequest extends \Okta\Resource\AbstractResource { const PASS_CODE = 'passCode'; const NEXT_PASS_CODE = 'nextPassCode'; diff --git a/src/Generated/UserFactors/VerifyFactorResponse.php b/src/Generated/UserFactors/VerifyFactorResponse.php index 729aac16bf..fa2e77af55 100644 --- a/src/Generated/UserFactors/VerifyFactorResponse.php +++ b/src/Generated/UserFactors/VerifyFactorResponse.php @@ -17,9 +17,8 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class VerifyFactorResponse extends AbstractResource +class VerifyFactorResponse extends \Okta\Resource\AbstractResource { const LINKS = '_links'; const EMBEDDED = '_embedded'; diff --git a/src/Generated/UserFactors/WebFactor.php b/src/Generated/UserFactors/WebFactor.php index ab808fdd17..bc95a831b7 100644 --- a/src/Generated/UserFactors/WebFactor.php +++ b/src/Generated/UserFactors/WebFactor.php @@ -17,18 +17,17 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class WebFactor extends AbstractResource +class WebFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; /** * Get the profile. * - * @return \Okta\UserFactors\WebFactorProfile + * @return \Okta\Contracts\FactorProfile */ - public function getProfile(array $options = []): \Okta\UserFactors\WebFactorProfile + public function getProfile(array $options = []): \Okta\Contracts\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -43,7 +42,7 @@ public function getProfile(array $options = []): \Okta\UserFactors\WebFactorProf * @param WebFactorProfile $profile The WebFactorProfile instance. * @return self */ - public function setProfile(WebFactorProfile $profile) + public function setProfile(\Okta\Contracts\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/WebFactorProfile.php b/src/Generated/UserFactors/WebFactorProfile.php index cffd0c5021..d8392c30cb 100644 --- a/src/Generated/UserFactors/WebFactorProfile.php +++ b/src/Generated/UserFactors/WebFactorProfile.php @@ -17,9 +17,8 @@ namespace Okta\Generated\UserFactors; -use Okta\Resource\AbstractResource; -class WebFactorProfile extends AbstractResource +class WebFactorProfile extends \Okta\UserFactors\FactorProfile { const CREDENTIAL_ID = 'credentialId'; diff --git a/src/Generated/Users/AppLink.php b/src/Generated/Users/AppLink.php index f79f19d4e1..d7f7199724 100644 --- a/src/Generated/Users/AppLink.php +++ b/src/Generated/Users/AppLink.php @@ -17,9 +17,8 @@ namespace Okta\Generated\Users; -use Okta\Resource\AbstractResource; -class AppLink extends AbstractResource +class AppLink extends \Okta\Resource\AbstractResource { const ID = 'id'; const LABEL = 'label'; diff --git a/src/Generated/Users/AuthenticationProvider.php b/src/Generated/Users/AuthenticationProvider.php index 376005250f..efc05ebdc4 100644 --- a/src/Generated/Users/AuthenticationProvider.php +++ b/src/Generated/Users/AuthenticationProvider.php @@ -17,9 +17,8 @@ namespace Okta\Generated\Users; -use Okta\Resource\AbstractResource; -class AuthenticationProvider extends AbstractResource +class AuthenticationProvider extends \Okta\Resource\AbstractResource { const NAME = 'name'; const TYPE = 'type'; diff --git a/src/Generated/Users/ChangePasswordRequest.php b/src/Generated/Users/ChangePasswordRequest.php index 59c8c44d4f..56d14b158f 100644 --- a/src/Generated/Users/ChangePasswordRequest.php +++ b/src/Generated/Users/ChangePasswordRequest.php @@ -17,9 +17,8 @@ namespace Okta\Generated\Users; -use Okta\Resource\AbstractResource; -class ChangePasswordRequest extends AbstractResource +class ChangePasswordRequest extends \Okta\Resource\AbstractResource { const NEW_PASSWORD = 'newPassword'; const OLD_PASSWORD = 'oldPassword'; diff --git a/src/Generated/Users/ForgotPasswordResponse.php b/src/Generated/Users/ForgotPasswordResponse.php index 41d0125c55..ba6113e34f 100644 --- a/src/Generated/Users/ForgotPasswordResponse.php +++ b/src/Generated/Users/ForgotPasswordResponse.php @@ -17,9 +17,8 @@ namespace Okta\Generated\Users; -use Okta\Resource\AbstractResource; -class ForgotPasswordResponse extends AbstractResource +class ForgotPasswordResponse extends \Okta\Resource\AbstractResource { const RESET_PASSWORD_URL = 'resetPasswordUrl'; diff --git a/src/Generated/Users/PasswordCredential.php b/src/Generated/Users/PasswordCredential.php index fd5270996c..e35f394190 100644 --- a/src/Generated/Users/PasswordCredential.php +++ b/src/Generated/Users/PasswordCredential.php @@ -17,9 +17,8 @@ namespace Okta\Generated\Users; -use Okta\Resource\AbstractResource; -class PasswordCredential extends AbstractResource +class PasswordCredential extends \Okta\Resource\AbstractResource { const VALUE = 'value'; diff --git a/src/Generated/Users/RecoveryQuestionCredential.php b/src/Generated/Users/RecoveryQuestionCredential.php index dec1ff2bfd..ab39be1d54 100644 --- a/src/Generated/Users/RecoveryQuestionCredential.php +++ b/src/Generated/Users/RecoveryQuestionCredential.php @@ -17,9 +17,8 @@ namespace Okta\Generated\Users; -use Okta\Resource\AbstractResource; -class RecoveryQuestionCredential extends AbstractResource +class RecoveryQuestionCredential extends \Okta\Resource\AbstractResource { const ANSWER = 'answer'; const QUESTION = 'question'; diff --git a/src/Generated/Users/ResetPasswordToken.php b/src/Generated/Users/ResetPasswordToken.php index 34c1776b85..de45d83af5 100644 --- a/src/Generated/Users/ResetPasswordToken.php +++ b/src/Generated/Users/ResetPasswordToken.php @@ -17,9 +17,8 @@ namespace Okta\Generated\Users; -use Okta\Resource\AbstractResource; -class ResetPasswordToken extends AbstractResource +class ResetPasswordToken extends \Okta\Resource\AbstractResource { const RESET_PASSWORD_URL = 'resetPasswordUrl'; diff --git a/src/Generated/Users/Role.php b/src/Generated/Users/Role.php index 18f2968792..f9ca26a142 100644 --- a/src/Generated/Users/Role.php +++ b/src/Generated/Users/Role.php @@ -17,9 +17,8 @@ namespace Okta\Generated\Users; -use Okta\Resource\AbstractResource; -class Role extends AbstractResource +class Role extends \Okta\Resource\AbstractResource { const ID = 'id'; const TYPE = 'type'; diff --git a/src/Generated/Users/TempPassword.php b/src/Generated/Users/TempPassword.php index 1252a78855..7718669a93 100644 --- a/src/Generated/Users/TempPassword.php +++ b/src/Generated/Users/TempPassword.php @@ -17,9 +17,8 @@ namespace Okta\Generated\Users; -use Okta\Resource\AbstractResource; -class TempPassword extends AbstractResource +class TempPassword extends \Okta\Resource\AbstractResource { const TEMP_PASSWORD = 'tempPassword'; diff --git a/src/Generated/Users/User.php b/src/Generated/Users/User.php index 06bc3f14ca..5e20081386 100644 --- a/src/Generated/Users/User.php +++ b/src/Generated/Users/User.php @@ -19,9 +19,8 @@ use Okta\Groups\Group; use Okta\UserFactors\Factor; -use Okta\Resource\AbstractResource; -class User extends AbstractResource +class User extends \Okta\Resource\AbstractResource { const ID = 'id'; const LINKS = '_links'; @@ -42,7 +41,7 @@ public function create() return \Okta\Client::getInstance() ->getDataStore() ->createResource( - '/users', + "/users", $this, \Okta\Users\User::class ); @@ -55,16 +54,15 @@ public function get($query) ->getResource( $query, \Okta\Users\User::class, - '/users' + "/users" ); } - public function save() { return \Okta\Client::getInstance() ->getDataStore() ->saveResource( - '/users', + "/users", $this, \Okta\Users\User::class ); @@ -75,7 +73,7 @@ public function delete() return \Okta\Client::getInstance() ->getDataStore() ->deleteResource( - '/users', + "/users", $this ); } diff --git a/src/Generated/Users/UserActivationToken.php b/src/Generated/Users/UserActivationToken.php index 027264811c..08d8a7bcd5 100644 --- a/src/Generated/Users/UserActivationToken.php +++ b/src/Generated/Users/UserActivationToken.php @@ -17,9 +17,8 @@ namespace Okta\Generated\Users; -use Okta\Resource\AbstractResource; -class UserActivationToken extends AbstractResource +class UserActivationToken extends \Okta\Resource\AbstractResource { const ACTIVATION_URL = 'activationUrl'; const ACTIVATION_TOKEN = 'activationToken'; diff --git a/src/Generated/Users/UserCredentials.php b/src/Generated/Users/UserCredentials.php index 9f38aa6c93..dcb893f5ab 100644 --- a/src/Generated/Users/UserCredentials.php +++ b/src/Generated/Users/UserCredentials.php @@ -17,9 +17,8 @@ namespace Okta\Generated\Users; -use Okta\Resource\AbstractResource; -class UserCredentials extends AbstractResource +class UserCredentials extends \Okta\Resource\AbstractResource { const PASSWORD = 'password'; const PROVIDER = 'provider'; diff --git a/src/Generated/Users/UserProfile.php b/src/Generated/Users/UserProfile.php index edc98821b0..e3ec041c91 100644 --- a/src/Generated/Users/UserProfile.php +++ b/src/Generated/Users/UserProfile.php @@ -17,9 +17,8 @@ namespace Okta\Generated\Users; -use Okta\Resource\AbstractResource; -class UserProfile extends AbstractResource +class UserProfile extends \Okta\Resource\AbstractResource { const EMAIL = 'email'; const LOGIN = 'login'; diff --git a/src/Resource/AbstractResource.php b/src/Resource/AbstractResource.php index 3c813fc910..7345329f8c 100644 --- a/src/Resource/AbstractResource.php +++ b/src/Resource/AbstractResource.php @@ -384,5 +384,4 @@ public function __toString() } return json_encode($properties, true); } - } diff --git a/src/UserFactors/Factor.php b/src/UserFactors/Factor.php index 6cf5817afd..99c216786f 100644 --- a/src/UserFactors/Factor.php +++ b/src/UserFactors/Factor.php @@ -34,6 +34,5 @@ public function convertFromGenericFactor() } return new $realFactor(null, $properties); - } } diff --git a/src/UserFactors/FactorType.php b/src/UserFactors/FactorType.php index a8e2578ace..c7406a4473 100644 --- a/src/UserFactors/FactorType.php +++ b/src/UserFactors/FactorType.php @@ -21,7 +21,7 @@ class FactorType extends \Okta\Generated\UserFactors\FactorType { public function mapToFactorType() { - switch($this->getValue()) { + switch ($this->getValue()) { case 'call': return \Okta\UserFactors\CallFactor::class; case 'push': diff --git a/src/Users/User.php b/src/Users/User.php index ecc86dd44e..703672c104 100644 --- a/src/Users/User.php +++ b/src/Users/User.php @@ -26,12 +26,24 @@ public function getSupportedFactors(array $options = []): \Okta\UserFactors\Coll { $supportedFactors = parent::getSupportedFactors($options); - return $supportedFactors->each(function(Factor $factor, $key) use ($supportedFactors) { + return $supportedFactors->each(function (Factor $factor, $key) use ($supportedFactors) { $supportedFactors[$key] = $factor->convertFromGenericFactor(); - }); + } + + public function getFactors(array $options = []): \Okta\UserFactors\Collection + { + $supportedFactors = parent::getFactors($options); + + return $supportedFactors->each(function (Factor $factor, $key) use ($supportedFactors) { + $supportedFactors[$key] = $factor->convertFromGenericFactor(); + }); } + public function getFactor($factorId) + { + return (new Factor())->get($this->getId(), $factorId, ""); + } } diff --git a/tests/BaseTestCase.php b/tests/BaseTestCase.php index 244b48f512..0b879dc083 100644 --- a/tests/BaseTestCase.php +++ b/tests/BaseTestCase.php @@ -19,5 +19,53 @@ class BaseTestCase extends TestCase { + protected $token = 'abc123'; + /** + * @param array $returns + * + * @return \Http\Mock\Client + */ + protected function createNewHttpClient($returns = []): \Http\Mock\Client + { + $defaults = [ + 'getStatusCode' => 200, + 'getBody' => '{}' + ]; + $mockReturns = array_replace_recursive($defaults, $returns); + + $response = $this->createMock('Psr\Http\Message\ResponseInterface'); + foreach($mockReturns as $method=>$return) { + $response->method($method)->willReturn($return); + } + $httpClient = new \Http\Mock\Client; + $httpClient->addResponse($response); + + (new \Okta\ClientBuilder()) + ->setOrganizationUrl('https://dev.okta.com') + ->setToken($this->token) + ->setHttpClient($httpClient) + ->build(); + return $httpClient; + } + + protected function createNewUser($properties = []): \Okta\Users\User + { + $defaults = json_decode( + file_get_contents(__DIR__ . '/models/user.json'), + true + ); + + $properties = array_replace_recursive($defaults, $properties); + + $class = new \stdClass(); + foreach($properties as $prop=>$value) + { + $class->{$prop} = $value; + } + return new \Okta\Users\User(null, $class); + + + + } } \ No newline at end of file diff --git a/tests/Unit/Users/UserTest.php b/tests/Unit/Users/UserTest.php index 009d762cec..bb79ba7138 100644 --- a/tests/Unit/Users/UserTest.php +++ b/tests/Unit/Users/UserTest.php @@ -415,7 +415,7 @@ public function get_groups_makes_request_to_correct_location() $user->getGroups(); $request = $httpClient->getRequests(); - dump($request[0]->getBody()->getContents()); + $this->assertEquals('GET', $request[0]->getMethod()); $this->assertEquals( "/api/v1/users/{$user->getId()}/groups", From 0e9ddb0d8f187bb4d6561952015407be099d9b2c Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Thu, 5 Oct 2017 13:43:08 -0400 Subject: [PATCH 07/22] WIP-Tests --- src/Contracts/FactorProfile.php | 24 ++++ tests/Integration/FactorsTest.php | 125 ++++++++++++++++++ tests/models/user.json | 74 +++++++++++ .../responses/factors/activateCallFactor.json | 39 ++++++ .../factors/activateEmailFactor.json | 37 ++++++ .../responses/factors/activatePushFactor.json | 38 ++++++ .../responses/factors/activateSmsFactor.json | 38 ++++++ .../responses/factors/activateTotpFactor.json | 38 ++++++ .../factors/callFactorExistingPhone.json | 11 ++ .../factors/callFactorRateLimit.json | 7 + .../factors/emailFactorInvalidAddress.json | 7 + tests/responses/factors/enrollCallFactor.json | 49 +++++++ .../responses/factors/enrollEmailFactor.json | 44 ++++++ .../enrollGoogleAuthenticatorFactor.json | 51 +++++++ .../factors/enrollRsaSecurIDFactor.json | 38 ++++++ .../factors/enrollSecurityQuestionFactor.json | 39 ++++++ tests/responses/factors/enrollSmsFactor.json | 48 +++++++ .../factors/enrollSymantecVipFactor.json | 38 ++++++ .../factors/enrollVerifyPushFactor.json | 66 +++++++++ .../factors/enrollVerifyTotpFactor.json | 51 +++++++ .../factors/enrollYubiKeyFactor.json | 38 ++++++ tests/responses/factors/getFactor.json | 38 ++++++ .../factors/listEnrolledFactors.json | 125 ++++++++++++++++++ .../factors/listFactorsToEnroll.json | 119 +++++++++++++++++ .../factors/listSecurityQuestions.json | 14 ++ tests/responses/factors/smsExistingPhone.json | 11 ++ .../responses/factors/smsFactorRateLimit.json | 7 + tests/responses/factors/verifyCallFactor.json | 3 + .../responses/factors/verifyEmailFactor.json | 3 + tests/responses/factors/verifyPushFactor.json | 22 +++ .../factors/verifyPushFactorApproved.json | 3 + .../factors/verifyPushFactorRejected.json | 22 +++ .../factors/verifyPushFactorTimeout.json | 22 +++ .../factors/verifyPushFactorWaiting.json | 22 +++ .../factors/verifySecurityQuestionFactor.json | 3 + tests/responses/factors/verifySmsFactor.json | 3 + .../responses/factors/verifyTokenFactor.json | 3 + tests/responses/factors/verifyTotpFactor.json | 3 + 38 files changed, 1323 insertions(+) create mode 100644 src/Contracts/FactorProfile.php create mode 100644 tests/Integration/FactorsTest.php create mode 100644 tests/models/user.json create mode 100644 tests/responses/factors/activateCallFactor.json create mode 100644 tests/responses/factors/activateEmailFactor.json create mode 100644 tests/responses/factors/activatePushFactor.json create mode 100644 tests/responses/factors/activateSmsFactor.json create mode 100644 tests/responses/factors/activateTotpFactor.json create mode 100644 tests/responses/factors/callFactorExistingPhone.json create mode 100644 tests/responses/factors/callFactorRateLimit.json create mode 100644 tests/responses/factors/emailFactorInvalidAddress.json create mode 100644 tests/responses/factors/enrollCallFactor.json create mode 100644 tests/responses/factors/enrollEmailFactor.json create mode 100644 tests/responses/factors/enrollGoogleAuthenticatorFactor.json create mode 100644 tests/responses/factors/enrollRsaSecurIDFactor.json create mode 100644 tests/responses/factors/enrollSecurityQuestionFactor.json create mode 100644 tests/responses/factors/enrollSmsFactor.json create mode 100644 tests/responses/factors/enrollSymantecVipFactor.json create mode 100644 tests/responses/factors/enrollVerifyPushFactor.json create mode 100644 tests/responses/factors/enrollVerifyTotpFactor.json create mode 100644 tests/responses/factors/enrollYubiKeyFactor.json create mode 100644 tests/responses/factors/getFactor.json create mode 100644 tests/responses/factors/listEnrolledFactors.json create mode 100644 tests/responses/factors/listFactorsToEnroll.json create mode 100644 tests/responses/factors/listSecurityQuestions.json create mode 100644 tests/responses/factors/smsExistingPhone.json create mode 100644 tests/responses/factors/smsFactorRateLimit.json create mode 100644 tests/responses/factors/verifyCallFactor.json create mode 100644 tests/responses/factors/verifyEmailFactor.json create mode 100644 tests/responses/factors/verifyPushFactor.json create mode 100644 tests/responses/factors/verifyPushFactorApproved.json create mode 100644 tests/responses/factors/verifyPushFactorRejected.json create mode 100644 tests/responses/factors/verifyPushFactorTimeout.json create mode 100644 tests/responses/factors/verifyPushFactorWaiting.json create mode 100644 tests/responses/factors/verifySecurityQuestionFactor.json create mode 100644 tests/responses/factors/verifySmsFactor.json create mode 100644 tests/responses/factors/verifyTokenFactor.json create mode 100644 tests/responses/factors/verifyTotpFactor.json diff --git a/src/Contracts/FactorProfile.php b/src/Contracts/FactorProfile.php new file mode 100644 index 0000000000..aff98a1290 --- /dev/null +++ b/src/Contracts/FactorProfile.php @@ -0,0 +1,24 @@ +createNewHttpClient([ + 'getBody' => file_get_contents(__DIR__ . '/../responses/factors/getFactor.json') + ]); + + + $factor = (new \Okta\UserFactors\Factor())->get('userId123', 'FactorId123', ""); + + $requests = $client->getRequests(); + + $this->assertEquals("/api/v1/users/userId123/factors/FactorId123/", $requests[0]->getUri()->getPath()); + + $this->assertInstanceOf(\Okta\UserFactors\SmsFactor::class, $factor); + $this->assertequals('application/json', $requests[0]->getHeaderLine('Accept')); + $this->assertEmpty($requests[0]->getHeaderLine('Content-Type')); + $this->assertEquals("SSWS {$this->token}", $requests[0]->getHeaderLine('Authorization')); + + } + + /** @test */ + public function a_user_should_be_able_to_get_a_factor_by_factor_id_only() + { + $client = $this->createNewHttpClient([ + 'getBody' => file_get_contents(__DIR__ . '/../responses/factors/getFactor.json') + ]); + + $user = $this->createnewUser(); + $factor = $user->getFactor('FactorId123'); + + $requests = $client->getRequests(); + + + $this->assertEquals("/api/v1/users/{$user->getId()}/factors/FactorId123/", $requests[0]->getUri()->getPath()); + + $this->assertInstanceOf(\Okta\UserFactors\SmsFactor::class, $factor); + $this->assertequals('application/json', $requests[0]->getHeaderLine('Accept')); + $this->assertEmpty($requests[0]->getHeaderLine('Content-Type')); + $this->assertEquals("SSWS {$this->token}", $requests[0]->getHeaderLine('Authorization')); + + } + + + + /** @test */ + public function can_list_all_enrolled_factors() + { + $client = $this->createNewHttpClient([ + 'getBody' => file_get_contents(__DIR__ . '/../responses/factors/listEnrolledFactors.json') + ]); + + + $user = $this->createNewUser(); + $allFactors = $user->getFactors(); + + $requests = $client->getRequests(); + + $this->assertEquals("/api/v1/users/{$user->getId()}/factors", $requests[0]->getUri()->getPath()); + + $this->assertInstanceOf(\Okta\UserFactors\Collection::class, $allFactors); + $this->assertequals('application/json', $requests[0]->getHeaderLine('Accept')); + $this->assertEmpty($requests[0]->getHeaderLine('Content-Type')); + $this->assertEquals("SSWS {$this->token}", $requests[0]->getHeaderLine('Authorization')); + + $this->assertCount(3, $allFactors); + $this->assertInstanceof(\Okta\UserFactors\SecurityQuestionFactor::class, $allFactors[0]); + $this->assertInstanceof(\Okta\UserFactors\TotpFactor::class, $allFactors[1]); + $this->assertInstanceof(\Okta\UserFactors\SmsFactor::class, $allFactors[2]); + + } + + /** @test */ + public function can_list_all_factors_to_enroll() + { + $client = $this->createNewHttpClient([ + 'getBody' => file_get_contents(__DIR__ . '/../responses/factors/listFactorsToEnroll.json') + ]); + + + $user = $this->createNewUser(); + $allFactors = $user->getSupportedFactors(); + + $requests = $client->getRequests(); + + $this->assertEquals("/api/v1/users/{$user->getId()}/factors/catalog", $requests[0]->getUri()->getPath()); + + $this->assertInstanceOf(\Okta\UserFactors\Collection::class, $allFactors); + $this->assertequals('application/json', $requests[0]->getHeaderLine('Accept')); + $this->assertEmpty($requests[0]->getHeaderLine('Content-Type')); + $this->assertEquals("SSWS {$this->token}", $requests[0]->getHeaderLine('Authorization')); + + $this->assertCount(7, $allFactors); + + $this->assertInstanceof(\Okta\UserFactors\SecurityQuestionFactor::class, $allFactors[0]); + $this->assertInstanceof(\Okta\UserFactors\TotpFactor::class, $allFactors[1]); + $this->assertInstanceof(\Okta\UserFactors\TotpFactor::class, $allFactors[2]); + $this->assertInstanceof(\Okta\UserFactors\SmsFactor::class, $allFactors[3]); + $this->assertInstanceof(\Okta\UserFactors\CallFactor::class, $allFactors[4]); + $this->assertInstanceof(\Okta\UserFactors\TokenFactor::class, $allFactors[5]); + $this->assertInstanceof(\Okta\UserFactors\TokenFactor::class, $allFactors[6]); + } + + +} diff --git a/tests/models/user.json b/tests/models/user.json new file mode 100644 index 0000000000..04f06778e8 --- /dev/null +++ b/tests/models/user.json @@ -0,0 +1,74 @@ +{ + "id": "00ub0oNGTSWTBKOLGLNR", + "status": "ACTIVE", + "transitioningToStatus": "ACTIVE", + "created": "2013-06-24T16:39:18.000Z", + "activated": "2013-06-24T16:39:19.000Z", + "statusChanged": "2013-06-24T16:39:19.000Z", + "lastLogin": "2013-06-24T17:39:19.000Z", + "lastUpdated": "2013-06-27T16:35:28.000Z", + "passwordChanged": "2013-06-24T16:39:19.000Z", + "profile": { + "login": "isaac.brock@example.com", + "firstName": "Isaac", + "lastName": "Brock", + "nickName": "issac", + "displayName": "Isaac Brock", + "email": "isaac.brock@example.com", + "secondEmail": "isaac@example.org", + "profileUrl": "http://www.example.com/profile", + "preferredLanguage": "en-US", + "userType": "Employee", + "organization": "Okta", + "title": "Director", + "division": "R&D", + "department": "Engineering", + "costCenter": "10", + "employeeNumber": "187", + "mobilePhone": "+1-555-415-1337", + "primaryPhone": "+1-555-514-1337", + "streetAddress": "301 Brannan St.", + "city": "San Francisco", + "state": "CA", + "zipCode": "94107", + "countryCode": "US" + }, + "credentials": { + "password": {}, + "recovery_question": { + "question": "Who's a major player in the cowboy scene?" + }, + "provider": { + "type": "OKTA", + "name": "OKTA" + } + }, + "_links": { + "resetPassword": { + "href": "https://your-domain.okta.com/api/v1/users/00ub0oNGTSWTBKOLGLNR/lifecycle/reset_password" + }, + "resetFactors": { + "href": "https://your-domain.okta.com/api/v1/users/00ub0oNGTSWTBKOLGLNR/lifecycle/reset_factors" + }, + "expirePassword": { + "href": "https://your-domain.okta.com/api/v1/users/00ub0oNGTSWTBKOLGLNR/lifecycle/expire_password" + }, + "forgotPassword": { + "href": "https://your-domain.okta.com/api/v1/users/00ub0oNGTSWTBKOLGLNR/credentials/forgot_password" + }, + "changeRecoveryQuestion": { + "href": "https://your-domain.okta.com/api/v1/users/00ub0oNGTSWTBKOLGLNR/credentials/change_recovery_question" + }, + "deactivate": { + "href": "https://your-domain.okta.com/api/v1/users/00ub0oNGTSWTBKOLGLNR/lifecycle/deactivate" + }, + "changePassword": { + "href": "https://your-domain.okta.com/api/v1/users/00ub0oNGTSWTBKOLGLNR/credentials/change_password" + } + }, + "_embedded": { + "someProperty": { + "withValue": 30 + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/activateCallFactor.json b/tests/responses/factors/activateCallFactor.json new file mode 100644 index 0000000000..4fee4ac57d --- /dev/null +++ b/tests/responses/factors/activateCallFactor.json @@ -0,0 +1,39 @@ +{ + "id": "clf1o51EADOTFXHHBXBP", + "factorType": "call", + "provider": "OKTA", + "status": "ACTIVE", + "created": "2014-08-06T16:56:31.000Z", + "lastUpdated": "2014-08-06T16:56:31.000Z", + "profile": { + "phoneNumber": "+1-555-415-1337", + "phoneExtension": "1234" + }, + "_links": { + "verify": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/clf1o51EADOTFXHHBXBP/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/clf1o51EADOTFXHHBXBP", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/activateEmailFactor.json b/tests/responses/factors/activateEmailFactor.json new file mode 100644 index 0000000000..d34691226d --- /dev/null +++ b/tests/responses/factors/activateEmailFactor.json @@ -0,0 +1,37 @@ +{ + "id": "emfnf3gSScB8xXoXK0g3", + "factorType": "email", + "provider": "OKTA", + "vendorName": "OKTA", + "status": "ACTIVE", + "profile": { + "email": "changed@clouditude.net" + }, + "_links": { + "verify": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00umvfJKwXOQ1mEL50g3/factors/emfnf3gSScB8xXoXK0g3/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00umvfJKwXOQ1mEL50g3/factors/emfnf3gSScB8xXoXK0g3", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00umvfJKwXOQ1mEL50g3", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/activatePushFactor.json b/tests/responses/factors/activatePushFactor.json new file mode 100644 index 0000000000..d8b258d5f2 --- /dev/null +++ b/tests/responses/factors/activatePushFactor.json @@ -0,0 +1,38 @@ +{ + "expiresAt": "2015-04-01T15:57:32.000Z", + "factorResult": "WAITING", + "_links": { + "poll": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/opf3hkfocI4JTLAju0g4/lifecycle/activate", + "hints": { + "allow": [ + "POST" + ] + } + }, + "qrcode": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/opf3hkfocI4JTLAju0g4/qr/00fukNElRS_Tz6k-CFhg3pH4KO2dj2guhmaapXWbc4", + "type": "image/png" + }, + "send": [ + { + "name": "email", + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/opf3hkfocI4JTLAju0g4/lifecycle/activate/email", + "hints": { + "allow": [ + "POST" + ] + } + }, + { + "name": "sms", + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/opf3hkfocI4JTLAju0g4/lifecycle/activate/sms", + "hints": { + "allow": [ + "POST" + ] + } + } + ] + } +} \ No newline at end of file diff --git a/tests/responses/factors/activateSmsFactor.json b/tests/responses/factors/activateSmsFactor.json new file mode 100644 index 0000000000..6c860d5e5d --- /dev/null +++ b/tests/responses/factors/activateSmsFactor.json @@ -0,0 +1,38 @@ +{ + "id": "sms1o51EADOTFXHHBXBP", + "factorType": "sms", + "provider": "OKTA", + "status": "ACTIVE", + "created": "2014-08-06T16:56:31.000Z", + "lastUpdated": "2014-08-06T16:56:31.000Z", + "profile": { + "phoneNumber": "+1-555-415-1337" + }, + "_links": { + "verify": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/sms1o51EADOTFXHHBXBP/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/sms1o51EADOTFXHHBXBP", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/activateTotpFactor.json b/tests/responses/factors/activateTotpFactor.json new file mode 100644 index 0000000000..1ce28d0d24 --- /dev/null +++ b/tests/responses/factors/activateTotpFactor.json @@ -0,0 +1,38 @@ +{ + "id": "ostf1fmaMGJLMNGNLIVG", + "factorType": "token:software:totp", + "provider": "OKTA", + "status": "ACTIVE", + "created": "2014-07-16T16:13:56.000Z", + "lastUpdated": "2014-08-06T00:31:07.000Z", + "profile": { + "credentialId": "dade.murphy@example.com" + }, + "_links": { + "verify": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/ostf1fmaMGJLMNGNLIVG/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/ostf1fmaMGJLMNGNLIVG", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/callFactorExistingPhone.json b/tests/responses/factors/callFactorExistingPhone.json new file mode 100644 index 0000000000..56364fa32a --- /dev/null +++ b/tests/responses/factors/callFactorExistingPhone.json @@ -0,0 +1,11 @@ +{ + "errorCode": "E0000001", + "errorSummary": "Api validation failed: factorEnrollRequest", + "errorLink": "E0000001", + "errorId": "oaeneEaQF8qQrepOWHSkdoejw", + "errorCauses": [ + { + "errorSummary": "Factor already exists." + } + ] +} \ No newline at end of file diff --git a/tests/responses/factors/callFactorRateLimit.json b/tests/responses/factors/callFactorRateLimit.json new file mode 100644 index 0000000000..d96be3d77c --- /dev/null +++ b/tests/responses/factors/callFactorRateLimit.json @@ -0,0 +1,7 @@ +{ + "errorCode": "E0000047", + "errorSummary": "API call exceeded rate limit due to too many requests", + "errorLink": "E0000047", + "errorId": "oaexL5rislQROquLn3Jec7oGw", + "errorCauses": [] +} \ No newline at end of file diff --git a/tests/responses/factors/emailFactorInvalidAddress.json b/tests/responses/factors/emailFactorInvalidAddress.json new file mode 100644 index 0000000000..40396cd62e --- /dev/null +++ b/tests/responses/factors/emailFactorInvalidAddress.json @@ -0,0 +1,7 @@ +{ + "errorCode": "E0000001", + "errorSummary": "Api validation failed: Only verified primary or secondary email can be enrolled.", + "errorLink": "E0000001", + "errorId": "oaeeJunJcxXQlCsrYEwGzN2LQ", + "errorCauses": [] +} \ No newline at end of file diff --git a/tests/responses/factors/enrollCallFactor.json b/tests/responses/factors/enrollCallFactor.json new file mode 100644 index 0000000000..a0954cd7a2 --- /dev/null +++ b/tests/responses/factors/enrollCallFactor.json @@ -0,0 +1,49 @@ +{ + "id": "clf1nz9JHJGHWRKMTLHP", + "factorType": "call", + "provider": "OKTA", + "status": "PENDING_ACTIVATION", + "created": "2014-08-05T20:59:49.000Z", + "lastUpdated": "2014-08-06T03:59:49.000Z", + "profile": { + "phoneNumber": "+1-555-415-1337", + "phoneExtension": "1234" + }, + "_links": { + "activate": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/clf1nz9JHJGHWRKMTLHP/lifecycle/activate", + "hints": { + "allow": [ + "POST" + ] + } + }, + "resend": [ + { + "name": "call", + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/clf1nz9JHJGHWRKMTLHP/resend", + "hints": { + "allow": [ + "POST" + ] + } + } + ], + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/clf1nz9JHJGHWRKMTLHP", + "hints": { + "allow": [ + "GET" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/enrollEmailFactor.json b/tests/responses/factors/enrollEmailFactor.json new file mode 100644 index 0000000000..3d12923404 --- /dev/null +++ b/tests/responses/factors/enrollEmailFactor.json @@ -0,0 +1,44 @@ +{ + "id": "emfnf3gSScB8xXoXK0g3", + "factorType": "email", + "provider": "OKTA", + "vendorName": "OKTA", + "status": "PENDING_ACTIVATION", + "_links": { + "activate": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00umvfJKwXOQ1mEL50g3/factors/emfnf3gSScB8xXoXK0g3/lifecycle/activate", + "hints": { + "allow": [ + "POST" + ] + } + }, + "resend": [ + { + "name": "email", + "href": "https://{yourOktaDomain}.com/api/v1/users/00umvfJKwXOQ1mEL50g3/factors/emfnf3gSScB8xXoXK0g3/resend", + "hints": { + "allow": [ + "POST" + ] + } + } + ], + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00umvfJKwXOQ1mEL50g3/factors/emfnf3gSScB8xXoXK0g3", + "hints": { + "allow": [ + "GET" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00umvfJKwXOQ1mEL50g3", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/enrollGoogleAuthenticatorFactor.json b/tests/responses/factors/enrollGoogleAuthenticatorFactor.json new file mode 100644 index 0000000000..d6c72e3edc --- /dev/null +++ b/tests/responses/factors/enrollGoogleAuthenticatorFactor.json @@ -0,0 +1,51 @@ +{ + "id": "ostf1fmaMGJLMNGNLIVG", + "factorType": "token:software:totp", + "provider": "GOOGLE", + "status": "PENDING_ACTIVATION", + "created": "2014-07-16T16:13:56.000Z", + "lastUpdated": "2014-07-16T16:13:56.000Z", + "profile": { + "credentialId": "dade.murphy@example.com" + }, + "_links": { + "activate": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/ostf1fmaMGJLMNGNLIVG/lifecycle/activate", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/ostf1fmaMGJLMNGNLIVG", + "hints": { + "allow": [ + "GET" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + }, + "_embedded": { + "activation": { + "timeStep": 30, + "sharedSecret": "JBTWGV22G4ZGKV3N", + "encoding": "base32", + "keyLength": 16, + "_links": { + "qrcode": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/ostf1fmaMGJLMNGNLIVG/qr/00fukNElRS_Tz6k-CFhg3pH4KO2dj2guhmaapXWbc4", + "type": "image/png" + } + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/enrollRsaSecurIDFactor.json b/tests/responses/factors/enrollRsaSecurIDFactor.json new file mode 100644 index 0000000000..9fa78745be --- /dev/null +++ b/tests/responses/factors/enrollRsaSecurIDFactor.json @@ -0,0 +1,38 @@ +{ + "id": "rsabtznMn6cp94ez20g4", + "factorType": "token", + "provider": "RSA", + "status": "ACTIVE", + "created": "2015-11-13T07:05:53.000Z", + "lastUpdated": "2015-11-13T07:05:53.000Z", + "profile": { + "credentialId": "dade.murphy@example.com" + }, + "_links": { + "verify": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/rsabtznMn6cp94ez20g4/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/rsabtznMn6cp94ez20g4", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/enrollSecurityQuestionFactor.json b/tests/responses/factors/enrollSecurityQuestionFactor.json new file mode 100644 index 0000000000..28c24905ae --- /dev/null +++ b/tests/responses/factors/enrollSecurityQuestionFactor.json @@ -0,0 +1,39 @@ +{ + "id": "ufs1o01OTMGHLAJPVHDZ", + "factorType": "question", + "provider": "OKTA", + "status": "ACTIVE", + "created": "2014-08-05T22:58:49.000Z", + "lastUpdated": "2014-08-05T22:58:49.000Z", + "profile": { + "question": "disliked_food", + "questionText": "What is the food you least liked as a child?" + }, + "_links": { + "questions": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/questions", + "hints": { + "allow": [ + "GET" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/ufs1o01OTMGHLAJPVHDZ", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/enrollSmsFactor.json b/tests/responses/factors/enrollSmsFactor.json new file mode 100644 index 0000000000..2e00980f8b --- /dev/null +++ b/tests/responses/factors/enrollSmsFactor.json @@ -0,0 +1,48 @@ +{ + "id": "mbl1nz9JHJGHWRKMTLHP", + "factorType": "sms", + "provider": "OKTA", + "status": "PENDING_ACTIVATION", + "created": "2014-08-05T20:59:49.000Z", + "lastUpdated": "2014-08-06T03:59:49.000Z", + "profile": { + "phoneNumber": "+1-555-415-1337" + }, + "_links": { + "activate": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/mbl1nz9JHJGHWRKMTLHP/lifecycle/activate", + "hints": { + "allow": [ + "POST" + ] + } + }, + "resend": [ + { + "name": "sms", + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/mbl1nz9JHJGHWRKMTLHP/resend", + "hints": { + "allow": [ + "POST" + ] + } + } + ], + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/mbl1nz9JHJGHWRKMTLHP", + "hints": { + "allow": [ + "GET" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/enrollSymantecVipFactor.json b/tests/responses/factors/enrollSymantecVipFactor.json new file mode 100644 index 0000000000..d5926c45b1 --- /dev/null +++ b/tests/responses/factors/enrollSymantecVipFactor.json @@ -0,0 +1,38 @@ +{ + "id": "ufvbtzgkYaA7zTKdQ0g4", + "factorType": "token", + "provider": "SYMANTEC", + "status": "ACTIVE", + "created": "2015-11-13T06:52:08.000Z", + "lastUpdated": "2015-11-13T06:52:08.000Z", + "profile": { + "credentialId": "VSMT14393584" + }, + "_links": { + "verify": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/ufvbtzgkYaA7zTKdQ0g4/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/ufvbtzgkYaA7zTKdQ0g4", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/enrollVerifyPushFactor.json b/tests/responses/factors/enrollVerifyPushFactor.json new file mode 100644 index 0000000000..fbff0e7524 --- /dev/null +++ b/tests/responses/factors/enrollVerifyPushFactor.json @@ -0,0 +1,66 @@ +{ + "id": "opfbtzzrjgwauUsxO0g4", + "factorType": "push", + "provider": "OKTA", + "status": "PENDING_ACTIVATION", + "created": "2015-11-13T07:34:22.000Z", + "lastUpdated": "2015-11-13T07:34:22.000Z", + "_links": { + "poll": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/opfbtzzrjgwauUsxO0g4/lifecycle/activate/poll", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/opfbtzzrjgwauUsxO0g4", + "hints": { + "allow": [ + "GET" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + }, + "_embedded": { + "activation": { + "expiresAt": "2015-11-13T07:44:22.000Z", + "factorResult": "WAITING", + "_links": { + "send": [ + { + "name": "email", + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/opfbtzzrjgwauUsxO0g4/lifecycle/activate/email", + "hints": { + "allow": [ + "POST" + ] + } + }, + { + "name": "sms", + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/opfbtzzrjgwauUsxO0g4/lifecycle/activate/sms", + "hints": { + "allow": [ + "POST" + ] + } + } + ], + "qrcode": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/opfbtzzrjgwauUsxO0g4/qr/00Ji8qVBNJD4LmjYy1WZO2VbNqvvPdaCVua-1qjypa", + "type": "image/png" + } + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/enrollVerifyTotpFactor.json b/tests/responses/factors/enrollVerifyTotpFactor.json new file mode 100644 index 0000000000..772a6a8c5e --- /dev/null +++ b/tests/responses/factors/enrollVerifyTotpFactor.json @@ -0,0 +1,51 @@ +{ + "id": "ostf1fmaMGJLMNGNLIVG", + "factorType": "token:software:totp", + "provider": "OKTA", + "status": "PENDING_ACTIVATION", + "created": "2014-07-16T16:13:56.000Z", + "lastUpdated": "2014-07-16T16:13:56.000Z", + "profile": { + "credentialId": "dade.murphy@example.com" + }, + "_links": { + "activate": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/ostf1fmaMGJLMNGNLIVG/lifecycle/activate", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/ostf1fmaMGJLMNGNLIVG", + "hints": { + "allow": [ + "GET" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + }, + "_embedded": { + "activation": { + "timeStep": 30, + "sharedSecret": "JBTWGV22G4ZGKV3N", + "encoding": "base32", + "keyLength": 6 + }, + "_links": { + "qrcode": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/ostf1fmaMGJLMNGNLIVG/qr/00fukNElRS_Tz6k-CFhg3pH4KO2dj2guhmaapXWbc4", + "type": "image/png" + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/enrollYubiKeyFactor.json b/tests/responses/factors/enrollYubiKeyFactor.json new file mode 100644 index 0000000000..4295da9e79 --- /dev/null +++ b/tests/responses/factors/enrollYubiKeyFactor.json @@ -0,0 +1,38 @@ +{ + "id": "ykfbty3BJeBgUi3750g4", + "factorType": "token:hardware", + "provider": "YUBICO", + "status": "ACTIVE", + "created": "2015-11-13T05:27:49.000Z", + "lastUpdated": "2015-11-13T05:27:49.000Z", + "profile": { + "credentialId": "000004102994" + }, + "_links": { + "verify": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/ykfbty3BJeBgUi3750g4/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "hhttps://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/ykfbty3BJeBgUi3750g4", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/getFactor.json b/tests/responses/factors/getFactor.json new file mode 100644 index 0000000000..9a385db3de --- /dev/null +++ b/tests/responses/factors/getFactor.json @@ -0,0 +1,38 @@ +{ + "id": "sms2gt8gzgEBPUWBIFHN", + "factorType": "sms", + "provider": "OKTA", + "status": "ACTIVE", + "created": "2014-06-27T20:27:26.000Z", + "lastUpdated": "2014-06-27T20:27:26.000Z", + "profile": { + "phoneNumber": "+1-555-415-1337" + }, + "_links": { + "verify": { + "href": "https://php.okta.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/sms2gt8gzgEBPUWBIFHN/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://php.okta.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/sms2gt8gzgEBPUWBIFHN", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://php.okta.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/listEnrolledFactors.json b/tests/responses/factors/listEnrolledFactors.json new file mode 100644 index 0000000000..7e095f6d3c --- /dev/null +++ b/tests/responses/factors/listEnrolledFactors.json @@ -0,0 +1,125 @@ +[ + { + "id": "ufs2bysphxKODSZKWVCT", + "factorType": "question", + "provider": "OKTA", + "status": "ACTIVE", + "created": "2014-04-15T18:10:06.000Z", + "lastUpdated": "2014-04-15T18:10:06.000Z", + "profile": { + "question": "favorite_art_piece", + "questionText": "What is your favorite piece of art?" + }, + "_links": { + "questions": { + "href": "https://php.okta.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/questions", + "hints": { + "allow": [ + "GET" + ] + } + }, + "self": { + "href": "https://php.okta.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/ufs2bysphxKODSZKWVCT", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://php.okta.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } + }, + { + "id": "ostf2gsyictRQDSGTDZE", + "factorType": "token:software:totp", + "provider": "OKTA", + "status": "PENDING_ACTIVATION", + "created": "2014-06-27T20:27:33.000Z", + "lastUpdated": "2014-06-27T20:27:33.000Z", + "profile": { + "credentialId": "dade.murphy@example.com" + }, + "_links": { + "next": { + "name": "activate", + "href": "https://php.okta.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/ostf2gsyictRQDSGTDZE/lifecycle/activate", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://php.okta.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/ostf2gsyictRQDSGTDZE", + "hints": { + "allow": [ + "GET" + ] + } + }, + "user": { + "href": "https://php.okta.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + }, + "_embedded": { + "activation": { + "timeStep": 30, + "sharedSecret": "HE64TMLL2IUZW2ZLB", + "encoding": "base32", + "keyLength": 16 + } + } + }, + { + "id": "sms2gt8gzgEBPUWBIFHN", + "factorType": "sms", + "provider": "OKTA", + "status": "ACTIVE", + "created": "2014-06-27T20:27:26.000Z", + "lastUpdated": "2014-06-27T20:27:26.000Z", + "profile": { + "phoneNumber": "+1-555-415-1337" + }, + "_links": { + "verify": { + "href": "https://php.okta.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/sms2gt8gzgEBPUWBIFHN/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://php.okta.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/sms2gt8gzgEBPUWBIFHN", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://php.okta.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } + } +] \ No newline at end of file diff --git a/tests/responses/factors/listFactorsToEnroll.json b/tests/responses/factors/listFactorsToEnroll.json new file mode 100644 index 0000000000..217a2a581f --- /dev/null +++ b/tests/responses/factors/listFactorsToEnroll.json @@ -0,0 +1,119 @@ +[ + { + "factorType": "question", + "provider": "OKTA", + "_links": { + "questions": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/questions", + "hints": { + "allow": [ + "GET" + ] + } + }, + "enroll": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors", + "hints": { + "allow": [ + "POST" + ] + } + } + } + }, + { + "factorType": "token:software:totp", + "provider": "OKTA", + "_links": { + "enroll": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors", + "hints": { + "allow": [ + "POST" + ] + } + } + } + }, + { + "factorType": "token:software:totp", + "provider": "GOOGLE", + "_links": { + "enroll": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors", + "hints": { + "allow": [ + "POST" + ] + } + } + } + }, + { + "factorType": "sms", + "provider": "OKTA", + "_links": { + "enroll": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors", + "hints": { + "allow": [ + "POST" + ] + } + } + }, + "_embedded": { + "phones": [ + { + "id": "mblldntFJevYKbyQQ0g3", + "profile": { + "phoneNumber": "+14081234567" + }, + "status": "ACTIVE" + } + ] + } + }, + { + "factorType": "call", + "provider": "OKTA", + "_links": { + "enroll": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors", + "hints": { + "allow": [ + "POST" + ] + } + } + } + }, + { + "factorType": "token", + "provider": "RSA", + "_links": { + "enroll": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors", + "hints": { + "allow": [ + "POST" + ] + } + } + } + }, + { + "factorType": "token", + "provider": "SYMANTEC", + "_links": { + "enroll": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors", + "hints": { + "allow": [ + "POST" + ] + } + } + } + } +] \ No newline at end of file diff --git a/tests/responses/factors/listSecurityQuestions.json b/tests/responses/factors/listSecurityQuestions.json new file mode 100644 index 0000000000..d79853b362 --- /dev/null +++ b/tests/responses/factors/listSecurityQuestions.json @@ -0,0 +1,14 @@ +[ + { + "question": "disliked_food", + "questionText": "What is the food you least liked as a child?" + }, + { + "question": "name_of_first_plush_toy", + "questionText": "What is the name of your first stuffed animal?" + }, + { + "question": "first_award", + "questionText": "What did you earn your first medal or award for?" + } +] \ No newline at end of file diff --git a/tests/responses/factors/smsExistingPhone.json b/tests/responses/factors/smsExistingPhone.json new file mode 100644 index 0000000000..74674cece6 --- /dev/null +++ b/tests/responses/factors/smsExistingPhone.json @@ -0,0 +1,11 @@ +{ + "errorCode": "E0000001", + "errorSummary": "Api validation failed: factorEnrollRequest", + "errorLink": "E0000001", + "errorId": "oaeneEaQF8qQrepOWHSkdoejw", + "errorCauses": [ + { + "errorSummary": "There is an existing verified phone number." + } + ] +} \ No newline at end of file diff --git a/tests/responses/factors/smsFactorRateLimit.json b/tests/responses/factors/smsFactorRateLimit.json new file mode 100644 index 0000000000..0e5e27ba80 --- /dev/null +++ b/tests/responses/factors/smsFactorRateLimit.json @@ -0,0 +1,7 @@ +{ + "errorCode": "E0000109", + "errorSummary": "An SMS message was recently sent. Please wait 30 seconds before trying again.", + "errorLink": "E0000109", + "errorId": "oaeneEaQF8qQrepOWHSkdoejw", + "errorCauses": [] +} \ No newline at end of file diff --git a/tests/responses/factors/verifyCallFactor.json b/tests/responses/factors/verifyCallFactor.json new file mode 100644 index 0000000000..af03dfb7fd --- /dev/null +++ b/tests/responses/factors/verifyCallFactor.json @@ -0,0 +1,3 @@ +{ + "factorResult": "SUCCESS" +} \ No newline at end of file diff --git a/tests/responses/factors/verifyEmailFactor.json b/tests/responses/factors/verifyEmailFactor.json new file mode 100644 index 0000000000..af03dfb7fd --- /dev/null +++ b/tests/responses/factors/verifyEmailFactor.json @@ -0,0 +1,3 @@ +{ + "factorResult": "SUCCESS" +} \ No newline at end of file diff --git a/tests/responses/factors/verifyPushFactor.json b/tests/responses/factors/verifyPushFactor.json new file mode 100644 index 0000000000..238ca90271 --- /dev/null +++ b/tests/responses/factors/verifyPushFactor.json @@ -0,0 +1,22 @@ +{ + "expiresAt": "2015-04-01T15:57:32.000Z", + "factorResult": "WAITING", + "_links": { + "poll": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/opfh52xcuft3J4uZc0g3/transactions/mst1eiHghhPxf0yhp0g", + "hints": { + "allow": [ + "GET" + ] + } + }, + "cancel": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/opfh52xcuft3J4uZc0g3/transactions/mst1eiHghhPxf0yhp0g", + "hints": { + "allow": [ + "DELETE" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/verifyPushFactorApproved.json b/tests/responses/factors/verifyPushFactorApproved.json new file mode 100644 index 0000000000..af03dfb7fd --- /dev/null +++ b/tests/responses/factors/verifyPushFactorApproved.json @@ -0,0 +1,3 @@ +{ + "factorResult": "SUCCESS" +} \ No newline at end of file diff --git a/tests/responses/factors/verifyPushFactorRejected.json b/tests/responses/factors/verifyPushFactorRejected.json new file mode 100644 index 0000000000..644fcbe17c --- /dev/null +++ b/tests/responses/factors/verifyPushFactorRejected.json @@ -0,0 +1,22 @@ +{ + "factorResult": "REJECTED", + "_links": { + "verify": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/opfh52xcuft3J4uZc0g3/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "factor": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/opfh52xcuft3J4uZc0g3", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/verifyPushFactorTimeout.json b/tests/responses/factors/verifyPushFactorTimeout.json new file mode 100644 index 0000000000..14f9c513b3 --- /dev/null +++ b/tests/responses/factors/verifyPushFactorTimeout.json @@ -0,0 +1,22 @@ +{ + "factorResult": "TIMEOUT", + "_links": { + "verify": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/opfh52xcuft3J4uZc0g3/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "factor": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/opfh52xcuft3J4uZc0g3", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/verifyPushFactorWaiting.json b/tests/responses/factors/verifyPushFactorWaiting.json new file mode 100644 index 0000000000..238ca90271 --- /dev/null +++ b/tests/responses/factors/verifyPushFactorWaiting.json @@ -0,0 +1,22 @@ +{ + "expiresAt": "2015-04-01T15:57:32.000Z", + "factorResult": "WAITING", + "_links": { + "poll": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/opfh52xcuft3J4uZc0g3/transactions/mst1eiHghhPxf0yhp0g", + "hints": { + "allow": [ + "GET" + ] + } + }, + "cancel": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/opfh52xcuft3J4uZc0g3/transactions/mst1eiHghhPxf0yhp0g", + "hints": { + "allow": [ + "DELETE" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/responses/factors/verifySecurityQuestionFactor.json b/tests/responses/factors/verifySecurityQuestionFactor.json new file mode 100644 index 0000000000..af03dfb7fd --- /dev/null +++ b/tests/responses/factors/verifySecurityQuestionFactor.json @@ -0,0 +1,3 @@ +{ + "factorResult": "SUCCESS" +} \ No newline at end of file diff --git a/tests/responses/factors/verifySmsFactor.json b/tests/responses/factors/verifySmsFactor.json new file mode 100644 index 0000000000..af03dfb7fd --- /dev/null +++ b/tests/responses/factors/verifySmsFactor.json @@ -0,0 +1,3 @@ +{ + "factorResult": "SUCCESS" +} \ No newline at end of file diff --git a/tests/responses/factors/verifyTokenFactor.json b/tests/responses/factors/verifyTokenFactor.json new file mode 100644 index 0000000000..af03dfb7fd --- /dev/null +++ b/tests/responses/factors/verifyTokenFactor.json @@ -0,0 +1,3 @@ +{ + "factorResult": "SUCCESS" +} \ No newline at end of file diff --git a/tests/responses/factors/verifyTotpFactor.json b/tests/responses/factors/verifyTotpFactor.json new file mode 100644 index 0000000000..af03dfb7fd --- /dev/null +++ b/tests/responses/factors/verifyTotpFactor.json @@ -0,0 +1,3 @@ +{ + "factorResult": "SUCCESS" +} \ No newline at end of file From 8cd4c77cb80c8b84ad338d846bc5a6500330677d Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Wed, 11 Oct 2017 16:28:10 -0400 Subject: [PATCH 08/22] WIP --- openapi/generator/index.js | 23 ++++- openapi/generator/templates/model.php.hbs | 30 +++++- src/Generated/GroupRules/GroupRule.php | 5 +- src/Generated/GroupRules/GroupRuleAction.php | 2 +- .../GroupRules/GroupRuleConditions.php | 4 +- .../GroupRules/GroupRulePeopleCondition.php | 4 +- src/Generated/Groups/Group.php | 3 +- src/Generated/UserFactors/CallFactor.php | 8 +- src/Generated/UserFactors/EmailFactor.php | 8 +- src/Generated/UserFactors/Factor.php | 46 +-------- src/Generated/UserFactors/HardwareFactor.php | 8 +- src/Generated/UserFactors/PushFactor.php | 8 +- .../UserFactors/PushFactorProfile.php | 30 ------ .../UserFactors/SecurityQuestionFactor.php | 8 +- src/Generated/UserFactors/SmsFactor.php | 8 +- src/Generated/UserFactors/TokenFactor.php | 8 +- src/Generated/UserFactors/TotpFactor.php | 8 +- .../UserFactors/VerifyFactorResponse.php | 6 +- src/Generated/UserFactors/WebFactor.php | 8 +- src/Generated/Users/ChangePasswordRequest.php | 4 +- src/Generated/Users/User.php | 65 +++++++++++- src/Generated/Users/UserCredentials.php | 6 +- .../SecurityQuestionsCollection.php} | 7 +- src/Users/User.php | 5 - tests/BaseTestCase.php | 27 +++++ tests/Integration/FactorsTest.php | 24 +---- .../UserFactors/CallFactorProfileTest.php | 68 +++++++++++++ tests/Unit/UserFactors/CallFactorTest.php | 63 ++++++++++++ .../UserFactors/EmailFactorProfileTest.php | 50 ++++++++++ tests/Unit/UserFactors/EmailFactorTest.php | 63 ++++++++++++ tests/Unit/UserFactors/FactorTest.php | 54 ++++++++++ .../UserFactors/HardwareFactorProfileTest.php | 50 ++++++++++ tests/Unit/UserFactors/HardwareFactorTest.php | 63 ++++++++++++ .../UserFactors/PushFactorProfileTest.php | 99 +++++++++++++++++++ tests/Unit/UserFactors/PushFactorTest.php | 63 ++++++++++++ .../SecurityQuestionFactorProfileTest.php | 84 ++++++++++++++++ .../SecurityQuestionFactorTest.php | 63 ++++++++++++ .../UserFactors/TokenFactorProfileTest.php | 50 ++++++++++ tests/Unit/UserFactors/TokenFactorTest.php | 63 ++++++++++++ .../UserFactors/TotpFactorProfileTest.php | 50 ++++++++++ tests/Unit/UserFactors/TotpFactorTest.php | 63 ++++++++++++ .../Unit/UserFactors/WebFactorProfileTest.php | 50 ++++++++++ tests/Unit/UserFactors/WebFactorTest.php | 63 ++++++++++++ tests/Unit/Users/UserTest.php | 63 +++++------- tests/models/UserFactors/callFactor.json | 38 +++++++ tests/models/UserFactors/emailFactor.json | 38 +++++++ .../models/UserFactors/factorProfileCall.json | 4 + .../UserFactors/factorProfileEmail.json | 3 + .../UserFactors/factorProfileHardware.json | 3 + .../models/UserFactors/factorProfilePush.json | 7 ++ .../UserFactors/factorProfileQuestion.json | 5 + .../models/UserFactors/factorProfileSms.json | 3 + .../UserFactors/factorProfileToken.json | 3 + .../models/UserFactors/factorProfileTotp.json | 3 + .../models/UserFactors/factorProfileWeb.json | 3 + tests/models/UserFactors/hardwareFactor.json | 38 +++++++ tests/models/UserFactors/pushFactor.json | 38 +++++++ .../UserFactors/securityQuestionFactor.json | 40 ++++++++ .../supportedSecurityQuestions.json | 78 +++++++++++++++ tests/models/UserFactors/tokenFactor.json | 38 +++++++ tests/models/UserFactors/totpFactor.json | 38 +++++++ tests/models/UserFactors/webFactor.json | 38 +++++++ 62 files changed, 1696 insertions(+), 207 deletions(-) rename src/{Contracts/FactorProfile.php => UserFactors/SecurityQuestionsCollection.php} (90%) create mode 100644 tests/Unit/UserFactors/CallFactorProfileTest.php create mode 100644 tests/Unit/UserFactors/CallFactorTest.php create mode 100644 tests/Unit/UserFactors/EmailFactorProfileTest.php create mode 100644 tests/Unit/UserFactors/EmailFactorTest.php create mode 100644 tests/Unit/UserFactors/FactorTest.php create mode 100644 tests/Unit/UserFactors/HardwareFactorProfileTest.php create mode 100644 tests/Unit/UserFactors/HardwareFactorTest.php create mode 100644 tests/Unit/UserFactors/PushFactorProfileTest.php create mode 100644 tests/Unit/UserFactors/PushFactorTest.php create mode 100644 tests/Unit/UserFactors/SecurityQuestionFactorProfileTest.php create mode 100644 tests/Unit/UserFactors/SecurityQuestionFactorTest.php create mode 100644 tests/Unit/UserFactors/TokenFactorProfileTest.php create mode 100644 tests/Unit/UserFactors/TokenFactorTest.php create mode 100644 tests/Unit/UserFactors/TotpFactorProfileTest.php create mode 100644 tests/Unit/UserFactors/TotpFactorTest.php create mode 100644 tests/Unit/UserFactors/WebFactorProfileTest.php create mode 100644 tests/Unit/UserFactors/WebFactorTest.php create mode 100644 tests/models/UserFactors/callFactor.json create mode 100644 tests/models/UserFactors/emailFactor.json create mode 100644 tests/models/UserFactors/factorProfileCall.json create mode 100644 tests/models/UserFactors/factorProfileEmail.json create mode 100644 tests/models/UserFactors/factorProfileHardware.json create mode 100644 tests/models/UserFactors/factorProfilePush.json create mode 100644 tests/models/UserFactors/factorProfileQuestion.json create mode 100644 tests/models/UserFactors/factorProfileSms.json create mode 100644 tests/models/UserFactors/factorProfileToken.json create mode 100644 tests/models/UserFactors/factorProfileTotp.json create mode 100644 tests/models/UserFactors/factorProfileWeb.json create mode 100644 tests/models/UserFactors/hardwareFactor.json create mode 100644 tests/models/UserFactors/pushFactor.json create mode 100644 tests/models/UserFactors/securityQuestionFactor.json create mode 100644 tests/models/UserFactors/supportedSecurityQuestions.json create mode 100644 tests/models/UserFactors/tokenFactor.json create mode 100644 tests/models/UserFactors/totpFactor.json create mode 100644 tests/models/UserFactors/webFactor.json diff --git a/openapi/generator/index.js b/openapi/generator/index.js index 7c5db55c03..26fab9b1e9 100644 --- a/openapi/generator/index.js +++ b/openapi/generator/index.js @@ -19,7 +19,7 @@ function getType(obj, model) { case 'TotpFactorProfile': case 'WebFactorProfile': case 'FactorProfile': - return '\\Okta\\Contracts\\FactorProfile'; + return '\\Okta\\UserFactors\\FactorProfile'; default: return `\\${model}\\${obj.model}`; } @@ -52,7 +52,7 @@ function getSafeType(obj, model) { case 'TotpFactorProfile': case 'WebFactorProfile': case 'FactorProfile': - return ': \\Okta\\Contracts\\FactorProfile'; + return ': \\Okta\\UserFactors\\FactorProfile'; default: return `: \\${model}\\${obj.model}`; } @@ -84,7 +84,7 @@ function getTypeHint(model) { case 'TotpFactorProfile': case 'WebFactorProfile': case 'FactorProfile': - return '\\Okta\\Contracts\\FactorProfile'; + return '\\Okta\\UserFactors\\FactorProfile'; default: return model; } @@ -297,6 +297,8 @@ function getClassNameForCollection(obj) { case 'listFactors': case 'listSupportedFactors': return '\\Okta\\UserFactors\\Factor'; + case 'listSupportedSecurityQuestions': + return `\\Okta\\UserFactors\\SecurityQuestion`; default: return `\\${obj.baseClass}\\${obj.operation.responseModel}`; } @@ -313,6 +315,8 @@ function getCollectionName(obj) { case 'listFactors': case 'listSupportedFactors': return '\\Okta\\UserFactors\\Collection'; + case 'listSupportedSecurityQuestions': + return `\\Okta\\UserFactors\\SecurityQuestionsCollection`; default: return `\\${obj.baseClass}\\Collection`; } @@ -333,6 +337,16 @@ function pluralize(string) { function customLog(toLog) { console.log(toLog); } + +function buildGetResourceParams(model) { + + switch(model.operation.operationId) { + case 'getFactor': + return String.raw`"factors/{$factorId}", \Okta\UserFactors\Factor::class, "/users/{$this->id}", []`; + } + +} + php.process = ({ spec, operations, models, handlebars }) => { const templates = []; @@ -435,7 +449,8 @@ php.process = ({ spec, operations, models, handlebars }) => { pluralize, customLog, getClassNameForCollection, - getCollectionName + getCollectionName, + buildGetResourceParams }); return templates; diff --git a/openapi/generator/templates/model.php.hbs b/openapi/generator/templates/model.php.hbs index 8e9d33c326..6a0440ffd4 100644 --- a/openapi/generator/templates/model.php.hbs +++ b/openapi/generator/templates/model.php.hbs @@ -81,6 +81,7 @@ class {{modelName}} extends {{getExtends modelName}} {{/if}} {{#if (eq alias "delete")}} + {{#unless (eq this.operation.operationId "deleteFactor")}} public function delete() { return \Okta\Client::getInstance() @@ -90,7 +91,7 @@ class {{modelName}} extends {{getExtends modelName}} $this ); } - + {{/unless}} {{/if}} {{/each}} {{#each properties}} @@ -113,7 +114,7 @@ class {{modelName}} extends {{getExtends modelName}} /** * Set the {{propertyName}}. * - * @param {{model}} ${{propertyName}} The {{model}} instance. + * @param {{getType this baseClass}} ${{propertyName}} The {{model}} instance. * @return self */ public function set{{pascalCase propertyName}}({{getTypeHint model}} ${{propertyName}}) @@ -172,6 +173,30 @@ class {{modelName}} extends {{getExtends modelName}} ); } {{else}} + {{#if (eq this.operation.method "get")}} + /** + * {{this.operation.description}} + * + {{getMethodParamsComment this}} + * @return mixed|null + */ + public function {{camelCase alias}}({{{getMethodParams this}}}) + { + $uri = "{{{getMethodPath this}}}"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + $response = $this + ->getDataStore() + ->getResource({{{buildGetResourceParams this}}}); + + {{#if (eq this.operation.responseModel "Factor")}} + return $response->convertFromGenericFactor(); + {{else}} + return $response; + {{/if}} + } + {{else}} /** * {{this.operation.description}} * @@ -189,5 +214,6 @@ class {{modelName}} extends {{getExtends modelName}} ->executeRequest({{{getMethodRequestParams this}}}{{path}}); } {{/if}} + {{/if}} {{/each}} } diff --git a/src/Generated/GroupRules/GroupRule.php b/src/Generated/GroupRules/GroupRule.php index 4df5900c21..b0d5984c50 100644 --- a/src/Generated/GroupRules/GroupRule.php +++ b/src/Generated/GroupRules/GroupRule.php @@ -49,7 +49,6 @@ public function delete() $this ); } - /** * Get the id. * @@ -133,7 +132,7 @@ public function getActions(array $options = []): \Okta\GroupRules\GroupRuleActio /** * Set the actions. * - * @param GroupRuleAction $actions The GroupRuleAction instance. + * @param \Okta\GroupRules\GroupRuleAction $actions The GroupRuleAction instance. * @return self */ public function setActions(GroupRuleAction $actions) @@ -171,7 +170,7 @@ public function getConditions(array $options = []): \Okta\GroupRules\GroupRuleCo /** * Set the conditions. * - * @param GroupRuleConditions $conditions The GroupRuleConditions instance. + * @param \Okta\GroupRules\GroupRuleConditions $conditions The GroupRuleConditions instance. * @return self */ public function setConditions(GroupRuleConditions $conditions) diff --git a/src/Generated/GroupRules/GroupRuleAction.php b/src/Generated/GroupRules/GroupRuleAction.php index e8ba3fd236..845a573adc 100644 --- a/src/Generated/GroupRules/GroupRuleAction.php +++ b/src/Generated/GroupRules/GroupRuleAction.php @@ -39,7 +39,7 @@ public function getAssignUserToGroups(array $options = []): \Okta\GroupRules\Gro /** * Set the assignUserToGroups. * - * @param GroupRuleGroupAssignment $assignUserToGroups The GroupRuleGroupAssignment instance. + * @param \Okta\GroupRules\GroupRuleGroupAssignment $assignUserToGroups The GroupRuleGroupAssignment instance. * @return self */ public function setAssignUserToGroups(GroupRuleGroupAssignment $assignUserToGroups) diff --git a/src/Generated/GroupRules/GroupRuleConditions.php b/src/Generated/GroupRules/GroupRuleConditions.php index d273005dde..3e8de5748a 100644 --- a/src/Generated/GroupRules/GroupRuleConditions.php +++ b/src/Generated/GroupRules/GroupRuleConditions.php @@ -40,7 +40,7 @@ public function getPeople(array $options = []): \Okta\GroupRules\GroupRulePeople /** * Set the people. * - * @param GroupRulePeopleCondition $people The GroupRulePeopleCondition instance. + * @param \Okta\GroupRules\GroupRulePeopleCondition $people The GroupRulePeopleCondition instance. * @return self */ public function setPeople(GroupRulePeopleCondition $people) @@ -69,7 +69,7 @@ public function getExpression(array $options = []): \Okta\GroupRules\GroupRuleEx /** * Set the expression. * - * @param GroupRuleExpression $expression The GroupRuleExpression instance. + * @param \Okta\GroupRules\GroupRuleExpression $expression The GroupRuleExpression instance. * @return self */ public function setExpression(GroupRuleExpression $expression) diff --git a/src/Generated/GroupRules/GroupRulePeopleCondition.php b/src/Generated/GroupRules/GroupRulePeopleCondition.php index b083728fc2..bb2fe5fc7d 100644 --- a/src/Generated/GroupRules/GroupRulePeopleCondition.php +++ b/src/Generated/GroupRules/GroupRulePeopleCondition.php @@ -40,7 +40,7 @@ public function getUsers(array $options = []): \Okta\GroupRules\GroupRuleUserCon /** * Set the users. * - * @param GroupRuleUserCondition $users The GroupRuleUserCondition instance. + * @param \Okta\GroupRules\GroupRuleUserCondition $users The GroupRuleUserCondition instance. * @return self */ public function setUsers(GroupRuleUserCondition $users) @@ -69,7 +69,7 @@ public function getGroups(array $options = []): \Okta\GroupRules\GroupRuleGroupC /** * Set the groups. * - * @param GroupRuleGroupCondition $groups The GroupRuleGroupCondition instance. + * @param \Okta\GroupRules\GroupRuleGroupCondition $groups The GroupRuleGroupCondition instance. * @return self */ public function setGroups(GroupRuleGroupCondition $groups) diff --git a/src/Generated/Groups/Group.php b/src/Generated/Groups/Group.php index d07cfa0c92..a50477708c 100644 --- a/src/Generated/Groups/Group.php +++ b/src/Generated/Groups/Group.php @@ -51,7 +51,6 @@ public function delete() $this ); } - /** * Get the id. * @@ -105,7 +104,7 @@ public function getProfile(array $options = []): \Okta\Groups\GroupProfile /** * Set the profile. * - * @param GroupProfile $profile The GroupProfile instance. + * @param \Okta\Groups\GroupProfile $profile The GroupProfile instance. * @return self */ public function setProfile(GroupProfile $profile) diff --git a/src/Generated/UserFactors/CallFactor.php b/src/Generated/UserFactors/CallFactor.php index 63b864eaa1..d07ad4dcee 100644 --- a/src/Generated/UserFactors/CallFactor.php +++ b/src/Generated/UserFactors/CallFactor.php @@ -25,9 +25,9 @@ class CallFactor extends \Okta\UserFactors\Factor /** * Get the profile. * - * @return \Okta\Contracts\FactorProfile + * @return \Okta\UserFactors\FactorProfile */ - public function getProfile(array $options = []): \Okta\Contracts\FactorProfile + public function getProfile(array $options = []): \Okta\UserFactors\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -39,10 +39,10 @@ public function getProfile(array $options = []): \Okta\Contracts\FactorProfile /** * Set the profile. * - * @param CallFactorProfile $profile The CallFactorProfile instance. + * @param \Okta\UserFactors\FactorProfile $profile The CallFactorProfile instance. * @return self */ - public function setProfile(\Okta\Contracts\FactorProfile $profile) + public function setProfile(\Okta\UserFactors\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/EmailFactor.php b/src/Generated/UserFactors/EmailFactor.php index cdc7ff2fb6..6af1845df8 100644 --- a/src/Generated/UserFactors/EmailFactor.php +++ b/src/Generated/UserFactors/EmailFactor.php @@ -25,9 +25,9 @@ class EmailFactor extends \Okta\UserFactors\Factor /** * Get the profile. * - * @return \Okta\Contracts\FactorProfile + * @return \Okta\UserFactors\FactorProfile */ - public function getProfile(array $options = []): \Okta\Contracts\FactorProfile + public function getProfile(array $options = []): \Okta\UserFactors\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -39,10 +39,10 @@ public function getProfile(array $options = []): \Okta\Contracts\FactorProfile /** * Set the profile. * - * @param EmailFactorProfile $profile The EmailFactorProfile instance. + * @param \Okta\UserFactors\FactorProfile $profile The EmailFactorProfile instance. * @return self */ - public function setProfile(\Okta\Contracts\FactorProfile $profile) + public function setProfile(\Okta\UserFactors\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/Factor.php b/src/Generated/UserFactors/Factor.php index f856cad017..680967e112 100644 --- a/src/Generated/UserFactors/Factor.php +++ b/src/Generated/UserFactors/Factor.php @@ -32,27 +32,6 @@ class Factor extends \Okta\Resource\AbstractResource const MFA_STATE_TOKEN_ID = 'mfaStateTokenId'; const RECHALLENGE_EXISTING_FACTOR = 'rechallengeExistingFactor'; - public function get($userId, $factorId, $query) - { - $factor = \Okta\Client::getInstance() - ->getDataStore() - ->getResource( - $query, - \Okta\UserFactors\Factor::class, - "/users/{$userId}/factors/{$factorId}" - ); - return $factor->convertFromGenericFactor(); - } - public function delete() - { - return \Okta\Client::getInstance() - ->getDataStore() - ->deleteResource( - "/users", - $this - ); - } - /** * Get the id. * @@ -62,21 +41,6 @@ public function getId(): string { return $this->getProperty(self::ID); } - /** - * Set the id. - * - * @param mixed $id The value to set. - * @return self - */ - public function setId($id) - { - $this->setProperty( - self::ID, - $id - ); - - return $this; - } /** * Get the device. * @@ -142,7 +106,7 @@ public function getVerify(array $options = []): \Okta\UserFactors\VerifyFactorRe /** * Set the verify. * - * @param VerifyFactorRequest $verify The VerifyFactorRequest instance. + * @param \Okta\UserFactors\VerifyFactorRequest $verify The VerifyFactorRequest instance. * @return self */ public function setVerify(VerifyFactorRequest $verify) @@ -157,9 +121,9 @@ public function setVerify(VerifyFactorRequest $verify) /** * Get the profile. * - * @return \Okta\Contracts\FactorProfile + * @return \Okta\UserFactors\FactorProfile */ - public function getProfile(array $options = []): \Okta\Contracts\FactorProfile + public function getProfile(array $options = []): \Okta\UserFactors\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -171,10 +135,10 @@ public function getProfile(array $options = []): \Okta\Contracts\FactorProfile /** * Set the profile. * - * @param FactorProfile $profile The FactorProfile instance. + * @param \Okta\UserFactors\FactorProfile $profile The FactorProfile instance. * @return self */ - public function setProfile(\Okta\Contracts\FactorProfile $profile) + public function setProfile(\Okta\UserFactors\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/HardwareFactor.php b/src/Generated/UserFactors/HardwareFactor.php index dddc928ba1..0c425a88ce 100644 --- a/src/Generated/UserFactors/HardwareFactor.php +++ b/src/Generated/UserFactors/HardwareFactor.php @@ -25,9 +25,9 @@ class HardwareFactor extends \Okta\UserFactors\Factor /** * Get the profile. * - * @return \Okta\Contracts\FactorProfile + * @return \Okta\UserFactors\FactorProfile */ - public function getProfile(array $options = []): \Okta\Contracts\FactorProfile + public function getProfile(array $options = []): \Okta\UserFactors\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -39,10 +39,10 @@ public function getProfile(array $options = []): \Okta\Contracts\FactorProfile /** * Set the profile. * - * @param HardwareFactorProfile $profile The HardwareFactorProfile instance. + * @param \Okta\UserFactors\FactorProfile $profile The HardwareFactorProfile instance. * @return self */ - public function setProfile(\Okta\Contracts\FactorProfile $profile) + public function setProfile(\Okta\UserFactors\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/PushFactor.php b/src/Generated/UserFactors/PushFactor.php index f1ebb16497..65e52a8877 100644 --- a/src/Generated/UserFactors/PushFactor.php +++ b/src/Generated/UserFactors/PushFactor.php @@ -25,9 +25,9 @@ class PushFactor extends \Okta\UserFactors\Factor /** * Get the profile. * - * @return \Okta\Contracts\FactorProfile + * @return \Okta\UserFactors\FactorProfile */ - public function getProfile(array $options = []): \Okta\Contracts\FactorProfile + public function getProfile(array $options = []): \Okta\UserFactors\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -39,10 +39,10 @@ public function getProfile(array $options = []): \Okta\Contracts\FactorProfile /** * Set the profile. * - * @param PushFactorProfile $profile The PushFactorProfile instance. + * @param \Okta\UserFactors\FactorProfile $profile The PushFactorProfile instance. * @return self */ - public function setProfile(\Okta\Contracts\FactorProfile $profile) + public function setProfile(\Okta\UserFactors\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/PushFactorProfile.php b/src/Generated/UserFactors/PushFactorProfile.php index 757695018a..01998cd3d4 100644 --- a/src/Generated/UserFactors/PushFactorProfile.php +++ b/src/Generated/UserFactors/PushFactorProfile.php @@ -83,21 +83,6 @@ public function getPlatform(): string { return $this->getProperty(self::PLATFORM); } - /** - * Set the platform. - * - * @param mixed $platform The value to set. - * @return self - */ - public function setPlatform($platform) - { - $this->setProperty( - self::PLATFORM, - $platform - ); - - return $this; - } /** * Get the deviceType. * @@ -107,21 +92,6 @@ public function getDeviceType(): string { return $this->getProperty(self::DEVICE_TYPE); } - /** - * Set the deviceType. - * - * @param mixed $deviceType The value to set. - * @return self - */ - public function setDeviceType($deviceType) - { - $this->setProperty( - self::DEVICE_TYPE, - $deviceType - ); - - return $this; - } /** * Get the credentialId. * diff --git a/src/Generated/UserFactors/SecurityQuestionFactor.php b/src/Generated/UserFactors/SecurityQuestionFactor.php index f6adf63a96..53acad6e46 100644 --- a/src/Generated/UserFactors/SecurityQuestionFactor.php +++ b/src/Generated/UserFactors/SecurityQuestionFactor.php @@ -25,9 +25,9 @@ class SecurityQuestionFactor extends \Okta\UserFactors\Factor /** * Get the profile. * - * @return \Okta\Contracts\FactorProfile + * @return \Okta\UserFactors\FactorProfile */ - public function getProfile(array $options = []): \Okta\Contracts\FactorProfile + public function getProfile(array $options = []): \Okta\UserFactors\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -39,10 +39,10 @@ public function getProfile(array $options = []): \Okta\Contracts\FactorProfile /** * Set the profile. * - * @param SecurityQuestionFactorProfile $profile The SecurityQuestionFactorProfile instance. + * @param \Okta\UserFactors\FactorProfile $profile The SecurityQuestionFactorProfile instance. * @return self */ - public function setProfile(\Okta\Contracts\FactorProfile $profile) + public function setProfile(\Okta\UserFactors\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/SmsFactor.php b/src/Generated/UserFactors/SmsFactor.php index 8afe9f480b..3524bd0a63 100644 --- a/src/Generated/UserFactors/SmsFactor.php +++ b/src/Generated/UserFactors/SmsFactor.php @@ -25,9 +25,9 @@ class SmsFactor extends \Okta\UserFactors\Factor /** * Get the profile. * - * @return \Okta\Contracts\FactorProfile + * @return \Okta\UserFactors\FactorProfile */ - public function getProfile(array $options = []): \Okta\Contracts\FactorProfile + public function getProfile(array $options = []): \Okta\UserFactors\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -39,10 +39,10 @@ public function getProfile(array $options = []): \Okta\Contracts\FactorProfile /** * Set the profile. * - * @param SmsFactorProfile $profile The SmsFactorProfile instance. + * @param \Okta\UserFactors\FactorProfile $profile The SmsFactorProfile instance. * @return self */ - public function setProfile(\Okta\Contracts\FactorProfile $profile) + public function setProfile(\Okta\UserFactors\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/TokenFactor.php b/src/Generated/UserFactors/TokenFactor.php index 08305ac933..fd14c2940a 100644 --- a/src/Generated/UserFactors/TokenFactor.php +++ b/src/Generated/UserFactors/TokenFactor.php @@ -25,9 +25,9 @@ class TokenFactor extends \Okta\UserFactors\Factor /** * Get the profile. * - * @return \Okta\Contracts\FactorProfile + * @return \Okta\UserFactors\FactorProfile */ - public function getProfile(array $options = []): \Okta\Contracts\FactorProfile + public function getProfile(array $options = []): \Okta\UserFactors\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -39,10 +39,10 @@ public function getProfile(array $options = []): \Okta\Contracts\FactorProfile /** * Set the profile. * - * @param TokenFactorProfile $profile The TokenFactorProfile instance. + * @param \Okta\UserFactors\FactorProfile $profile The TokenFactorProfile instance. * @return self */ - public function setProfile(\Okta\Contracts\FactorProfile $profile) + public function setProfile(\Okta\UserFactors\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/TotpFactor.php b/src/Generated/UserFactors/TotpFactor.php index d893e19c0a..40c2644b0b 100644 --- a/src/Generated/UserFactors/TotpFactor.php +++ b/src/Generated/UserFactors/TotpFactor.php @@ -25,9 +25,9 @@ class TotpFactor extends \Okta\UserFactors\Factor /** * Get the profile. * - * @return \Okta\Contracts\FactorProfile + * @return \Okta\UserFactors\FactorProfile */ - public function getProfile(array $options = []): \Okta\Contracts\FactorProfile + public function getProfile(array $options = []): \Okta\UserFactors\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -39,10 +39,10 @@ public function getProfile(array $options = []): \Okta\Contracts\FactorProfile /** * Set the profile. * - * @param TotpFactorProfile $profile The TotpFactorProfile instance. + * @param \Okta\UserFactors\FactorProfile $profile The TotpFactorProfile instance. * @return self */ - public function setProfile(\Okta\Contracts\FactorProfile $profile) + public function setProfile(\Okta\UserFactors\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/UserFactors/VerifyFactorResponse.php b/src/Generated/UserFactors/VerifyFactorResponse.php index fa2e77af55..6339308749 100644 --- a/src/Generated/UserFactors/VerifyFactorResponse.php +++ b/src/Generated/UserFactors/VerifyFactorResponse.php @@ -47,11 +47,11 @@ public function getEmbedded(): \stdClass /** * Get the expiresAt. * - * @return string + * @return \Carbon\Carbon|null */ - public function getExpiresAt(): string + public function getExpiresAt() { - return $this->getProperty(self::EXPIRES_AT); + return $this->getDateProperty(self::EXPIRES_AT); } /** * Get the factorResult. diff --git a/src/Generated/UserFactors/WebFactor.php b/src/Generated/UserFactors/WebFactor.php index bc95a831b7..0d84986fc8 100644 --- a/src/Generated/UserFactors/WebFactor.php +++ b/src/Generated/UserFactors/WebFactor.php @@ -25,9 +25,9 @@ class WebFactor extends \Okta\UserFactors\Factor /** * Get the profile. * - * @return \Okta\Contracts\FactorProfile + * @return \Okta\UserFactors\FactorProfile */ - public function getProfile(array $options = []): \Okta\Contracts\FactorProfile + public function getProfile(array $options = []): \Okta\UserFactors\FactorProfile { return $this->getResourceProperty( self::PROFILE, @@ -39,10 +39,10 @@ public function getProfile(array $options = []): \Okta\Contracts\FactorProfile /** * Set the profile. * - * @param WebFactorProfile $profile The WebFactorProfile instance. + * @param \Okta\UserFactors\FactorProfile $profile The WebFactorProfile instance. * @return self */ - public function setProfile(\Okta\Contracts\FactorProfile $profile) + public function setProfile(\Okta\UserFactors\FactorProfile $profile) { $this->setResourceProperty( self::PROFILE, diff --git a/src/Generated/Users/ChangePasswordRequest.php b/src/Generated/Users/ChangePasswordRequest.php index 56d14b158f..1e03371d8d 100644 --- a/src/Generated/Users/ChangePasswordRequest.php +++ b/src/Generated/Users/ChangePasswordRequest.php @@ -40,7 +40,7 @@ public function getNewPassword(array $options = []): \Okta\Users\PasswordCredent /** * Set the newPassword. * - * @param PasswordCredential $newPassword The PasswordCredential instance. + * @param \Okta\Users\PasswordCredential $newPassword The PasswordCredential instance. * @return self */ public function setNewPassword(PasswordCredential $newPassword) @@ -69,7 +69,7 @@ public function getOldPassword(array $options = []): \Okta\Users\PasswordCredent /** * Set the oldPassword. * - * @param PasswordCredential $oldPassword The PasswordCredential instance. + * @param \Okta\Users\PasswordCredential $oldPassword The PasswordCredential instance. * @return self */ public function setOldPassword(PasswordCredential $oldPassword) diff --git a/src/Generated/Users/User.php b/src/Generated/Users/User.php index 5e20081386..3430c4c4a3 100644 --- a/src/Generated/Users/User.php +++ b/src/Generated/Users/User.php @@ -19,6 +19,7 @@ use Okta\Groups\Group; use Okta\UserFactors\Factor; +use Okta\UserFactors\SecurityQuestion; class User extends \Okta\Resource\AbstractResource { @@ -77,7 +78,6 @@ public function delete() $this ); } - /** * Get the id. * @@ -131,7 +131,7 @@ public function getProfile(array $options = []): \Okta\Users\UserProfile /** * Set the profile. * - * @param UserProfile $profile The UserProfile instance. + * @param \Okta\Users\UserProfile $profile The UserProfile instance. * @return self */ public function setProfile(UserProfile $profile) @@ -187,7 +187,7 @@ public function getCredentials(array $options = []): \Okta\Users\UserCredentials /** * Set the credentials. * - * @param UserCredentials $credentials The UserCredentials instance. + * @param \Okta\Users\UserCredentials $credentials The UserCredentials instance. * @return self */ public function setCredentials(UserCredentials $credentials) @@ -590,7 +590,7 @@ public function addToGroup($groupId) * * @return mixed|null */ - public function addFactor(Factor $factor, $templateId = '', $updatePhone = false) + public function addFactor(Factor $factor, $updatePhone = false) { $uri = "/api/v1/users/{$this->getId()}/factors"; $uri = $this->getDataStore()->buildUri( @@ -598,7 +598,7 @@ public function addFactor(Factor $factor, $templateId = '', $updatePhone = false ); return $this ->getDataStore() - ->executeRequest('POST', $uri, $factor, ['query' => ['templateId' => $templateId,'updatePhone' => $updatePhone]]); + ->executeRequest('POST', $uri, $factor, ['query' => ['updatePhone' => $updatePhone]]); } /** @@ -638,4 +638,59 @@ public function getFactors(array $options = []): \Okta\UserFactors\Collection $options ); } + + /** + * Get the SecurityQuestion object. + * + * @param array $options The options for the request. + * @return \Okta\UserFactors\SecurityQuestionsCollection + */ + public function getSupportedSecurityQuestions(array $options = []): \Okta\UserFactors\SecurityQuestionsCollection + { + + return $this + ->getDataStore() + ->getCollection( + "/api/v1/users/{$this->getId()}/factors/questions", + \Okta\UserFactors\SecurityQuestion::class, + \Okta\UserFactors\SecurityQuestionsCollection::class, + $options + ); + } + + /** + * Fetches a factor for the specified user + * + * + * @return mixed|null + */ + public function getFactor($factorId) + { + $uri = "/api/v1/users/{$this->getId()}/factors/{$factorId}"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + $response = $this + ->getDataStore() + ->getResource("factors/{$factorId}", \Okta\UserFactors\Factor::class, "/users/{$this->id}", []); + + return $response->convertFromGenericFactor(); + } + + /** + * Unenrolls an existing factor for the specified user, allowing the user to enroll a new factor. + * + * + * @return mixed|null + */ + public function deleteFactor($factorId) + { + $uri = "/api/v1/users/{$this->getId()}/factors/{$factorId}"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('DELETE', $uri); + } } diff --git a/src/Generated/Users/UserCredentials.php b/src/Generated/Users/UserCredentials.php index dcb893f5ab..929b33feac 100644 --- a/src/Generated/Users/UserCredentials.php +++ b/src/Generated/Users/UserCredentials.php @@ -41,7 +41,7 @@ public function getPassword(array $options = []): \Okta\Users\PasswordCredential /** * Set the password. * - * @param PasswordCredential $password The PasswordCredential instance. + * @param \Okta\Users\PasswordCredential $password The PasswordCredential instance. * @return self */ public function setPassword(PasswordCredential $password) @@ -70,7 +70,7 @@ public function getProvider(array $options = []): \Okta\Users\AuthenticationProv /** * Set the provider. * - * @param AuthenticationProvider $provider The AuthenticationProvider instance. + * @param \Okta\Users\AuthenticationProvider $provider The AuthenticationProvider instance. * @return self */ public function setProvider(AuthenticationProvider $provider) @@ -99,7 +99,7 @@ public function getRecoveryQuestion(array $options = []): \Okta\Users\RecoveryQu /** * Set the recovery_question. * - * @param RecoveryQuestionCredential $recovery_question The RecoveryQuestionCredential instance. + * @param \Okta\Users\RecoveryQuestionCredential $recovery_question The RecoveryQuestionCredential instance. * @return self */ public function setRecoveryQuestion(RecoveryQuestionCredential $recovery_question) diff --git a/src/Contracts/FactorProfile.php b/src/UserFactors/SecurityQuestionsCollection.php similarity index 90% rename from src/Contracts/FactorProfile.php rename to src/UserFactors/SecurityQuestionsCollection.php index aff98a1290..83ebc59673 100644 --- a/src/Contracts/FactorProfile.php +++ b/src/UserFactors/SecurityQuestionsCollection.php @@ -15,10 +15,11 @@ * limitations under the License. * ******************************************************************************/ -namespace Okta\Contracts; +namespace Okta\UserFactors; +use Okta\Resource\AbstractCollection; -interface FactorProfile +class SecurityQuestionsCollection extends AbstractCollection { -} \ No newline at end of file +} diff --git a/src/Users/User.php b/src/Users/User.php index 703672c104..6a8a19a698 100644 --- a/src/Users/User.php +++ b/src/Users/User.php @@ -41,9 +41,4 @@ public function getFactors(array $options = []): \Okta\UserFactors\Collection $supportedFactors[$key] = $factor->convertFromGenericFactor(); }); } - - public function getFactor($factorId) - { - return (new Factor())->get($this->getId(), $factorId, ""); - } } diff --git a/tests/BaseTestCase.php b/tests/BaseTestCase.php index 0b879dc083..a59eb8108f 100644 --- a/tests/BaseTestCase.php +++ b/tests/BaseTestCase.php @@ -65,7 +65,34 @@ protected function createNewUser($properties = []): \Okta\Users\User } return new \Okta\Users\User(null, $class); + } + + protected function createModel($model, $returnType, $properties = []) + { + + $properties = $this->getModel($model, $properties); + + $class = new \stdClass(); + foreach($properties as $prop=>$value) + { + $class->{$prop} = $value; + } + + return new $returnType(null, $class); + } + + protected function getModel($model, $overrides = []) + { + $defaults = []; + + if(is_readable($fileName = __DIR__ . "/models/{$model}")) { + $defaults = json_decode( + file_get_contents($fileName), + true + ); + } + return array_replace_recursive($defaults, $overrides); } } \ No newline at end of file diff --git a/tests/Integration/FactorsTest.php b/tests/Integration/FactorsTest.php index 6df2fe59ed..22f3180908 100644 --- a/tests/Integration/FactorsTest.php +++ b/tests/Integration/FactorsTest.php @@ -18,27 +18,6 @@ class FactorsTest extends BaseTestCase { - /** @test */ - public function can_get_a_factor_for_a_user() - { - $client = $this->createNewHttpClient([ - 'getBody' => file_get_contents(__DIR__ . '/../responses/factors/getFactor.json') - ]); - - - $factor = (new \Okta\UserFactors\Factor())->get('userId123', 'FactorId123', ""); - - $requests = $client->getRequests(); - - $this->assertEquals("/api/v1/users/userId123/factors/FactorId123/", $requests[0]->getUri()->getPath()); - - $this->assertInstanceOf(\Okta\UserFactors\SmsFactor::class, $factor); - $this->assertequals('application/json', $requests[0]->getHeaderLine('Accept')); - $this->assertEmpty($requests[0]->getHeaderLine('Content-Type')); - $this->assertEquals("SSWS {$this->token}", $requests[0]->getHeaderLine('Authorization')); - - } - /** @test */ public function a_user_should_be_able_to_get_a_factor_by_factor_id_only() { @@ -48,11 +27,10 @@ public function a_user_should_be_able_to_get_a_factor_by_factor_id_only() $user = $this->createnewUser(); $factor = $user->getFactor('FactorId123'); - $requests = $client->getRequests(); - $this->assertEquals("/api/v1/users/{$user->getId()}/factors/FactorId123/", $requests[0]->getUri()->getPath()); + $this->assertEquals("/api/v1/users/{$user->getId()}/factors/FactorId123", $requests[0]->getUri()->getPath()); $this->assertInstanceOf(\Okta\UserFactors\SmsFactor::class, $factor); $this->assertequals('application/json', $requests[0]->getHeaderLine('Accept')); diff --git a/tests/Unit/UserFactors/CallFactorProfileTest.php b/tests/Unit/UserFactors/CallFactorProfileTest.php new file mode 100644 index 0000000000..1fd4a02bb9 --- /dev/null +++ b/tests/Unit/UserFactors/CallFactorProfileTest.php @@ -0,0 +1,68 @@ +createNewHttpClient(); + $model = '/UserFactors/factorProfileCall.json'; + static::$properties = json_decode(json_encode($this->getModel($model))); + static::$testable = $this->createModel($model, \Okta\UserFactors\CallFactorProfile::class); + } + + /** @test */ + public function phone_number_is_gettable() + { + $this->assertEquals(static::$properties->phoneNumber, static::$testable->getPhoneNumber()); + $this->assertEquals(static::$properties->phoneNumber, static::$testable->phoneNumber); + } + + /** @test */ + public function phone_number_is_settable() + { + static::$testable->setPhoneNumber('5555551212'); + static::assertEquals('5555551212', static::$testable->getPhoneNumber()); + + static::$testable->phoneNumber = '5551112222'; + static::assertEquals('5551112222', static::$testable->getPhoneNumber()); + } + + /** @test */ + public function extension_is_gettable() + { + $this->assertEquals(static::$properties->phoneExtension, static::$testable->getPhoneExtension()); + $this->assertEquals(static::$properties->phoneExtension, static::$testable->phoneExtension); + } + + /** @test */ + public function extension_is_settable() + { + static::$testable->setPhoneExtension('123'); + static::assertEquals('123', static::$testable->getPhoneExtension()); + + static::$testable->phoneExtension = '789'; + static::assertEquals('789', static::$testable->getPhoneExtension()); + } + + +} diff --git a/tests/Unit/UserFactors/CallFactorTest.php b/tests/Unit/UserFactors/CallFactorTest.php new file mode 100644 index 0000000000..dc881f77d6 --- /dev/null +++ b/tests/Unit/UserFactors/CallFactorTest.php @@ -0,0 +1,63 @@ +build(); + + static::$properties = json_decode(file_get_contents(__DIR__ . '/../../models/UserFactors/callFactor.json')); + + $class = new \stdClass(); + foreach(static::$properties as $prop=>$value) + { + $class->{$prop} = $value; + } + self::$testable = new \Okta\UserFactors\CallFactor(null, $class); + } + + /** @test */ + public function can_get_profile_from_factor() + { + $profile = self::$testable->getProfile(); + + $this->assertInstanceOf(\Okta\UserFactors\CallFactorProfile::class, $profile); + + } + + /** @test */ + public function a_profile_can_be_set_on_the_factor() + { + /** @var \Okta\UserFactors\SecurityQuestionFactorProfile $profile */ + $profile = static::$testable->getProfile(); + $profile->setAnswer = 'Test'; + + $factor = static::$testable->setProfile($profile); + $this->assertInstanceOf(\Okta\UserFactors\CallFactor::class, $factor); + } + + +} diff --git a/tests/Unit/UserFactors/EmailFactorProfileTest.php b/tests/Unit/UserFactors/EmailFactorProfileTest.php new file mode 100644 index 0000000000..688cdf61df --- /dev/null +++ b/tests/Unit/UserFactors/EmailFactorProfileTest.php @@ -0,0 +1,50 @@ +createNewHttpClient(); + $model = '/UserFactors/factorProfileEmail.json'; + static::$properties = json_decode(json_encode($this->getModel($model))); + static::$testable = $this->createModel($model, \Okta\UserFactors\EmailFactorProfile::class); + } + + /** @test */ + public function email_is_gettable() + { + $this->assertEquals(static::$properties->email, static::$testable->getEmail()); + $this->assertEquals(static::$properties->email, static::$testable->email); + } + + /** @test */ + public function email_is_settable() + { + static::$testable->setEmail('test@mailinator.com'); + static::assertEquals('test@mailinator.com', static::$testable->getEmail()); + + static::$testable->email = 'test2@mailinator.com'; + static::assertEquals('test2@mailinator.com', static::$testable->getEmail()); + } + +} diff --git a/tests/Unit/UserFactors/EmailFactorTest.php b/tests/Unit/UserFactors/EmailFactorTest.php new file mode 100644 index 0000000000..5aa9a0f7ad --- /dev/null +++ b/tests/Unit/UserFactors/EmailFactorTest.php @@ -0,0 +1,63 @@ +build(); + + static::$properties = json_decode(file_get_contents(__DIR__ . '/../../models/UserFactors/emailFactor.json')); + + $class = new \stdClass(); + foreach(static::$properties as $prop=>$value) + { + $class->{$prop} = $value; + } + self::$testable = new \Okta\UserFactors\EmailFactor(null, $class); + } + + /** @test */ + public function can_get_profile_from_factor() + { + $profile = self::$testable->getProfile(); + + $this->assertInstanceOf(\Okta\UserFactors\EmailFactorProfile::class, $profile); + + } + + /** @test */ + public function a_profile_can_be_set_on_the_factor() + { + /** @var \Okta\UserFactors\SecurityQuestionFactorProfile $profile */ + $profile = static::$testable->getProfile(); + $profile->setAnswer = 'Test'; + + $factor = static::$testable->setProfile($profile); + $this->assertInstanceOf(\Okta\UserFactors\EmailFactor::class, $factor); + } + + +} diff --git a/tests/Unit/UserFactors/FactorTest.php b/tests/Unit/UserFactors/FactorTest.php new file mode 100644 index 0000000000..5b35081c62 --- /dev/null +++ b/tests/Unit/UserFactors/FactorTest.php @@ -0,0 +1,54 @@ +createNewHttpClient(); + $model = '/UserFactors/emailFactor.json'; + static::$properties = json_decode(json_encode($this->getModel($model))); + static::$testable = $this->createModel($model, \Okta\UserFactors\Factor::class); + } + + /** @test */ + public function id_is_accessible() + { + $this->assertEquals(static::$properties->id, static::$testable->getId()); + $this->assertEquals(static::$properties->id, static::$testable->id); + } + + /** @test */ + public function device_is_accessible() + { + $this->assertEquals(static::$properties->device, static::$testable->getDevice()); + $this->assertEquals(static::$properties->device, static::$testable->device); + } + + + + + + +} diff --git a/tests/Unit/UserFactors/HardwareFactorProfileTest.php b/tests/Unit/UserFactors/HardwareFactorProfileTest.php new file mode 100644 index 0000000000..2725a23e5b --- /dev/null +++ b/tests/Unit/UserFactors/HardwareFactorProfileTest.php @@ -0,0 +1,50 @@ +createNewHttpClient(); + $model = '/UserFactors/factorProfileHardware.json'; + static::$properties = json_decode(json_encode($this->getModel($model))); + static::$testable = $this->createModel($model, \Okta\UserFactors\HardwareFactorProfile::class); + } + + /** @test */ + public function credential_id_is_gettable() + { + $this->assertEquals(static::$properties->credentialId, static::$testable->getCredentialId()); + $this->assertEquals(static::$properties->credentialId, static::$testable->credentialId); + } + + /** @test */ + public function credential_id_is_settable() + { + static::$testable->setCredentialId('test@mailinator.com'); + static::assertEquals('test@mailinator.com', static::$testable->getCredentialId()); + + static::$testable->credentialId = 'test2@mailinator.com'; + static::assertEquals('test2@mailinator.com', static::$testable->getCredentialId()); + } + +} diff --git a/tests/Unit/UserFactors/HardwareFactorTest.php b/tests/Unit/UserFactors/HardwareFactorTest.php new file mode 100644 index 0000000000..72434d16f2 --- /dev/null +++ b/tests/Unit/UserFactors/HardwareFactorTest.php @@ -0,0 +1,63 @@ +build(); + + static::$properties = json_decode(file_get_contents(__DIR__ . '/../../models/UserFactors/hardwareFactor.json')); + + $class = new \stdClass(); + foreach(static::$properties as $prop=>$value) + { + $class->{$prop} = $value; + } + self::$testable = new \Okta\UserFactors\HardwareFactor(null, $class); + } + + /** @test */ + public function can_get_profile_from_factor() + { + $profile = self::$testable->getProfile(); + + $this->assertInstanceOf(\Okta\UserFactors\HardwareFactorProfile::class, $profile); + + } + + /** @test */ + public function a_profile_can_be_set_on_the_factor() + { + /** @var \Okta\UserFactors\SecurityQuestionFactorProfile $profile */ + $profile = static::$testable->getProfile(); + $profile->setAnswer = 'Test'; + + $factor = static::$testable->setProfile($profile); + $this->assertInstanceOf(\Okta\UserFactors\HardwareFactor::class, $factor); + } + + +} diff --git a/tests/Unit/UserFactors/PushFactorProfileTest.php b/tests/Unit/UserFactors/PushFactorProfileTest.php new file mode 100644 index 0000000000..fb99f8f564 --- /dev/null +++ b/tests/Unit/UserFactors/PushFactorProfileTest.php @@ -0,0 +1,99 @@ +createNewHttpClient(); + $model = '/UserFactors/factorProfilePush.json'; + static::$properties = json_decode(json_encode($this->getModel($model))); + static::$testable = $this->createModel($model, \Okta\UserFactors\PushFactorProfile::class); + } + + /** @test */ + public function name_is_gettable() + { + $this->assertEquals(static::$properties->name, static::$testable->getName()); + $this->assertEquals(static::$properties->name, static::$testable->name); + } + + /** @test */ + public function name_is_settable() + { + static::$testable->setName('some name'); + static::assertEquals('some name', static::$testable->getName()); + + static::$testable->name = 'some name 2'; + static::assertEquals('some name 2', static::$testable->getName()); + } + + /** @test */ + public function version_is_gettable() + { + $this->assertEquals(static::$properties->version, static::$testable->getVersion()); + $this->assertEquals(static::$properties->version, static::$testable->version); + } + + /** @test */ + public function version_is_settable() + { + static::$testable->setVersion('some version'); + static::assertEquals('some version', static::$testable->getVersion()); + + static::$testable->version = 'some version 2'; + static::assertEquals('some version 2', static::$testable->getVersion()); + } + + /** @test */ + public function platform_is_gettable() + { + $this->assertEquals(static::$properties->platform, static::$testable->getPlatform()); + $this->assertEquals(static::$properties->platform, static::$testable->platform); + } + + /** @test */ + public function device_type_is_accessible() + { + $this->assertEquals(static::$properties->deviceType, static::$testable->getDeviceType()); + $this->assertEquals(static::$properties->deviceType, static::$testable->deviceType); + } + + /** @test */ + public function credential_id_is_accessible() + { + $this->assertEquals(static::$properties->credentialId, static::$testable->getCredentialId()); + $this->assertEquals(static::$properties->credentialId, static::$testable->credentialId); + } + + /** @test */ + public function credential_id_is_settable() + { + static::$testable->setCredentialId('test@mailinator.com'); + static::assertEquals('test@mailinator.com', static::$testable->getCredentialId()); + + static::$testable->credentialId = 'test2@mailinator.com'; + static::assertEquals('test2@mailinator.com', static::$testable->getCredentialId()); + } + + +} diff --git a/tests/Unit/UserFactors/PushFactorTest.php b/tests/Unit/UserFactors/PushFactorTest.php new file mode 100644 index 0000000000..76999c643a --- /dev/null +++ b/tests/Unit/UserFactors/PushFactorTest.php @@ -0,0 +1,63 @@ +build(); + + static::$properties = json_decode(file_get_contents(__DIR__ . '/../../models/UserFactors/pushFactor.json')); + + $class = new \stdClass(); + foreach(static::$properties as $prop=>$value) + { + $class->{$prop} = $value; + } + self::$testable = new \Okta\UserFactors\PushFactor(null, $class); + } + + /** @test */ + public function can_get_profile_from_factor() + { + $profile = self::$testable->getProfile(); + + $this->assertInstanceOf(\Okta\UserFactors\PushFactorProfile::class, $profile); + + } + + /** @test */ + public function a_profile_can_be_set_on_the_factor() + { + /** @var \Okta\UserFactors\SecurityQuestionFactorProfile $profile */ + $profile = static::$testable->getProfile(); + $profile->setAnswer = 'Test'; + + $factor = static::$testable->setProfile($profile); + $this->assertInstanceOf(\Okta\UserFactors\PushFactor::class, $factor); + } + + +} diff --git a/tests/Unit/UserFactors/SecurityQuestionFactorProfileTest.php b/tests/Unit/UserFactors/SecurityQuestionFactorProfileTest.php new file mode 100644 index 0000000000..95f54152e1 --- /dev/null +++ b/tests/Unit/UserFactors/SecurityQuestionFactorProfileTest.php @@ -0,0 +1,84 @@ +createNewHttpClient(); + $model = '/UserFactors/factorProfileQuestion.json'; + static::$properties = json_decode(json_encode($this->getModel($model))); + static::$testable = $this->createModel($model, \Okta\UserFactors\SecurityQuestionFactorProfile::class); + } + + /** @test */ + public function answer_is_accessible() + { + $this->assertEquals(static::$properties->answer, static::$testable->getAnswer()); + $this->assertEquals(static::$properties->answer, static::$testable->answer); + } + + /** @test */ + public function answer_is_settable() + { + static::$testable->setAnswer('My Answer'); + static::assertEquals('My Answer', static::$testable->getAnswer()); + + static::$testable->answer = 'Custom Answer'; + static::assertEquals('Custom Answer', static::$testable->getAnswer()); + } + + /** @test */ + public function question_is_accessible() + { + $this->assertEquals(static::$properties->question, static::$testable->getQuestion()); + $this->assertEquals(static::$properties->question, static::$testable->question); + } + + /** @test */ + public function question_is_settable() + { + static::$testable->setQuestion('my_question'); + static::assertEquals('my_question', static::$testable->getQuestion()); + + static::$testable->question = 'custom_question'; + static::assertEquals('custom_question', static::$testable->getQuestion()); + } + + /** @test */ + public function question_text_is_accessible() + { + $this->assertEquals(static::$properties->questionText, static::$testable->getQuestionText()); + $this->assertEquals(static::$properties->questionText, static::$testable->questionText); + } + + /** @test */ + public function question_text_is_settable() + { + static::$testable->setQuestionText('My Answer'); + static::assertEquals('My Answer', static::$testable->getQuestionText()); + + static::$testable->questionText = "Custom Answer"; + static::assertEquals("Custom Answer", static::$testable->getQuestionText()); + } + +} diff --git a/tests/Unit/UserFactors/SecurityQuestionFactorTest.php b/tests/Unit/UserFactors/SecurityQuestionFactorTest.php new file mode 100644 index 0000000000..ca52df4625 --- /dev/null +++ b/tests/Unit/UserFactors/SecurityQuestionFactorTest.php @@ -0,0 +1,63 @@ +build(); + + static::$properties = json_decode(file_get_contents(__DIR__ . '/../../models/UserFactors/securityQuestionFactor.json')); + + $class = new \stdClass(); + foreach(static::$properties as $prop=>$value) + { + $class->{$prop} = $value; + } + self::$testable = new \Okta\UserFactors\SecurityQuestionFactor(null, $class); + } + + /** @test */ + public function can_get_profile_from_factor() + { + $profile = self::$testable->getProfile(); + + $this->assertInstanceOf(\Okta\UserFactors\SecurityQuestionFactorProfile::class, $profile); + + } + + /** @test */ + public function a_profile_can_be_set_on_the_factor() + { + /** @var \Okta\UserFactors\SecurityQuestionFactorProfile $profile */ + $profile = static::$testable->getProfile(); + $profile->setAnswer = 'Test'; + + $factor = static::$testable->setProfile($profile); + $this->assertInstanceOf(\Okta\UserFactors\SecurityQuestionFactor::class, $factor); + } + + +} diff --git a/tests/Unit/UserFactors/TokenFactorProfileTest.php b/tests/Unit/UserFactors/TokenFactorProfileTest.php new file mode 100644 index 0000000000..c925339233 --- /dev/null +++ b/tests/Unit/UserFactors/TokenFactorProfileTest.php @@ -0,0 +1,50 @@ +createNewHttpClient(); + $model = '/UserFactors/factorProfileToken.json'; + static::$properties = json_decode(json_encode($this->getModel($model))); + static::$testable = $this->createModel($model, \Okta\UserFactors\TokenFactorProfile::class); + } + + /** @test */ + public function credential_id_is_gettable() + { + $this->assertEquals(static::$properties->credentialId, static::$testable->getCredentialId()); + $this->assertEquals(static::$properties->credentialId, static::$testable->credentialId); + } + + /** @test */ + public function credential_id_is_settable() + { + static::$testable->setCredentialId('test@mailinator.com'); + static::assertEquals('test@mailinator.com', static::$testable->getCredentialId()); + + static::$testable->credentialId = 'test2@mailinator.com'; + static::assertEquals('test2@mailinator.com', static::$testable->getCredentialId()); + } + +} diff --git a/tests/Unit/UserFactors/TokenFactorTest.php b/tests/Unit/UserFactors/TokenFactorTest.php new file mode 100644 index 0000000000..1b2bae74dc --- /dev/null +++ b/tests/Unit/UserFactors/TokenFactorTest.php @@ -0,0 +1,63 @@ +build(); + + static::$properties = json_decode(file_get_contents(__DIR__ . '/../../models/UserFactors/pushFactor.json')); + + $class = new \stdClass(); + foreach(static::$properties as $prop=>$value) + { + $class->{$prop} = $value; + } + self::$testable = new \Okta\UserFactors\TokenFactor(null, $class); + } + + /** @test */ + public function can_get_profile_from_factor() + { + $profile = self::$testable->getProfile(); + + $this->assertInstanceOf(\Okta\UserFactors\TokenFactorProfile::class, $profile); + + } + + /** @test */ + public function a_profile_can_be_set_on_the_factor() + { + /** @var \Okta\UserFactors\SecurityQuestionFactorProfile $profile */ + $profile = static::$testable->getProfile(); + $profile->setAnswer = 'Test'; + + $factor = static::$testable->setProfile($profile); + $this->assertInstanceOf(\Okta\UserFactors\TokenFactor::class, $factor); + } + + +} diff --git a/tests/Unit/UserFactors/TotpFactorProfileTest.php b/tests/Unit/UserFactors/TotpFactorProfileTest.php new file mode 100644 index 0000000000..c1a693ed59 --- /dev/null +++ b/tests/Unit/UserFactors/TotpFactorProfileTest.php @@ -0,0 +1,50 @@ +createNewHttpClient(); + $model = '/UserFactors/factorProfileTotp.json'; + static::$properties = json_decode(json_encode($this->getModel($model))); + static::$testable = $this->createModel($model, \Okta\UserFactors\TotpFactorProfile::class); + } + + /** @test */ + public function credential_id_is_gettable() + { + $this->assertEquals(static::$properties->credentialId, static::$testable->getCredentialId()); + $this->assertEquals(static::$properties->credentialId, static::$testable->credentialId); + } + + /** @test */ + public function credential_id_is_settable() + { + static::$testable->setCredentialId('test@mailinator.com'); + static::assertEquals('test@mailinator.com', static::$testable->getCredentialId()); + + static::$testable->credentialId = 'test2@mailinator.com'; + static::assertEquals('test2@mailinator.com', static::$testable->getCredentialId()); + } + +} diff --git a/tests/Unit/UserFactors/TotpFactorTest.php b/tests/Unit/UserFactors/TotpFactorTest.php new file mode 100644 index 0000000000..3eef9ae986 --- /dev/null +++ b/tests/Unit/UserFactors/TotpFactorTest.php @@ -0,0 +1,63 @@ +build(); + + static::$properties = json_decode(file_get_contents(__DIR__ . '/../../models/UserFactors/totpFactor.json')); + + $class = new \stdClass(); + foreach(static::$properties as $prop=>$value) + { + $class->{$prop} = $value; + } + self::$testable = new \Okta\UserFactors\TotpFactor(null, $class); + } + + /** @test */ + public function can_get_profile_from_factor() + { + $profile = self::$testable->getProfile(); + + $this->assertInstanceOf(\Okta\UserFactors\TotpFactorProfile::class, $profile); + + } + + /** @test */ + public function a_profile_can_be_set_on_the_factor() + { + /** @var \Okta\UserFactors\SecurityQuestionFactorProfile $profile */ + $profile = static::$testable->getProfile(); + $profile->setAnswer = 'Test'; + + $factor = static::$testable->setProfile($profile); + $this->assertInstanceOf(\Okta\UserFactors\TotpFactor::class, $factor); + } + + +} diff --git a/tests/Unit/UserFactors/WebFactorProfileTest.php b/tests/Unit/UserFactors/WebFactorProfileTest.php new file mode 100644 index 0000000000..d202e994c4 --- /dev/null +++ b/tests/Unit/UserFactors/WebFactorProfileTest.php @@ -0,0 +1,50 @@ +createNewHttpClient(); + $model = '/UserFactors/factorProfileWeb.json'; + static::$properties = json_decode(json_encode($this->getModel($model))); + static::$testable = $this->createModel($model, \Okta\UserFactors\WebFactorProfile::class); + } + + /** @test */ + public function credential_id_is_gettable() + { + $this->assertEquals(static::$properties->credentialId, static::$testable->getCredentialId()); + $this->assertEquals(static::$properties->credentialId, static::$testable->credentialId); + } + + /** @test */ + public function credential_id_is_settable() + { + static::$testable->setCredentialId('test@mailinator.com'); + static::assertEquals('test@mailinator.com', static::$testable->getCredentialId()); + + static::$testable->credentialId = 'test2@mailinator.com'; + static::assertEquals('test2@mailinator.com', static::$testable->getCredentialId()); + } + +} diff --git a/tests/Unit/UserFactors/WebFactorTest.php b/tests/Unit/UserFactors/WebFactorTest.php new file mode 100644 index 0000000000..e7a1a4173e --- /dev/null +++ b/tests/Unit/UserFactors/WebFactorTest.php @@ -0,0 +1,63 @@ +build(); + + static::$properties = json_decode(file_get_contents(__DIR__ . '/../../models/UserFactors/webFactor.json')); + + $class = new \stdClass(); + foreach(static::$properties as $prop=>$value) + { + $class->{$prop} = $value; + } + self::$testable = new \Okta\UserFactors\WebFactor(null, $class); + } + + /** @test */ + public function can_get_profile_from_factor() + { + $profile = self::$testable->getProfile(); + + $this->assertInstanceOf(\Okta\UserFactors\WebFactorProfile::class, $profile); + + } + + /** @test */ + public function a_profile_can_be_set_on_the_factor() + { + /** @var \Okta\UserFactors\SecurityQuestionFactorProfile $profile */ + $profile = static::$testable->getProfile(); + $profile->setAnswer = 'Test'; + + $factor = static::$testable->setProfile($profile); + $this->assertInstanceOf(\Okta\UserFactors\WebFactor::class, $factor); + } + + +} diff --git a/tests/Unit/Users/UserTest.php b/tests/Unit/Users/UserTest.php index bb79ba7138..cf4d426e73 100644 --- a/tests/Unit/Users/UserTest.php +++ b/tests/Unit/Users/UserTest.php @@ -20,7 +20,7 @@ use Okta\Users\User; use PHPUnit\Framework\TestCase; -class UserTest extends TestCase +class UserTest extends BaseTestCase { protected static $properties; /** @var User */ @@ -235,9 +235,6 @@ public function credentials_is_settable() } - - - /** @test */ public function profile_is_settable() { @@ -253,7 +250,6 @@ public function profile_is_settable() static::assertEquals('Test', static::$testable->profile->firstName); } - /** @test */ public function get_app_links_requests_correct_location() { @@ -869,49 +865,36 @@ public function getting_factors_makes_request_to_correct_endpoint() ); } + /** @test */ + public function can_get_supported_security_questions() + { + $httpClient = $this->createNewHttpClient([ + 'getBody' => $this->getModel('UserFactors/supportedSecurityQuestions.json') + ]); + $user = $this->createNewUser(); + $securityQuestions = $user->getSupportedSecurityQuestions(); - - /** - * @return User - */ - private function createNewUser(): User - { - $class = new \stdClass(); - foreach (static::$properties as $prop => $value) { - $class->{$prop} = $value; - } - return new User(NULL, $class); + $this->assertInstanceOf(\Okta\UserFactors\SecurityQuestionsCollection::class, $securityQuestions); } - /** - * @param array $returns - * - * @return \Http\Mock\Client - */ - private function createNewHttpClient($returns = []): \Http\Mock\Client + /** @test */ + public function deleting_a_factor_requests_correct_endpoint() { - $defaults = [ - 'getStatusCode' => 200, - 'getBody' => '{}' - ]; + $httpClient = $this->createNewHttpClient(); + $user = $this->createNewUser(); - $mockReturns = array_replace_recursive($defaults, $returns); + $user->deleteFactor('FactorId'); - $response = $this->createMock('Psr\Http\Message\ResponseInterface'); - foreach($mockReturns as $method=>$return) { - $response->method($method)->willReturn($return); - } - $httpClient = new \Http\Mock\Client; - $httpClient->addResponse($response); - - (new \Okta\ClientBuilder()) - ->setOrganizationUrl('https://dev.okta.com') - ->setToken('abc123') - ->setHttpClient($httpClient) - ->build(); - return $httpClient; + $request = $httpClient->getRequests(); + + $this->assertEquals('DELETE', $request[0]->getMethod()); + + $this->assertEquals( + "/api/v1/users/{$user->getId()}/factors/FactorId", + $request[0]->getUri()->getPath() + ); } diff --git a/tests/models/UserFactors/callFactor.json b/tests/models/UserFactors/callFactor.json new file mode 100644 index 0000000000..ccca649a1e --- /dev/null +++ b/tests/models/UserFactors/callFactor.json @@ -0,0 +1,38 @@ +{ + "id": "callk33ujQ59REImFX0g3", + "factorType": "call", + "provider": "OKTA", + "status": "ACTIVE", + "created": "2015-02-04T07:07:25.000Z", + "lastUpdated": "2015-02-04T07:07:25.000Z", + "profile": { + "phoneNumber": "+1415551337" + }, + "_links": { + "verify": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/smsk33ujQ59REImFX0g3/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/smsk33ujQ59REImFX0g3", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/models/UserFactors/emailFactor.json b/tests/models/UserFactors/emailFactor.json new file mode 100644 index 0000000000..1db3ed2b2b --- /dev/null +++ b/tests/models/UserFactors/emailFactor.json @@ -0,0 +1,38 @@ +{ + "id": "emailk33ujQ59REImFX0g3", + "factorType": "email", + "provider": "OKTA", + "status": "ACTIVE", + "created": "2015-02-04T07:07:25.000Z", + "lastUpdated": "2015-02-04T07:07:25.000Z", + "profile": { + "phoneNumber": "+1415551337" + }, + "_links": { + "verify": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/smsk33ujQ59REImFX0g3/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/smsk33ujQ59REImFX0g3", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/models/UserFactors/factorProfileCall.json b/tests/models/UserFactors/factorProfileCall.json new file mode 100644 index 0000000000..d555f53042 --- /dev/null +++ b/tests/models/UserFactors/factorProfileCall.json @@ -0,0 +1,4 @@ +{ + "phoneNumber": "+1-555-415-1337", + "phoneExtension": "1234" +} \ No newline at end of file diff --git a/tests/models/UserFactors/factorProfileEmail.json b/tests/models/UserFactors/factorProfileEmail.json new file mode 100644 index 0000000000..d7f0097ca9 --- /dev/null +++ b/tests/models/UserFactors/factorProfileEmail.json @@ -0,0 +1,3 @@ +{ + "email": "alice@okta.com" +} \ No newline at end of file diff --git a/tests/models/UserFactors/factorProfileHardware.json b/tests/models/UserFactors/factorProfileHardware.json new file mode 100644 index 0000000000..9dad7b16f4 --- /dev/null +++ b/tests/models/UserFactors/factorProfileHardware.json @@ -0,0 +1,3 @@ +{ + "credentialId": "dade.murphy@example.com" +} \ No newline at end of file diff --git a/tests/models/UserFactors/factorProfilePush.json b/tests/models/UserFactors/factorProfilePush.json new file mode 100644 index 0000000000..f490e4090d --- /dev/null +++ b/tests/models/UserFactors/factorProfilePush.json @@ -0,0 +1,7 @@ +{ + "name": "name", + "version": "0.1.0", + "platform": "android", + "deviceType": "mobile", + "credentialId": "test@mailinator.com" +} \ No newline at end of file diff --git a/tests/models/UserFactors/factorProfileQuestion.json b/tests/models/UserFactors/factorProfileQuestion.json new file mode 100644 index 0000000000..4a19e8ce09 --- /dev/null +++ b/tests/models/UserFactors/factorProfileQuestion.json @@ -0,0 +1,5 @@ +{ + "question": "favorite_art_piece", + "questionText": "What is your favorite piece of art?", + "answer": "A Painting" +} \ No newline at end of file diff --git a/tests/models/UserFactors/factorProfileSms.json b/tests/models/UserFactors/factorProfileSms.json new file mode 100644 index 0000000000..a0bcdedfbc --- /dev/null +++ b/tests/models/UserFactors/factorProfileSms.json @@ -0,0 +1,3 @@ +{ + "phoneNumber": "+1-555-415-1337" +} \ No newline at end of file diff --git a/tests/models/UserFactors/factorProfileToken.json b/tests/models/UserFactors/factorProfileToken.json new file mode 100644 index 0000000000..9dad7b16f4 --- /dev/null +++ b/tests/models/UserFactors/factorProfileToken.json @@ -0,0 +1,3 @@ +{ + "credentialId": "dade.murphy@example.com" +} \ No newline at end of file diff --git a/tests/models/UserFactors/factorProfileTotp.json b/tests/models/UserFactors/factorProfileTotp.json new file mode 100644 index 0000000000..9dad7b16f4 --- /dev/null +++ b/tests/models/UserFactors/factorProfileTotp.json @@ -0,0 +1,3 @@ +{ + "credentialId": "dade.murphy@example.com" +} \ No newline at end of file diff --git a/tests/models/UserFactors/factorProfileWeb.json b/tests/models/UserFactors/factorProfileWeb.json new file mode 100644 index 0000000000..9dad7b16f4 --- /dev/null +++ b/tests/models/UserFactors/factorProfileWeb.json @@ -0,0 +1,3 @@ +{ + "credentialId": "dade.murphy@example.com" +} \ No newline at end of file diff --git a/tests/models/UserFactors/hardwareFactor.json b/tests/models/UserFactors/hardwareFactor.json new file mode 100644 index 0000000000..c7e0665445 --- /dev/null +++ b/tests/models/UserFactors/hardwareFactor.json @@ -0,0 +1,38 @@ +{ + "id": "emailk33ujQ59REImFX0g3", + "factorType": "toke:hardware", + "provider": "OKTA", + "status": "ACTIVE", + "created": "2015-02-04T07:07:25.000Z", + "lastUpdated": "2015-02-04T07:07:25.000Z", + "profile": { + "phoneNumber": "+1415551337" + }, + "_links": { + "verify": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/smsk33ujQ59REImFX0g3/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/smsk33ujQ59REImFX0g3", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/models/UserFactors/pushFactor.json b/tests/models/UserFactors/pushFactor.json new file mode 100644 index 0000000000..453ae10214 --- /dev/null +++ b/tests/models/UserFactors/pushFactor.json @@ -0,0 +1,38 @@ +{ + "id": "emailk33ujQ59REImFX0g3", + "factorType": "push", + "provider": "OKTA", + "status": "ACTIVE", + "created": "2015-02-04T07:07:25.000Z", + "lastUpdated": "2015-02-04T07:07:25.000Z", + "profile": { + "phoneNumber": "+1415551337" + }, + "_links": { + "verify": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/smsk33ujQ59REImFX0g3/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/smsk33ujQ59REImFX0g3", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/models/UserFactors/securityQuestionFactor.json b/tests/models/UserFactors/securityQuestionFactor.json new file mode 100644 index 0000000000..59561556bd --- /dev/null +++ b/tests/models/UserFactors/securityQuestionFactor.json @@ -0,0 +1,40 @@ +{ + "id": "ufsccnueckzN5iZnB0h7", + "factorType": "question", + "provider": "OKTA", + "vendorName": "OKTA", + "status": "ACTIVE", + "created": "2017-10-09T19:05:49.000Z", + "lastUpdated": "2017-10-09T19:05:49.000Z", + "profile": { + "question": "disliked_food", + "questionText": "What is the food you least liked as a child?" + }, + "_links": { + "questions": { + "href": "https://php.oktapreview.com/api/v1/users/00uccnufyyMLjWO7V0h7/factors/questions", + "hints": { + "allow": [ + "GET" + ] + } + }, + "self": { + "href": "https://php.oktapreview.com/api/v1/users/00uccnufyyMLjWO7V0h7/factors/ufsccnueckzN5iZnB0h7", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://php.oktapreview.com/api/v1/users/00uccnufyyMLjWO7V0h7", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/models/UserFactors/supportedSecurityQuestions.json b/tests/models/UserFactors/supportedSecurityQuestions.json new file mode 100644 index 0000000000..5ecbac91de --- /dev/null +++ b/tests/models/UserFactors/supportedSecurityQuestions.json @@ -0,0 +1,78 @@ +[ + { + "question": "disliked_food", + "questionText": "What is the food you least liked as a child?" + }, + { + "question": "name_of_first_plush_toy", + "questionText": "What is the name of your first stuffed animal?" + }, + { + "question": "first_award", + "questionText": "What did you earn your first medal or award for?" + }, + { + "question": "favorite_security_question", + "questionText": "What is your favorite security question?" + }, + { + "question": "favorite_toy", + "questionText": "What is the toy/stuffed animal you liked the most as a kid?" + }, + { + "question": "first_computer_game", + "questionText": "What was the first computer game you played?" + }, + { + "question": "favorite_movie_quote", + "questionText": "What is your favorite movie quote?" + }, + { + "question": "first_sports_team_mascot", + "questionText": "What was the mascot of the first sports team you played on?" + }, + { + "question": "first_music_purchase", + "questionText": "What music album or song did you first purchase?" + }, + { + "question": "favorite_art_piece", + "questionText": "What is your favorite piece of art?" + }, + { + "question": "grandmother_favorite_desert", + "questionText": "What was your grandmother's favorite dessert?" + }, + { + "question": "first_thing_cooked", + "questionText": "What was the first thing you learned to cook?" + }, + { + "question": "childhood_dream_job", + "questionText": "What was your dream job as a child?" + }, + { + "question": "place_where_significant_other_was_met", + "questionText": "Where did you meet your spouse/significant other?" + }, + { + "question": "favorite_vacation_location", + "questionText": "Where did you go for your favorite vacation?" + }, + { + "question": "new_years_two_thousand", + "questionText": "Where were you on New Year's Eve in the year 2000?" + }, + { + "question": "favorite_speaker_actor", + "questionText": "Who is your favorite speaker/orator?" + }, + { + "question": "favorite_book_movie_character", + "questionText": "Who is your favorite book/movie character?" + }, + { + "question": "favorite_sports_player", + "questionText": "Who is your favorite sports player?" + } +] \ No newline at end of file diff --git a/tests/models/UserFactors/tokenFactor.json b/tests/models/UserFactors/tokenFactor.json new file mode 100644 index 0000000000..8b0b6c86e7 --- /dev/null +++ b/tests/models/UserFactors/tokenFactor.json @@ -0,0 +1,38 @@ +{ + "id": "emailk33ujQ59REImFX0g3", + "factorType": "token", + "provider": "OKTA", + "status": "ACTIVE", + "created": "2015-02-04T07:07:25.000Z", + "lastUpdated": "2015-02-04T07:07:25.000Z", + "profile": { + "phoneNumber": "+1415551337" + }, + "_links": { + "verify": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/smsk33ujQ59REImFX0g3/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/smsk33ujQ59REImFX0g3", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/models/UserFactors/totpFactor.json b/tests/models/UserFactors/totpFactor.json new file mode 100644 index 0000000000..01bdf69393 --- /dev/null +++ b/tests/models/UserFactors/totpFactor.json @@ -0,0 +1,38 @@ +{ + "id": "emailk33ujQ59REImFX0g3", + "factorType": "token:software:totp", + "provider": "OKTA", + "status": "ACTIVE", + "created": "2015-02-04T07:07:25.000Z", + "lastUpdated": "2015-02-04T07:07:25.000Z", + "profile": { + "phoneNumber": "+1415551337" + }, + "_links": { + "verify": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/smsk33ujQ59REImFX0g3/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/smsk33ujQ59REImFX0g3", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file diff --git a/tests/models/UserFactors/webFactor.json b/tests/models/UserFactors/webFactor.json new file mode 100644 index 0000000000..6439bd5e84 --- /dev/null +++ b/tests/models/UserFactors/webFactor.json @@ -0,0 +1,38 @@ +{ + "id": "emailk33ujQ59REImFX0g3", + "factorType": "web", + "provider": "OKTA", + "status": "ACTIVE", + "created": "2015-02-04T07:07:25.000Z", + "lastUpdated": "2015-02-04T07:07:25.000Z", + "profile": { + "phoneNumber": "+1415551337" + }, + "_links": { + "verify": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/smsk33ujQ59REImFX0g3/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/smsk33ujQ59REImFX0g3", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file From c25e7347e2c4a833ba69aa4d6e76d8f21e44f530 Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Mon, 6 Nov 2017 15:47:33 -0500 Subject: [PATCH 09/22] Tests --- src/Generated/UserFactors/Factor.php | 38 ++++++++++++++-- src/Generated/UserFactors/FactorStatus.php | 31 +++++++++++++ .../UserFactors/VerifyFactorRequest.php | 25 +++++++++++ src/Generated/Users/User.php | 17 ------- tests/BaseTestCase.php | 18 ++++---- .../UserFactors/CallFactorProfileTest.php | 2 +- tests/Unit/UserFactors/CallFactorTest.php | 19 +++----- .../UserFactors/EmailFactorProfileTest.php | 2 +- tests/Unit/UserFactors/EmailFactorTest.php | 19 +++----- tests/Unit/UserFactors/FactorTest.php | 44 ++++++++++++++++-- .../UserFactors/HardwareFactorProfileTest.php | 2 +- tests/Unit/UserFactors/HardwareFactorTest.php | 19 +++----- .../UserFactors/PushFactorProfileTest.php | 2 +- tests/Unit/UserFactors/PushFactorTest.php | 19 +++----- .../SecurityQuestionFactorProfileTest.php | 2 +- .../SecurityQuestionFactorTest.php | 19 +++----- .../UserFactors/TokenFactorProfileTest.php | 2 +- tests/Unit/UserFactors/TokenFactorTest.php | 19 +++----- .../UserFactors/TotpFactorProfileTest.php | 2 +- tests/Unit/UserFactors/TotpFactorTest.php | 19 +++----- .../Unit/UserFactors/WebFactorProfileTest.php | 2 +- tests/Unit/UserFactors/WebFactorTest.php | 19 +++----- tests/Unit/Users/UserTest.php | 18 -------- tests/models/UserFactors/generalFactor.json | 45 +++++++++++++++++++ 24 files changed, 240 insertions(+), 164 deletions(-) create mode 100644 src/Generated/UserFactors/FactorStatus.php create mode 100644 tests/models/UserFactors/generalFactor.json diff --git a/src/Generated/UserFactors/Factor.php b/src/Generated/UserFactors/Factor.php index 680967e112..0806ff63c4 100644 --- a/src/Generated/UserFactors/Factor.php +++ b/src/Generated/UserFactors/Factor.php @@ -21,11 +21,14 @@ class Factor extends \Okta\Resource\AbstractResource { const ID = 'id'; + const LINKS = '_links'; const DEVICE = 'device'; + const STATUS = 'status'; const USER_ID = 'userId'; const VERIFY = 'verify'; const PROFILE = 'profile'; const PROVIDER = 'provider'; + const EMBEDDED = '_embedded'; const SESSION_ID = 'sessionId'; const DEVICE_TYPE = 'deviceType'; const FACTOR_TYPE = 'factorType'; @@ -41,6 +44,15 @@ public function getId(): string { return $this->getProperty(self::ID); } + /** + * Get the _links. + * + * @return \stdClass + */ + public function getLinks(): \stdClass + { + return $this->getProperty(self::LINKS); + } /** * Get the device. * @@ -65,6 +77,15 @@ public function setDevice($device) return $this; } + /** + * Get the status. + * + * @return string + */ + public function getStatus(): string + { + return $this->getProperty(self::STATUS); + } /** * Get the userId. * @@ -171,6 +192,15 @@ public function setProvider($provider) return $this; } + /** + * Get the _embedded. + * + * @return \stdClass + */ + public function getEmbedded(): \stdClass + { + return $this->getProperty(self::EMBEDDED); + } /** * Get the sessionId. * @@ -283,9 +313,9 @@ public function setRechallengeExistingFactor($rechallengeExistingFactor) * * @return mixed|null */ - public function activate($userId, VerifyFactorRequest $verifyFactorRequest) + public function activate(VerifyFactorRequest $verifyFactorRequest) { - $uri = "/api/v1/users/{$userId}/factors/{$this->getId()}/lifecycle/activate"; + $uri = "/api/v1/users/{$this->get()}/factors/{$this->getId()}/lifecycle/activate"; $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); @@ -300,9 +330,9 @@ public function activate($userId, VerifyFactorRequest $verifyFactorRequest) * * @return mixed|null */ - public function verify($userId, VerifyFactorRequest $verifyFactorRequest) + public function verify(VerifyFactorRequest $verifyFactorRequest) { - $uri = "/api/v1/users/{$userId}/factors/{$this->getId()}/verify"; + $uri = "/api/v1/users/{$this->get()}/factors/{$this->getId()}/verify"; $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); diff --git a/src/Generated/UserFactors/FactorStatus.php b/src/Generated/UserFactors/FactorStatus.php new file mode 100644 index 0000000000..d314541bc9 --- /dev/null +++ b/src/Generated/UserFactors/FactorStatus.php @@ -0,0 +1,31 @@ +getProperty(self::ANSWER); + } + /** + * Set the answer. + * + * @param mixed $answer The value to set. + * @return self + */ + public function setAnswer($answer) + { + $this->setProperty( + self::ANSWER, + $answer + ); + + return $this; + } /** * Get the passCode. * diff --git a/src/Generated/Users/User.php b/src/Generated/Users/User.php index 3430c4c4a3..15f1dadbf6 100644 --- a/src/Generated/Users/User.php +++ b/src/Generated/Users/User.php @@ -676,21 +676,4 @@ public function getFactor($factorId) return $response->convertFromGenericFactor(); } - - /** - * Unenrolls an existing factor for the specified user, allowing the user to enroll a new factor. - * - * - * @return mixed|null - */ - public function deleteFactor($factorId) - { - $uri = "/api/v1/users/{$this->getId()}/factors/{$factorId}"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('DELETE', $uri); - } } diff --git a/tests/BaseTestCase.php b/tests/BaseTestCase.php index a59eb8108f..892aa554d5 100644 --- a/tests/BaseTestCase.php +++ b/tests/BaseTestCase.php @@ -70,7 +70,7 @@ protected function createNewUser($properties = []): \Okta\Users\User protected function createModel($model, $returnType, $properties = []) { - $properties = $this->getModel($model, $properties); + $properties = json_decode($this->getModel($model, $properties)); $class = new \stdClass(); foreach($properties as $prop=>$value) @@ -83,16 +83,16 @@ protected function createModel($model, $returnType, $properties = []) protected function getModel($model, $overrides = []) { - $defaults = []; + $model = json_decode($this->getModelJson($model), true); - if(is_readable($fileName = __DIR__ . "/models/{$model}")) { - $defaults = json_decode( - file_get_contents($fileName), - true - ); - } + return json_encode(array_replace_recursive($model, $overrides)); - return array_replace_recursive($defaults, $overrides); + } + protected function getModelJson($model) + { + if(is_readable($fileName = __DIR__ . "/models/{$model}")) { + return (string) file_get_contents($fileName); + } } } \ No newline at end of file diff --git a/tests/Unit/UserFactors/CallFactorProfileTest.php b/tests/Unit/UserFactors/CallFactorProfileTest.php index 1fd4a02bb9..b3061f18b2 100644 --- a/tests/Unit/UserFactors/CallFactorProfileTest.php +++ b/tests/Unit/UserFactors/CallFactorProfileTest.php @@ -26,7 +26,7 @@ public function setUp() parent::setUp(); $this->createNewHttpClient(); $model = '/UserFactors/factorProfileCall.json'; - static::$properties = json_decode(json_encode($this->getModel($model))); + static::$properties = json_decode($this->getModelJson($model)); static::$testable = $this->createModel($model, \Okta\UserFactors\CallFactorProfile::class); } diff --git a/tests/Unit/UserFactors/CallFactorTest.php b/tests/Unit/UserFactors/CallFactorTest.php index dc881f77d6..2323851eeb 100644 --- a/tests/Unit/UserFactors/CallFactorTest.php +++ b/tests/Unit/UserFactors/CallFactorTest.php @@ -23,20 +23,13 @@ class CallFactorTest extends BaseTestCase /** @var User */ protected static $testable; - public static function setUpBeforeClass() + public function setUp() { - parent::setUpBeforeClass(); - - $clientBuilder = (new ClientBuilder())->build(); - - static::$properties = json_decode(file_get_contents(__DIR__ . '/../../models/UserFactors/callFactor.json')); - - $class = new \stdClass(); - foreach(static::$properties as $prop=>$value) - { - $class->{$prop} = $value; - } - self::$testable = new \Okta\UserFactors\CallFactor(null, $class); + parent::setUp(); + $this->createNewHttpClient(); + $model = '/UserFactors/callFactor.json'; + static::$properties = json_decode($this->getModelJson($model)); + static::$testable = $this->createModel($model, \Okta\UserFactors\CallFactor::class); } /** @test */ diff --git a/tests/Unit/UserFactors/EmailFactorProfileTest.php b/tests/Unit/UserFactors/EmailFactorProfileTest.php index 688cdf61df..18cda8d17a 100644 --- a/tests/Unit/UserFactors/EmailFactorProfileTest.php +++ b/tests/Unit/UserFactors/EmailFactorProfileTest.php @@ -26,7 +26,7 @@ public function setUp() parent::setUp(); $this->createNewHttpClient(); $model = '/UserFactors/factorProfileEmail.json'; - static::$properties = json_decode(json_encode($this->getModel($model))); + static::$properties = json_decode($this->getModel($model)); static::$testable = $this->createModel($model, \Okta\UserFactors\EmailFactorProfile::class); } diff --git a/tests/Unit/UserFactors/EmailFactorTest.php b/tests/Unit/UserFactors/EmailFactorTest.php index 5aa9a0f7ad..c5cedd562c 100644 --- a/tests/Unit/UserFactors/EmailFactorTest.php +++ b/tests/Unit/UserFactors/EmailFactorTest.php @@ -23,20 +23,13 @@ class EmailFactorTest extends BaseTestCase /** @var User */ protected static $testable; - public static function setUpBeforeClass() + public function setUp() { - parent::setUpBeforeClass(); - - $clientBuilder = (new ClientBuilder())->build(); - - static::$properties = json_decode(file_get_contents(__DIR__ . '/../../models/UserFactors/emailFactor.json')); - - $class = new \stdClass(); - foreach(static::$properties as $prop=>$value) - { - $class->{$prop} = $value; - } - self::$testable = new \Okta\UserFactors\EmailFactor(null, $class); + parent::setUp(); + $this->createNewHttpClient(); + $model = '/UserFactors/emailFactor.json'; + static::$properties = json_decode($this->getModelJson($model)); + static::$testable = $this->createModel($model, \Okta\UserFactors\EmailFactor::class); } /** @test */ diff --git a/tests/Unit/UserFactors/FactorTest.php b/tests/Unit/UserFactors/FactorTest.php index 5b35081c62..ee89e7896d 100644 --- a/tests/Unit/UserFactors/FactorTest.php +++ b/tests/Unit/UserFactors/FactorTest.php @@ -27,8 +27,8 @@ public function setUp() { parent::setUp(); $this->createNewHttpClient(); - $model = '/UserFactors/emailFactor.json'; - static::$properties = json_decode(json_encode($this->getModel($model))); + $model = '/UserFactors/generalFactor.json'; + static::$properties = json_decode($this->getModelJson($model)); static::$testable = $this->createModel($model, \Okta\UserFactors\Factor::class); } @@ -39,16 +39,52 @@ public function id_is_accessible() $this->assertEquals(static::$properties->id, static::$testable->id); } + /** @test */ + public function links_is_accessible() + { + $this->assertEquals(static::$properties->_links, static::$testable->getLinks()); + $this->assertEquals(static::$properties->_links, static::$testable->links); + } + /** @test */ public function device_is_accessible() { $this->assertEquals(static::$properties->device, static::$testable->getDevice()); $this->assertEquals(static::$properties->device, static::$testable->device); } - - + /** @test */ + public function device_is_settable() + { + static::$testable->setDevice('test1'); + static::assertEquals('test1', static::$testable->getDevice()); + static::$testable->device = 'test2'; + static::assertEquals('test2', static::$testable->getDevice()); + } + /** @test */ + public function status_is_accessible() + { + $this->assertEquals(static::$properties->status, static::$testable->getStatus()); + $this->assertEquals(static::$properties->status, static::$testable->status); + } + + /** @test */ + public function user_id_is_accessible() + { + $this->assertEquals(static::$properties->userId, static::$testable->getUserId()); + $this->assertEquals(static::$properties->userId, static::$testable->userId); + } + + /** @test */ + public function user_id_is_settable() + { + static::$testable->setUserId('123'); + static::assertEquals('123', static::$testable->getUserId()); + + static::$testable->userId = '456'; + static::assertEquals('456', static::$testable->getUserId()); + } } diff --git a/tests/Unit/UserFactors/HardwareFactorProfileTest.php b/tests/Unit/UserFactors/HardwareFactorProfileTest.php index 2725a23e5b..a1d248644b 100644 --- a/tests/Unit/UserFactors/HardwareFactorProfileTest.php +++ b/tests/Unit/UserFactors/HardwareFactorProfileTest.php @@ -26,7 +26,7 @@ public function setUp() parent::setUp(); $this->createNewHttpClient(); $model = '/UserFactors/factorProfileHardware.json'; - static::$properties = json_decode(json_encode($this->getModel($model))); + static::$properties = json_decode($this->getModel($model)); static::$testable = $this->createModel($model, \Okta\UserFactors\HardwareFactorProfile::class); } diff --git a/tests/Unit/UserFactors/HardwareFactorTest.php b/tests/Unit/UserFactors/HardwareFactorTest.php index 72434d16f2..2bc1da42f6 100644 --- a/tests/Unit/UserFactors/HardwareFactorTest.php +++ b/tests/Unit/UserFactors/HardwareFactorTest.php @@ -23,20 +23,13 @@ class HardwareFactorTest extends BaseTestCase /** @var User */ protected static $testable; - public static function setUpBeforeClass() + public function setUp() { - parent::setUpBeforeClass(); - - $clientBuilder = (new ClientBuilder())->build(); - - static::$properties = json_decode(file_get_contents(__DIR__ . '/../../models/UserFactors/hardwareFactor.json')); - - $class = new \stdClass(); - foreach(static::$properties as $prop=>$value) - { - $class->{$prop} = $value; - } - self::$testable = new \Okta\UserFactors\HardwareFactor(null, $class); + parent::setUp(); + $this->createNewHttpClient(); + $model = '/UserFactors/hardwareFactor.json'; + static::$properties = json_decode($this->getModelJson($model)); + static::$testable = $this->createModel($model, \Okta\UserFactors\HardwareFactor::class); } /** @test */ diff --git a/tests/Unit/UserFactors/PushFactorProfileTest.php b/tests/Unit/UserFactors/PushFactorProfileTest.php index fb99f8f564..a8ed4d4ed7 100644 --- a/tests/Unit/UserFactors/PushFactorProfileTest.php +++ b/tests/Unit/UserFactors/PushFactorProfileTest.php @@ -26,7 +26,7 @@ public function setUp() parent::setUp(); $this->createNewHttpClient(); $model = '/UserFactors/factorProfilePush.json'; - static::$properties = json_decode(json_encode($this->getModel($model))); + static::$properties = json_decode($this->getModel($model)); static::$testable = $this->createModel($model, \Okta\UserFactors\PushFactorProfile::class); } diff --git a/tests/Unit/UserFactors/PushFactorTest.php b/tests/Unit/UserFactors/PushFactorTest.php index 76999c643a..31543b3b77 100644 --- a/tests/Unit/UserFactors/PushFactorTest.php +++ b/tests/Unit/UserFactors/PushFactorTest.php @@ -23,20 +23,13 @@ class PushFactor extends BaseTestCase /** @var User */ protected static $testable; - public static function setUpBeforeClass() + public function setUp() { - parent::setUpBeforeClass(); - - $clientBuilder = (new ClientBuilder())->build(); - - static::$properties = json_decode(file_get_contents(__DIR__ . '/../../models/UserFactors/pushFactor.json')); - - $class = new \stdClass(); - foreach(static::$properties as $prop=>$value) - { - $class->{$prop} = $value; - } - self::$testable = new \Okta\UserFactors\PushFactor(null, $class); + parent::setUp(); + $this->createNewHttpClient(); + $model = '/UserFactors/pushFactor.json'; + static::$properties = json_decode($this->getModelJson($model)); + static::$testable = $this->createModel($model, \Okta\UserFactors\PushFactor::class); } /** @test */ diff --git a/tests/Unit/UserFactors/SecurityQuestionFactorProfileTest.php b/tests/Unit/UserFactors/SecurityQuestionFactorProfileTest.php index 95f54152e1..1f27336f0a 100644 --- a/tests/Unit/UserFactors/SecurityQuestionFactorProfileTest.php +++ b/tests/Unit/UserFactors/SecurityQuestionFactorProfileTest.php @@ -26,7 +26,7 @@ public function setUp() parent::setUp(); $this->createNewHttpClient(); $model = '/UserFactors/factorProfileQuestion.json'; - static::$properties = json_decode(json_encode($this->getModel($model))); + static::$properties = json_decode($this->getModel($model)); static::$testable = $this->createModel($model, \Okta\UserFactors\SecurityQuestionFactorProfile::class); } diff --git a/tests/Unit/UserFactors/SecurityQuestionFactorTest.php b/tests/Unit/UserFactors/SecurityQuestionFactorTest.php index ca52df4625..c26734d7b8 100644 --- a/tests/Unit/UserFactors/SecurityQuestionFactorTest.php +++ b/tests/Unit/UserFactors/SecurityQuestionFactorTest.php @@ -23,20 +23,13 @@ class SecurityQuestionFactorTest extends BaseTestCase /** @var User */ protected static $testable; - public static function setUpBeforeClass() + public function setUp() { - parent::setUpBeforeClass(); - - $clientBuilder = (new ClientBuilder())->build(); - - static::$properties = json_decode(file_get_contents(__DIR__ . '/../../models/UserFactors/securityQuestionFactor.json')); - - $class = new \stdClass(); - foreach(static::$properties as $prop=>$value) - { - $class->{$prop} = $value; - } - self::$testable = new \Okta\UserFactors\SecurityQuestionFactor(null, $class); + parent::setUp(); + $this->createNewHttpClient(); + $model = '/UserFactors/securityQuestionFactor.json'; + static::$properties = json_decode($this->getModelJson($model)); + static::$testable = $this->createModel($model, \Okta\UserFactors\SecurityQuestionFactor::class); } /** @test */ diff --git a/tests/Unit/UserFactors/TokenFactorProfileTest.php b/tests/Unit/UserFactors/TokenFactorProfileTest.php index c925339233..ba250e023a 100644 --- a/tests/Unit/UserFactors/TokenFactorProfileTest.php +++ b/tests/Unit/UserFactors/TokenFactorProfileTest.php @@ -26,7 +26,7 @@ public function setUp() parent::setUp(); $this->createNewHttpClient(); $model = '/UserFactors/factorProfileToken.json'; - static::$properties = json_decode(json_encode($this->getModel($model))); + static::$properties = json_decode($this->getModel($model)); static::$testable = $this->createModel($model, \Okta\UserFactors\TokenFactorProfile::class); } diff --git a/tests/Unit/UserFactors/TokenFactorTest.php b/tests/Unit/UserFactors/TokenFactorTest.php index 1b2bae74dc..6285af7570 100644 --- a/tests/Unit/UserFactors/TokenFactorTest.php +++ b/tests/Unit/UserFactors/TokenFactorTest.php @@ -23,20 +23,13 @@ class TokenFactor extends BaseTestCase /** @var User */ protected static $testable; - public static function setUpBeforeClass() + public function setUp() { - parent::setUpBeforeClass(); - - $clientBuilder = (new ClientBuilder())->build(); - - static::$properties = json_decode(file_get_contents(__DIR__ . '/../../models/UserFactors/pushFactor.json')); - - $class = new \stdClass(); - foreach(static::$properties as $prop=>$value) - { - $class->{$prop} = $value; - } - self::$testable = new \Okta\UserFactors\TokenFactor(null, $class); + parent::setUp(); + $this->createNewHttpClient(); + $model = '/UserFactors/pushFactor.json'; + static::$properties = json_decode($this->getModelJson($model)); + static::$testable = $this->createModel($model, \Okta\UserFactors\TokenFactor::class); } /** @test */ diff --git a/tests/Unit/UserFactors/TotpFactorProfileTest.php b/tests/Unit/UserFactors/TotpFactorProfileTest.php index c1a693ed59..5904fe1265 100644 --- a/tests/Unit/UserFactors/TotpFactorProfileTest.php +++ b/tests/Unit/UserFactors/TotpFactorProfileTest.php @@ -26,7 +26,7 @@ public function setUp() parent::setUp(); $this->createNewHttpClient(); $model = '/UserFactors/factorProfileTotp.json'; - static::$properties = json_decode(json_encode($this->getModel($model))); + static::$properties = json_decode($this->getModel($model)); static::$testable = $this->createModel($model, \Okta\UserFactors\TotpFactorProfile::class); } diff --git a/tests/Unit/UserFactors/TotpFactorTest.php b/tests/Unit/UserFactors/TotpFactorTest.php index 3eef9ae986..eface088cd 100644 --- a/tests/Unit/UserFactors/TotpFactorTest.php +++ b/tests/Unit/UserFactors/TotpFactorTest.php @@ -23,20 +23,13 @@ class TotpFactor extends BaseTestCase /** @var User */ protected static $testable; - public static function setUpBeforeClass() + public function setUp() { - parent::setUpBeforeClass(); - - $clientBuilder = (new ClientBuilder())->build(); - - static::$properties = json_decode(file_get_contents(__DIR__ . '/../../models/UserFactors/totpFactor.json')); - - $class = new \stdClass(); - foreach(static::$properties as $prop=>$value) - { - $class->{$prop} = $value; - } - self::$testable = new \Okta\UserFactors\TotpFactor(null, $class); + parent::setUp(); + $this->createNewHttpClient(); + $model = '/UserFactors/totpFactor.json'; + static::$properties = json_decode($this->getModelJson($model)); + static::$testable = $this->createModel($model, \Okta\UserFactors\TotpFactor::class); } /** @test */ diff --git a/tests/Unit/UserFactors/WebFactorProfileTest.php b/tests/Unit/UserFactors/WebFactorProfileTest.php index d202e994c4..89c8d6fd7e 100644 --- a/tests/Unit/UserFactors/WebFactorProfileTest.php +++ b/tests/Unit/UserFactors/WebFactorProfileTest.php @@ -26,7 +26,7 @@ public function setUp() parent::setUp(); $this->createNewHttpClient(); $model = '/UserFactors/factorProfileWeb.json'; - static::$properties = json_decode(json_encode($this->getModel($model))); + static::$properties = json_decode($this->getModel($model)); static::$testable = $this->createModel($model, \Okta\UserFactors\WebFactorProfile::class); } diff --git a/tests/Unit/UserFactors/WebFactorTest.php b/tests/Unit/UserFactors/WebFactorTest.php index e7a1a4173e..6d829f01f4 100644 --- a/tests/Unit/UserFactors/WebFactorTest.php +++ b/tests/Unit/UserFactors/WebFactorTest.php @@ -23,20 +23,13 @@ class WebFactor extends BaseTestCase /** @var User */ protected static $testable; - public static function setUpBeforeClass() + public function setUp() { - parent::setUpBeforeClass(); - - $clientBuilder = (new ClientBuilder())->build(); - - static::$properties = json_decode(file_get_contents(__DIR__ . '/../../models/UserFactors/webFactor.json')); - - $class = new \stdClass(); - foreach(static::$properties as $prop=>$value) - { - $class->{$prop} = $value; - } - self::$testable = new \Okta\UserFactors\WebFactor(null, $class); + parent::setUp(); + $this->createNewHttpClient(); + $model = '/UserFactors/webFactor.json'; + static::$properties = json_decode($this->getModelJson($model)); + static::$testable = $this->createModel($model, \Okta\UserFactors\WebFactor::class); } /** @test */ diff --git a/tests/Unit/Users/UserTest.php b/tests/Unit/Users/UserTest.php index cf4d426e73..2a34d3171f 100644 --- a/tests/Unit/Users/UserTest.php +++ b/tests/Unit/Users/UserTest.php @@ -879,23 +879,5 @@ public function can_get_supported_security_questions() } - /** @test */ - public function deleting_a_factor_requests_correct_endpoint() - { - $httpClient = $this->createNewHttpClient(); - $user = $this->createNewUser(); - - $user->deleteFactor('FactorId'); - - $request = $httpClient->getRequests(); - - $this->assertEquals('DELETE', $request[0]->getMethod()); - - $this->assertEquals( - "/api/v1/users/{$user->getId()}/factors/FactorId", - $request[0]->getUri()->getPath() - ); - } - } \ No newline at end of file diff --git a/tests/models/UserFactors/generalFactor.json b/tests/models/UserFactors/generalFactor.json new file mode 100644 index 0000000000..8c7361b391 --- /dev/null +++ b/tests/models/UserFactors/generalFactor.json @@ -0,0 +1,45 @@ +{ + "id": "callk33ujQ59REImFX0g3", + "factorType": "factor", + "provider": "OKTA", + "status": "ACTIVE", + "device": "Device", + "userId": "someId123", + "verify": "verify", + "sessionId": "123abc", + "deviceType": "mobile", + "mfaStateTokenId": "tokenId", + "rechallengeExistingFactor": true, + "created": "2015-02-04T07:07:25.000Z", + "lastUpdated": "2015-02-04T07:07:25.000Z", + "profile": { + "phoneNumber": "+1415551337" + }, + "_links": { + "verify": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/smsk33ujQ59REImFX0g3/verify", + "hints": { + "allow": [ + "POST" + ] + } + }, + "self": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL/factors/smsk33ujQ59REImFX0g3", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "user": { + "href": "https://{yourOktaDomain}.com/api/v1/users/00u15s1KDETTQMQYABRL", + "hints": { + "allow": [ + "GET" + ] + } + } + } +} \ No newline at end of file From 86e951a9e85e686ec8cb23385012d1a083b3dda6 Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Thu, 9 Nov 2017 15:38:27 -0500 Subject: [PATCH 10/22] Adds operations and crud --- openapi/generator/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/openapi/generator/index.js b/openapi/generator/index.js index 26fab9b1e9..611f3a54a5 100644 --- a/openapi/generator/index.js +++ b/openapi/generator/index.js @@ -102,6 +102,18 @@ function getExtends(modelName) { case 'TotpFactor': case 'WebFactor': return '\\Okta\\UserFactors\\Factor'; + case 'AutoLoginApplication': + case 'BasicAuthApplication': + case 'BookmarApplication': + case 'BrowserPluginApplication': + case 'OpenIdConnectApplication': + case 'SamlApplication': + case 'SecurePasswordStoreApplication': + case 'WsFederationApplication': + return '\\Okta\\Applications\\Application'; + case 'SwaApplication': + case 'SwaThreeFieldApplication': + return '\\Okta\\Application\\BrowserPluginApplication'; case 'CallFactorProfile': case 'EmailFactorProfile': case 'HardwareFactorProfile': From eafd9f3a3241a4cffec1568b6301087e344f849d Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Mon, 20 Nov 2017 11:16:27 -0500 Subject: [PATCH 11/22] Adds applications --- src/Applications/AppUser.php | 24 + src/Applications/AppUserCredentials.php | 24 + src/Applications/Application.php | 24 + src/Applications/ApplicationAccessibility.php | 24 + src/Applications/ApplicationCredentials.php | 24 + .../ApplicationCredentialsOAuthClient.php | 24 + .../ApplicationCredentialsScheme.php | 25 + .../ApplicationCredentialsSigning.php | 24 + ...ApplicationCredentialsUsernameTemplate.php | 24 + .../ApplicationGroupAssignment.php | 24 + src/Applications/ApplicationLicensing.php | 24 + src/Applications/ApplicationSettings.php | 24 + .../ApplicationSettingsApplication.php | 24 + .../ApplicationSettingsNotifications.php | 24 + .../ApplicationSettingsNotificationsVpn.php | 24 + ...icationSettingsNotificationsVpnNetwork.php | 24 + src/Applications/ApplicationSignOnMode.php | 23 + src/Applications/ApplicationTemplateName.php | 23 + src/Applications/ApplicationVisibility.php | 24 + .../ApplicationVisibilityHide.php | 24 + src/Applications/AutoLoginApplication.php | 24 + .../AutoLoginApplicationSettings.php | 24 + .../AutoLoginApplicationSettingsSignOn.php | 24 + src/Applications/BasicApplicationSettings.php | 24 + .../BasicApplicationSettingsApplication.php | 24 + src/Applications/BasicAuthApplication.php | 24 + src/Applications/BookmarkApplication.php | 24 + .../BookmarkApplicationSettings.php | 24 + ...BookmarkApplicationSettingsApplication.php | 24 + src/Applications/BrowserPluginApplication.php | 24 + src/Applications/Collection.php | 23 + src/Applications/JsonWebKeyRSAMediated.php | 24 + .../OAuthApplicationCredentials.php | 24 + .../OAuthEndpointAuthenticationMethod.php | 23 + src/Applications/OAuthGrantType.php | 23 + src/Applications/OAuthResponseType.php | 23 + src/Applications/OpenIdConnectApplication.php | 24 + .../OpenIdConnectApplicationConsentMethod.php | 23 + .../OpenIdConnectApplicationSettings.php | 24 + ...OpenIdConnectApplicationSettingsClient.php | 24 + .../OpenIdConnectApplicationType.php | 23 + src/Applications/PublicSignOnModeMediated.php | 24 + src/Applications/SamlApplication.php | 24 + src/Applications/SamlApplicationSettings.php | 24 + .../SamlApplicationSettingsSignOn.php | 24 + .../SchemeApplicationCredentials.php | 24 + .../SecurePasswordStoreApplication.php | 24 + ...SecurePasswordStoreApplicationSettings.php | 24 + ...ordStoreApplicationSettingsApplication.php | 24 + src/Applications/SwaApplication.php | 24 + src/Applications/SwaApplicationSettings.php | 24 + .../SwaApplicationSettingsApplication.php | 24 + src/Applications/SwaThreeFieldApplication.php | 24 + .../SwaThreeFieldApplicationSettings.php | 24 + ...reeFieldApplicationSettingsApplication.php | 24 + src/Applications/WsFederationApplication.php | 24 + .../WsFederationApplicationSettings.php | 24 + ...derationApplicationSettingsApplication.php | 24 + src/Generated/Applications/AppUser.php | 334 +++++++++ .../Applications/AppUserCredentials.php | 79 +++ src/Generated/Applications/Application.php | 661 ++++++++++++++++++ .../Applications/ApplicationAccessibility.php | 99 +++ .../Applications/ApplicationCredentials.php | 84 +++ .../ApplicationCredentialsOAuthClient.php | 124 ++++ .../ApplicationCredentialsScheme.php | 29 + .../ApplicationCredentialsSigning.php | 124 ++++ ...ApplicationCredentialsUsernameTemplate.php | 99 +++ .../ApplicationGroupAssignment.php | 129 ++++ .../Applications/ApplicationLicensing.php | 49 ++ .../Applications/ApplicationSettings.php | 84 +++ .../ApplicationSettingsApplication.php | 24 + .../ApplicationSettingsNotifications.php | 54 ++ .../ApplicationSettingsNotificationsVpn.php | 104 +++ ...icationSettingsNotificationsVpnNetwork.php | 99 +++ .../Applications/ApplicationSignOnMode.php | 32 + .../Applications/ApplicationTemplateName.php | 31 + .../Applications/ApplicationVisibility.php | 104 +++ .../ApplicationVisibilityHide.php | 74 ++ .../Applications/AutoLoginApplication.php | 84 +++ .../AutoLoginApplicationSettings.php | 54 ++ .../AutoLoginApplicationSettingsSignOn.php | 74 ++ .../Applications/BasicApplicationSettings.php | 54 ++ .../BasicApplicationSettingsApplication.php | 74 ++ .../Applications/BasicAuthApplication.php | 84 +++ .../Applications/BookmarkApplication.php | 54 ++ .../BookmarkApplicationSettings.php | 54 ++ ...BookmarkApplicationSettingsApplication.php | 74 ++ .../Applications/BrowserPluginApplication.php | 54 ++ src/Generated/Applications/Collection.php | 25 + .../Applications/JsonWebKeyRSAMediated.php | 174 +++++ .../OAuthApplicationCredentials.php | 54 ++ .../OAuthEndpointAuthenticationMethod.php | 28 + src/Generated/Applications/OAuthGrantType.php | 29 + .../Applications/OAuthResponseType.php | 27 + .../Applications/OpenIdConnectApplication.php | 84 +++ .../OpenIdConnectApplicationConsentMethod.php | 26 + .../OpenIdConnectApplicationSettings.php | 54 ++ ...OpenIdConnectApplicationSettingsClient.php | 249 +++++++ .../OpenIdConnectApplicationType.php | 28 + .../Applications/PublicSignOnModeMediated.php | 24 + .../Applications/SamlApplication.php | 54 ++ .../Applications/SamlApplicationSettings.php | 54 ++ .../SamlApplicationSettingsSignOn.php | 549 +++++++++++++++ .../SchemeApplicationCredentials.php | 159 +++++ .../SecurePasswordStoreApplication.php | 84 +++ ...SecurePasswordStoreApplicationSettings.php | 54 ++ ...ordStoreApplicationSettingsApplication.php | 249 +++++++ src/Generated/Applications/SwaApplication.php | 54 ++ .../Applications/SwaApplicationSettings.php | 54 ++ .../SwaApplicationSettingsApplication.php | 124 ++++ .../Applications/SwaThreeFieldApplication.php | 54 ++ .../SwaThreeFieldApplicationSettings.php | 54 ++ ...reeFieldApplicationSettingsApplication.php | 174 +++++ .../Applications/WsFederationApplication.php | 54 ++ .../WsFederationApplicationSettings.php | 54 ++ ...derationApplicationSettingsApplication.php | 324 +++++++++ 116 files changed, 7413 insertions(+) create mode 100644 src/Applications/AppUser.php create mode 100644 src/Applications/AppUserCredentials.php create mode 100644 src/Applications/Application.php create mode 100644 src/Applications/ApplicationAccessibility.php create mode 100644 src/Applications/ApplicationCredentials.php create mode 100644 src/Applications/ApplicationCredentialsOAuthClient.php create mode 100644 src/Applications/ApplicationCredentialsScheme.php create mode 100644 src/Applications/ApplicationCredentialsSigning.php create mode 100644 src/Applications/ApplicationCredentialsUsernameTemplate.php create mode 100644 src/Applications/ApplicationGroupAssignment.php create mode 100644 src/Applications/ApplicationLicensing.php create mode 100644 src/Applications/ApplicationSettings.php create mode 100644 src/Applications/ApplicationSettingsApplication.php create mode 100644 src/Applications/ApplicationSettingsNotifications.php create mode 100644 src/Applications/ApplicationSettingsNotificationsVpn.php create mode 100644 src/Applications/ApplicationSettingsNotificationsVpnNetwork.php create mode 100644 src/Applications/ApplicationSignOnMode.php create mode 100644 src/Applications/ApplicationTemplateName.php create mode 100644 src/Applications/ApplicationVisibility.php create mode 100644 src/Applications/ApplicationVisibilityHide.php create mode 100644 src/Applications/AutoLoginApplication.php create mode 100644 src/Applications/AutoLoginApplicationSettings.php create mode 100644 src/Applications/AutoLoginApplicationSettingsSignOn.php create mode 100644 src/Applications/BasicApplicationSettings.php create mode 100644 src/Applications/BasicApplicationSettingsApplication.php create mode 100644 src/Applications/BasicAuthApplication.php create mode 100644 src/Applications/BookmarkApplication.php create mode 100644 src/Applications/BookmarkApplicationSettings.php create mode 100644 src/Applications/BookmarkApplicationSettingsApplication.php create mode 100644 src/Applications/BrowserPluginApplication.php create mode 100644 src/Applications/Collection.php create mode 100644 src/Applications/JsonWebKeyRSAMediated.php create mode 100644 src/Applications/OAuthApplicationCredentials.php create mode 100644 src/Applications/OAuthEndpointAuthenticationMethod.php create mode 100644 src/Applications/OAuthGrantType.php create mode 100644 src/Applications/OAuthResponseType.php create mode 100644 src/Applications/OpenIdConnectApplication.php create mode 100644 src/Applications/OpenIdConnectApplicationConsentMethod.php create mode 100644 src/Applications/OpenIdConnectApplicationSettings.php create mode 100644 src/Applications/OpenIdConnectApplicationSettingsClient.php create mode 100644 src/Applications/OpenIdConnectApplicationType.php create mode 100644 src/Applications/PublicSignOnModeMediated.php create mode 100644 src/Applications/SamlApplication.php create mode 100644 src/Applications/SamlApplicationSettings.php create mode 100644 src/Applications/SamlApplicationSettingsSignOn.php create mode 100644 src/Applications/SchemeApplicationCredentials.php create mode 100644 src/Applications/SecurePasswordStoreApplication.php create mode 100644 src/Applications/SecurePasswordStoreApplicationSettings.php create mode 100644 src/Applications/SecurePasswordStoreApplicationSettingsApplication.php create mode 100644 src/Applications/SwaApplication.php create mode 100644 src/Applications/SwaApplicationSettings.php create mode 100644 src/Applications/SwaApplicationSettingsApplication.php create mode 100644 src/Applications/SwaThreeFieldApplication.php create mode 100644 src/Applications/SwaThreeFieldApplicationSettings.php create mode 100644 src/Applications/SwaThreeFieldApplicationSettingsApplication.php create mode 100644 src/Applications/WsFederationApplication.php create mode 100644 src/Applications/WsFederationApplicationSettings.php create mode 100644 src/Applications/WsFederationApplicationSettingsApplication.php create mode 100644 src/Generated/Applications/AppUser.php create mode 100644 src/Generated/Applications/AppUserCredentials.php create mode 100644 src/Generated/Applications/Application.php create mode 100644 src/Generated/Applications/ApplicationAccessibility.php create mode 100644 src/Generated/Applications/ApplicationCredentials.php create mode 100644 src/Generated/Applications/ApplicationCredentialsOAuthClient.php create mode 100644 src/Generated/Applications/ApplicationCredentialsScheme.php create mode 100644 src/Generated/Applications/ApplicationCredentialsSigning.php create mode 100644 src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php create mode 100644 src/Generated/Applications/ApplicationGroupAssignment.php create mode 100644 src/Generated/Applications/ApplicationLicensing.php create mode 100644 src/Generated/Applications/ApplicationSettings.php create mode 100644 src/Generated/Applications/ApplicationSettingsApplication.php create mode 100644 src/Generated/Applications/ApplicationSettingsNotifications.php create mode 100644 src/Generated/Applications/ApplicationSettingsNotificationsVpn.php create mode 100644 src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php create mode 100644 src/Generated/Applications/ApplicationSignOnMode.php create mode 100644 src/Generated/Applications/ApplicationTemplateName.php create mode 100644 src/Generated/Applications/ApplicationVisibility.php create mode 100644 src/Generated/Applications/ApplicationVisibilityHide.php create mode 100644 src/Generated/Applications/AutoLoginApplication.php create mode 100644 src/Generated/Applications/AutoLoginApplicationSettings.php create mode 100644 src/Generated/Applications/AutoLoginApplicationSettingsSignOn.php create mode 100644 src/Generated/Applications/BasicApplicationSettings.php create mode 100644 src/Generated/Applications/BasicApplicationSettingsApplication.php create mode 100644 src/Generated/Applications/BasicAuthApplication.php create mode 100644 src/Generated/Applications/BookmarkApplication.php create mode 100644 src/Generated/Applications/BookmarkApplicationSettings.php create mode 100644 src/Generated/Applications/BookmarkApplicationSettingsApplication.php create mode 100644 src/Generated/Applications/BrowserPluginApplication.php create mode 100644 src/Generated/Applications/Collection.php create mode 100644 src/Generated/Applications/JsonWebKeyRSAMediated.php create mode 100644 src/Generated/Applications/OAuthApplicationCredentials.php create mode 100644 src/Generated/Applications/OAuthEndpointAuthenticationMethod.php create mode 100644 src/Generated/Applications/OAuthGrantType.php create mode 100644 src/Generated/Applications/OAuthResponseType.php create mode 100644 src/Generated/Applications/OpenIdConnectApplication.php create mode 100644 src/Generated/Applications/OpenIdConnectApplicationConsentMethod.php create mode 100644 src/Generated/Applications/OpenIdConnectApplicationSettings.php create mode 100644 src/Generated/Applications/OpenIdConnectApplicationSettingsClient.php create mode 100644 src/Generated/Applications/OpenIdConnectApplicationType.php create mode 100644 src/Generated/Applications/PublicSignOnModeMediated.php create mode 100644 src/Generated/Applications/SamlApplication.php create mode 100644 src/Generated/Applications/SamlApplicationSettings.php create mode 100644 src/Generated/Applications/SamlApplicationSettingsSignOn.php create mode 100644 src/Generated/Applications/SchemeApplicationCredentials.php create mode 100644 src/Generated/Applications/SecurePasswordStoreApplication.php create mode 100644 src/Generated/Applications/SecurePasswordStoreApplicationSettings.php create mode 100644 src/Generated/Applications/SecurePasswordStoreApplicationSettingsApplication.php create mode 100644 src/Generated/Applications/SwaApplication.php create mode 100644 src/Generated/Applications/SwaApplicationSettings.php create mode 100644 src/Generated/Applications/SwaApplicationSettingsApplication.php create mode 100644 src/Generated/Applications/SwaThreeFieldApplication.php create mode 100644 src/Generated/Applications/SwaThreeFieldApplicationSettings.php create mode 100644 src/Generated/Applications/SwaThreeFieldApplicationSettingsApplication.php create mode 100644 src/Generated/Applications/WsFederationApplication.php create mode 100644 src/Generated/Applications/WsFederationApplicationSettings.php create mode 100644 src/Generated/Applications/WsFederationApplicationSettingsApplication.php diff --git a/src/Applications/AppUser.php b/src/Applications/AppUser.php new file mode 100644 index 0000000000..d835030547 --- /dev/null +++ b/src/Applications/AppUser.php @@ -0,0 +1,24 @@ +getProperty(self::ID); + } + /** + * Get the scope. + * + * @return string + */ + public function getScope(): string + { + return $this->getProperty(self::SCOPE); + } + /** + * Set the scope. + * + * @param mixed $scope The value to set. + * @return self + */ + public function setScope($scope) + { + $this->setProperty( + self::SCOPE, + $scope + ); + + return $this; + } + /** + * Get the _links. + * + * @return \stdClass + */ + public function getLinks(): \stdClass + { + return $this->getProperty(self::LINKS); + } + /** + * Get the status. + * + * @return string + */ + public function getStatus(): string + { + return $this->getProperty(self::STATUS); + } + /** + * Set the status. + * + * @param mixed $status The value to set. + * @return self + */ + public function setStatus($status) + { + $this->setProperty( + self::STATUS, + $status + ); + + return $this; + } + /** + * Get the created. + * + * @return string + */ + public function getCreated(): string + { + return $this->getProperty(self::CREATED); + } + /** + * Set the created. + * + * @param mixed $created The value to set. + * @return self + */ + public function setCreated($created) + { + $this->setProperty( + self::CREATED, + $created + ); + + return $this; + } + /** + * Get the profile. + * + * @return \stdClass + */ + public function getProfile(): \stdClass + { + return $this->getProperty(self::PROFILE); + } + /** + * Set the profile. + * + * @param mixed $profile The value to set. + * @return self + */ + public function setProfile($profile) + { + $this->setProperty( + self::PROFILE, + $profile + ); + + return $this; + } + /** + * Get the lastSync. + * + * @return string + */ + public function getLastSync(): string + { + return $this->getProperty(self::LAST_SYNC); + } + /** + * Set the lastSync. + * + * @param mixed $lastSync The value to set. + * @return self + */ + public function setLastSync($lastSync) + { + $this->setProperty( + self::LAST_SYNC, + $lastSync + ); + + return $this; + } + /** + * Get the _embedded. + * + * @return \stdClass + */ + public function getEmbedded(): \stdClass + { + return $this->getProperty(self::EMBEDDED); + } + /** + * Get the syncState. + * + * @return string + */ + public function getSyncState(): string + { + return $this->getProperty(self::SYNC_STATE); + } + /** + * Set the syncState. + * + * @param mixed $syncState The value to set. + * @return self + */ + public function setSyncState($syncState) + { + $this->setProperty( + self::SYNC_STATE, + $syncState + ); + + return $this; + } + /** + * Get the externalId. + * + * @return string + */ + public function getExternalId(): string + { + return $this->getProperty(self::EXTERNAL_ID); + } + /** + * Set the externalId. + * + * @param mixed $externalId The value to set. + * @return self + */ + public function setExternalId($externalId) + { + $this->setProperty( + self::EXTERNAL_ID, + $externalId + ); + + return $this; + } + /** + * Get the credentials. + * + * @return \Okta\Applications\AppUserCredentials + */ + public function getCredentials(array $options = []): \Okta\Applications\AppUserCredentials + { + return $this->getResourceProperty( + self::CREDENTIALS, + \Okta\Applications\AppUserCredentials::class, + $options + ); + } + + /** + * Set the credentials. + * + * @param \Okta\Applications\AppUserCredentials $credentials The AppUserCredentials instance. + * @return self + */ + public function setCredentials(AppUserCredentials $credentials) + { + $this->setResourceProperty( + self::CREDENTIALS, + $credentials + ); + + return $this; + } + /** + * Get the lastUpdated. + * + * @return string + */ + public function getLastUpdated(): string + { + return $this->getProperty(self::LAST_UPDATED); + } + /** + * Set the lastUpdated. + * + * @param mixed $lastUpdated The value to set. + * @return self + */ + public function setLastUpdated($lastUpdated) + { + $this->setProperty( + self::LAST_UPDATED, + $lastUpdated + ); + + return $this; + } + /** + * Get the statusChanged. + * + * @return string + */ + public function getStatusChanged(): string + { + return $this->getProperty(self::STATUS_CHANGED); + } + /** + * Set the statusChanged. + * + * @param mixed $statusChanged The value to set. + * @return self + */ + public function setStatusChanged($statusChanged) + { + $this->setProperty( + self::STATUS_CHANGED, + $statusChanged + ); + + return $this; + } + /** + * Get the passwordChanged. + * + * @return string + */ + public function getPasswordChanged(): string + { + return $this->getProperty(self::PASSWORD_CHANGED); + } + /** + * Set the passwordChanged. + * + * @param mixed $passwordChanged The value to set. + * @return self + */ + public function setPasswordChanged($passwordChanged) + { + $this->setProperty( + self::PASSWORD_CHANGED, + $passwordChanged + ); + + return $this; + } +} diff --git a/src/Generated/Applications/AppUserCredentials.php b/src/Generated/Applications/AppUserCredentials.php new file mode 100644 index 0000000000..a32ff763cb --- /dev/null +++ b/src/Generated/Applications/AppUserCredentials.php @@ -0,0 +1,79 @@ +getResourceProperty( + self::PASSWORD, + \Okta\Applications\PasswordCredential::class, + $options + ); + } + + /** + * Set the password. + * + * @param \Okta\Applications\PasswordCredential $password The PasswordCredential instance. + * @return self + */ + public function setPassword(PasswordCredential $password) + { + $this->setResourceProperty( + self::PASSWORD, + $password + ); + + return $this; + } + /** + * Get the userName. + * + * @return string + */ + public function getUserName(): string + { + return $this->getProperty(self::USER_NAME); + } + /** + * Set the userName. + * + * @param mixed $userName The value to set. + * @return self + */ + public function setUserName($userName) + { + $this->setProperty( + self::USER_NAME, + $userName + ); + + return $this; + } +} diff --git a/src/Generated/Applications/Application.php b/src/Generated/Applications/Application.php new file mode 100644 index 0000000000..87ef9b9030 --- /dev/null +++ b/src/Generated/Applications/Application.php @@ -0,0 +1,661 @@ +getDataStore() + ->getResource( + $query, + \Okta\Applications\Application::class, + "/apps" + ); + } + public function save() + { + return \Okta\Client::getInstance() + ->getDataStore() + ->saveResource( + "/apps", + $this, + \Okta\Applications\Application::class + ); + } + + public function delete() + { + return \Okta\Client::getInstance() + ->getDataStore() + ->deleteResource( + "/apps", + $this + ); + } + /** + * Get the id. + * + * @return string + */ + public function getId(): string + { + return $this->getProperty(self::ID); + } + /** + * Get the name. + * + * @return string + */ + public function getName(): string + { + return $this->getProperty(self::NAME); + } + /** + * Set the name. + * + * @param mixed $name The value to set. + * @return self + */ + public function setName($name) + { + $this->setProperty( + self::NAME, + $name + ); + + return $this; + } + /** + * Get the label. + * + * @return string + */ + public function getLabel(): string + { + return $this->getProperty(self::LABEL); + } + /** + * Set the label. + * + * @param mixed $label The value to set. + * @return self + */ + public function setLabel($label) + { + $this->setProperty( + self::LABEL, + $label + ); + + return $this; + } + /** + * Get the _links. + * + * @return \stdClass + */ + public function getLinks(): \stdClass + { + return $this->getProperty(self::LINKS); + } + /** + * Get the status. + * + * @return string + */ + public function getStatus(): string + { + return $this->getProperty(self::STATUS); + } + /** + * Set the status. + * + * @param mixed $status The value to set. + * @return self + */ + public function setStatus($status) + { + $this->setProperty( + self::STATUS, + $status + ); + + return $this; + } + /** + * Get the created. + * + * @return string + */ + public function getCreated(): string + { + return $this->getProperty(self::CREATED); + } + /** + * Set the created. + * + * @param mixed $created The value to set. + * @return self + */ + public function setCreated($created) + { + $this->setProperty( + self::CREATED, + $created + ); + + return $this; + } + /** + * Get the features. + * + * @return array + */ + public function getFeatures(): array + { + return $this->getProperty(self::FEATURES); + } + /** + * Set the features. + * + * @param mixed $features The value to set. + * @return self + */ + public function setFeatures($features) + { + $this->setProperty( + self::FEATURES, + $features + ); + + return $this; + } + /** + * Get the settings. + * + * @return \Okta\Applications\ApplicationSettings + */ + public function getSettings(array $options = []): \Okta\Applications\ApplicationSettings + { + return $this->getResourceProperty( + self::SETTINGS, + \Okta\Applications\ApplicationSettings::class, + $options + ); + } + + /** + * Set the settings. + * + * @param \Okta\Applications\ApplicationSettings $settings The ApplicationSettings instance. + * @return self + */ + public function setSettings(ApplicationSettings $settings) + { + $this->setResourceProperty( + self::SETTINGS, + $settings + ); + + return $this; + } + /** + * Get the _embedded. + * + * @return \stdClass + */ + public function getEmbedded(): \stdClass + { + return $this->getProperty(self::EMBEDDED); + } + /** + * Get the licensing. + * + * @return \Okta\Applications\ApplicationLicensing + */ + public function getLicensing(array $options = []): \Okta\Applications\ApplicationLicensing + { + return $this->getResourceProperty( + self::LICENSING, + \Okta\Applications\ApplicationLicensing::class, + $options + ); + } + + /** + * Set the licensing. + * + * @param \Okta\Applications\ApplicationLicensing $licensing The ApplicationLicensing instance. + * @return self + */ + public function setLicensing(ApplicationLicensing $licensing) + { + $this->setResourceProperty( + self::LICENSING, + $licensing + ); + + return $this; + } + /** + * Get the signOnMode. + * + * @return string + */ + public function getSignOnMode(): string + { + return $this->getProperty(self::SIGN_ON_MODE); + } + /** + * Set the signOnMode. + * + * @param mixed $signOnMode The value to set. + * @return self + */ + public function setSignOnMode($signOnMode) + { + $this->setProperty( + self::SIGN_ON_MODE, + $signOnMode + ); + + return $this; + } + /** + * Get the visibility. + * + * @return \Okta\Applications\ApplicationVisibility + */ + public function getVisibility(array $options = []): \Okta\Applications\ApplicationVisibility + { + return $this->getResourceProperty( + self::VISIBILITY, + \Okta\Applications\ApplicationVisibility::class, + $options + ); + } + + /** + * Set the visibility. + * + * @param \Okta\Applications\ApplicationVisibility $visibility The ApplicationVisibility instance. + * @return self + */ + public function setVisibility(ApplicationVisibility $visibility) + { + $this->setResourceProperty( + self::VISIBILITY, + $visibility + ); + + return $this; + } + /** + * Get the credentials. + * + * @return \Okta\Applications\ApplicationCredentials + */ + public function getCredentials(array $options = []): \Okta\Applications\ApplicationCredentials + { + return $this->getResourceProperty( + self::CREDENTIALS, + \Okta\Applications\ApplicationCredentials::class, + $options + ); + } + + /** + * Set the credentials. + * + * @param \Okta\Applications\ApplicationCredentials $credentials The ApplicationCredentials instance. + * @return self + */ + public function setCredentials(ApplicationCredentials $credentials) + { + $this->setResourceProperty( + self::CREDENTIALS, + $credentials + ); + + return $this; + } + /** + * Get the lastUpdated. + * + * @return \Carbon\Carbon|null + */ + public function getLastUpdated() + { + return $this->getDateProperty(self::LAST_UPDATED); + } + /** + * Get the accessibility. + * + * @return \Okta\Applications\ApplicationAccessibility + */ + public function getAccessibility(array $options = []): \Okta\Applications\ApplicationAccessibility + { + return $this->getResourceProperty( + self::ACCESSIBILITY, + \Okta\Applications\ApplicationAccessibility::class, + $options + ); + } + + /** + * Set the accessibility. + * + * @param \Okta\Applications\ApplicationAccessibility $accessibility The ApplicationAccessibility instance. + * @return self + */ + public function setAccessibility(ApplicationAccessibility $accessibility) + { + $this->setResourceProperty( + self::ACCESSIBILITY, + $accessibility + ); + + return $this; + } + + /** + * Activates an inactive application. + * + * + * @return mixed|null + */ + public function activate() + { + $uri = "/api/v1/apps/{$this->getId()}/lifecycle/activate"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri); + } + + /** + * Deactivates an active application. + * + * + * @return mixed|null + */ + public function deactivate() + { + $uri = "/api/v1/apps/{$this->getId()}/lifecycle/deactivate"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri); + } + + /** + * Get the AppUser object. + * + * @param array $options The options for the request. + * @return \Okta\Applications\Collection + */ + public function getApplicationUsers(array $options = []): \Okta\Applications\Collection + { + + return $this + ->getDataStore() + ->getCollection( + "/api/v1/apps/{$this->getId()}/users", + \Okta\Applications\AppUser::class, + \Okta\Applications\Collection::class, + $options + ); + } + + /** + * Assigns an user to an application with [credentials](#application-user-credentials-object) and an app-specific [profile](#application-user-profile-object). Profile mappings defined for the application are first applied before applying any profile properties specified in the request. + * + * + * @return mixed|null + */ + public function assignUserToApplication(AppUser $appUser) + { + $uri = "/api/v1/apps/{$this->getId()}/users"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri, $appUser); + } + + /** + * Fetches a specific user assignment for application by `id`. + * + * + * @return mixed|null + */ + public function getApplicationUser($userId) + { + $uri = "/api/v1/apps/{$this->getId()}/users/{$userId}"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + $response = $this + ->getDataStore() + ->getResource(); + + return $response; + } + + /** + * Updates a user's profile for an application + * + * + * @return mixed|null + */ + public function updateApplicationUser($userId, AppUser $appUser) + { + $uri = "/api/v1/apps/{$this->getId()}/users/{$userId}"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri, $appUser); + } + + /** + * Removes an assignment for a user from an application. + * + * + * @return mixed|null + */ + public function deleteApplicationUser($userId) + { + $uri = "/api/v1/apps/{$this->getId()}/users/{$userId}"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('DELETE', $uri); + } + + /** + * Assigns a group to an application + * + * + * @return mixed|null + */ + public function updateGroupApplicationAssignment($groupId, ApplicationGroupAssignment $applicationGroupAssignment) + { + $uri = "/api/v1/apps/{$this->getId()}/groups/{$groupId}"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('PUT', $uri, $applicationGroupAssignment); + } + + /** + * Fetches an application group assignment + * + * + * @return mixed|null + */ + public function getGroupApplicationAssignment($groupId) + { + $uri = "/api/v1/apps/{$this->getId()}/groups/{$groupId}"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + $response = $this + ->getDataStore() + ->getResource(); + + return $response; + } + + /** + * Removes a group assignment from an application. + * + * + * @return mixed|null + */ + public function deleteGroupApplicationAssignment($groupId) + { + $uri = "/api/v1/apps/{$this->getId()}/groups/{$groupId}"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('DELETE', $uri); + } + + /** + * Generates a new X.509 certificate for an application key credential + * + * + * @return mixed|null + */ + public function generateApplicationKey() + { + $uri = "/api/v1/apps/{$this->getId()}/credentials/keys/generate"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri); + } + + /** + * Clones a X.509 certificate for an application key credential from a source application to target application. + * + * + * @return mixed|null + */ + public function cloneApplicationKey($keyId) + { + $uri = "/api/v1/apps/{$this->getId()}/credentials/keys/{$keyId}/clone"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + return $this + ->getDataStore() + ->executeRequest('POST', $uri); + } + + /** + * Gets a specific [application key credential](#application-key-credential-model) by `kid` + * + * + * @return mixed|null + */ + public function getApplicationKey($keyId) + { + $uri = "/api/v1/apps/{$this->getId()}/credentials/keys/{$keyId}"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + $response = $this + ->getDataStore() + ->getResource(); + + return $response; + } + + /** + * Get the ApplicationGroupAssignment object. + * + * @param array $options The options for the request. + * @return \Okta\Applications\Collection + */ + public function getGroupAssignments(array $options = []): \Okta\Applications\Collection + { + + return $this + ->getDataStore() + ->getCollection( + "/api/v1/apps/{$this->getId()}/groups", + \Okta\Applications\ApplicationGroupAssignment::class, + \Okta\Applications\Collection::class, + $options + ); + } + + /** + * Get the JsonWebKeyRSAMediated object. + * + * @param array $options The options for the request. + * @return \Okta\Applications\Collection + */ + public function getKeys(array $options = []): \Okta\Applications\Collection + { + + return $this + ->getDataStore() + ->getCollection( + "/api/v1/apps/{$this->getId()}/credentials/keys", + \Okta\Applications\JsonWebKeyRSAMediated::class, + \Okta\Applications\Collection::class, + $options + ); + } +} diff --git a/src/Generated/Applications/ApplicationAccessibility.php b/src/Generated/Applications/ApplicationAccessibility.php new file mode 100644 index 0000000000..6f069f67c1 --- /dev/null +++ b/src/Generated/Applications/ApplicationAccessibility.php @@ -0,0 +1,99 @@ +getProperty(self::SELF_SERVICE); + } + /** + * Set the selfService. + * + * @param mixed $selfService The value to set. + * @return self + */ + public function setSelfService($selfService) + { + $this->setProperty( + self::SELF_SERVICE, + $selfService + ); + + return $this; + } + /** + * Get the errorRedirectUrl. + * + * @return string + */ + public function getErrorRedirectUrl(): string + { + return $this->getProperty(self::ERROR_REDIRECT_URL); + } + /** + * Set the errorRedirectUrl. + * + * @param mixed $errorRedirectUrl The value to set. + * @return self + */ + public function setErrorRedirectUrl($errorRedirectUrl) + { + $this->setProperty( + self::ERROR_REDIRECT_URL, + $errorRedirectUrl + ); + + return $this; + } + /** + * Get the loginRedirectUrl. + * + * @return string + */ + public function getLoginRedirectUrl(): string + { + return $this->getProperty(self::LOGIN_REDIRECT_URL); + } + /** + * Set the loginRedirectUrl. + * + * @param mixed $loginRedirectUrl The value to set. + * @return self + */ + public function setLoginRedirectUrl($loginRedirectUrl) + { + $this->setProperty( + self::LOGIN_REDIRECT_URL, + $loginRedirectUrl + ); + + return $this; + } +} diff --git a/src/Generated/Applications/ApplicationCredentials.php b/src/Generated/Applications/ApplicationCredentials.php new file mode 100644 index 0000000000..079a291954 --- /dev/null +++ b/src/Generated/Applications/ApplicationCredentials.php @@ -0,0 +1,84 @@ +getResourceProperty( + self::SIGNING, + \Okta\Applications\ApplicationCredentialsSigning::class, + $options + ); + } + + /** + * Set the signing. + * + * @param \Okta\Applications\ApplicationCredentialsSigning $signing The ApplicationCredentialsSigning instance. + * @return self + */ + public function setSigning(ApplicationCredentialsSigning $signing) + { + $this->setResourceProperty( + self::SIGNING, + $signing + ); + + return $this; + } + /** + * Get the userNameTemplate. + * + * @return \Okta\Applications\ApplicationCredentialsUsernameTemplate + */ + public function getUserNameTemplate(array $options = []): \Okta\Applications\ApplicationCredentialsUsernameTemplate + { + return $this->getResourceProperty( + self::USER_NAME_TEMPLATE, + \Okta\Applications\ApplicationCredentialsUsernameTemplate::class, + $options + ); + } + + /** + * Set the userNameTemplate. + * + * @param \Okta\Applications\ApplicationCredentialsUsernameTemplate $userNameTemplate The ApplicationCredentialsUsernameTemplate instance. + * @return self + */ + public function setUserNameTemplate(ApplicationCredentialsUsernameTemplate $userNameTemplate) + { + $this->setResourceProperty( + self::USER_NAME_TEMPLATE, + $userNameTemplate + ); + + return $this; + } +} diff --git a/src/Generated/Applications/ApplicationCredentialsOAuthClient.php b/src/Generated/Applications/ApplicationCredentialsOAuthClient.php new file mode 100644 index 0000000000..0a959c602e --- /dev/null +++ b/src/Generated/Applications/ApplicationCredentialsOAuthClient.php @@ -0,0 +1,124 @@ +getProperty(self::CLIENT_ID); + } + /** + * Set the client_id. + * + * @param mixed $client_id The value to set. + * @return self + */ + public function setClientId($client_id) + { + $this->setProperty( + self::CLIENT_ID, + $client_id + ); + + return $this; + } + /** + * Get the client_secret. + * + * @return string + */ + public function getClientSecret(): string + { + return $this->getProperty(self::CLIENT_SECRET); + } + /** + * Set the client_secret. + * + * @param mixed $client_secret The value to set. + * @return self + */ + public function setClientSecret($client_secret) + { + $this->setProperty( + self::CLIENT_SECRET, + $client_secret + ); + + return $this; + } + /** + * Get the autoKeyRotation. + * + * @return bool + */ + public function getAutoKeyRotation(): bool + { + return $this->getProperty(self::AUTO_KEY_ROTATION); + } + /** + * Set the autoKeyRotation. + * + * @param mixed $autoKeyRotation The value to set. + * @return self + */ + public function setAutoKeyRotation($autoKeyRotation) + { + $this->setProperty( + self::AUTO_KEY_ROTATION, + $autoKeyRotation + ); + + return $this; + } + /** + * Get the token_endpoint_auth_method. + * + * @return string + */ + public function getTokenEndpointAuthMethod(): string + { + return $this->getProperty(self::TOKEN_ENDPOINT_AUTH_METHOD); + } + /** + * Set the token_endpoint_auth_method. + * + * @param mixed $token_endpoint_auth_method The value to set. + * @return self + */ + public function setTokenEndpointAuthMethod($token_endpoint_auth_method) + { + $this->setProperty( + self::TOKEN_ENDPOINT_AUTH_METHOD, + $token_endpoint_auth_method + ); + + return $this; + } +} diff --git a/src/Generated/Applications/ApplicationCredentialsScheme.php b/src/Generated/Applications/ApplicationCredentialsScheme.php new file mode 100644 index 0000000000..bcb299a81b --- /dev/null +++ b/src/Generated/Applications/ApplicationCredentialsScheme.php @@ -0,0 +1,29 @@ +getProperty(self::KID); + } + /** + * Set the kid. + * + * @param mixed $kid The value to set. + * @return self + */ + public function setKid($kid) + { + $this->setProperty( + self::KID, + $kid + ); + + return $this; + } + /** + * Get the lastRotated. + * + * @return string + */ + public function getLastRotated(): string + { + return $this->getProperty(self::LAST_ROTATED); + } + /** + * Set the lastRotated. + * + * @param mixed $lastRotated The value to set. + * @return self + */ + public function setLastRotated($lastRotated) + { + $this->setProperty( + self::LAST_ROTATED, + $lastRotated + ); + + return $this; + } + /** + * Get the nextRotation. + * + * @return string + */ + public function getNextRotation(): string + { + return $this->getProperty(self::NEXT_ROTATION); + } + /** + * Set the nextRotation. + * + * @param mixed $nextRotation The value to set. + * @return self + */ + public function setNextRotation($nextRotation) + { + $this->setProperty( + self::NEXT_ROTATION, + $nextRotation + ); + + return $this; + } + /** + * Get the rotationMode. + * + * @return string + */ + public function getRotationMode(): string + { + return $this->getProperty(self::ROTATION_MODE); + } + /** + * Set the rotationMode. + * + * @param mixed $rotationMode The value to set. + * @return self + */ + public function setRotationMode($rotationMode) + { + $this->setProperty( + self::ROTATION_MODE, + $rotationMode + ); + + return $this; + } +} diff --git a/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php b/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php new file mode 100644 index 0000000000..af1fd53a3b --- /dev/null +++ b/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php @@ -0,0 +1,99 @@ +getProperty(self::TYPE); + } + /** + * Set the type. + * + * @param mixed $type The value to set. + * @return self + */ + public function setType($type) + { + $this->setProperty( + self::TYPE, + $type + ); + + return $this; + } + /** + * Get the suffix. + * + * @return string + */ + public function getSuffix(): string + { + return $this->getProperty(self::SUFFIX); + } + /** + * Set the suffix. + * + * @param mixed $suffix The value to set. + * @return self + */ + public function setSuffix($suffix) + { + $this->setProperty( + self::SUFFIX, + $suffix + ); + + return $this; + } + /** + * Get the template. + * + * @return string + */ + public function getTemplate(): string + { + return $this->getProperty(self::TEMPLATE); + } + /** + * Set the template. + * + * @param mixed $template The value to set. + * @return self + */ + public function setTemplate($template) + { + $this->setProperty( + self::TEMPLATE, + $template + ); + + return $this; + } +} diff --git a/src/Generated/Applications/ApplicationGroupAssignment.php b/src/Generated/Applications/ApplicationGroupAssignment.php new file mode 100644 index 0000000000..9a2a3dc229 --- /dev/null +++ b/src/Generated/Applications/ApplicationGroupAssignment.php @@ -0,0 +1,129 @@ +getProperty(self::ID); + } + /** + * Get the _links. + * + * @return \stdClass + */ + public function getLinks(): \stdClass + { + return $this->getProperty(self::LINKS); + } + /** + * Get the profile. + * + * @return \stdClass + */ + public function getProfile(): \stdClass + { + return $this->getProperty(self::PROFILE); + } + /** + * Set the profile. + * + * @param mixed $profile The value to set. + * @return self + */ + public function setProfile($profile) + { + $this->setProperty( + self::PROFILE, + $profile + ); + + return $this; + } + /** + * Get the priority. + * + * @return int + */ + public function getPriority(): int + { + return $this->getProperty(self::PRIORITY); + } + /** + * Set the priority. + * + * @param mixed $priority The value to set. + * @return self + */ + public function setPriority($priority) + { + $this->setProperty( + self::PRIORITY, + $priority + ); + + return $this; + } + /** + * Get the _embedded. + * + * @return \stdClass + */ + public function getEmbedded(): \stdClass + { + return $this->getProperty(self::EMBEDDED); + } + /** + * Get the lastUpdated. + * + * @return string + */ + public function getLastUpdated(): string + { + return $this->getProperty(self::LAST_UPDATED); + } + /** + * Set the lastUpdated. + * + * @param mixed $lastUpdated The value to set. + * @return self + */ + public function setLastUpdated($lastUpdated) + { + $this->setProperty( + self::LAST_UPDATED, + $lastUpdated + ); + + return $this; + } +} diff --git a/src/Generated/Applications/ApplicationLicensing.php b/src/Generated/Applications/ApplicationLicensing.php new file mode 100644 index 0000000000..6fca782ed0 --- /dev/null +++ b/src/Generated/Applications/ApplicationLicensing.php @@ -0,0 +1,49 @@ +getProperty(self::SEAT_COUNT); + } + /** + * Set the seatCount. + * + * @param mixed $seatCount The value to set. + * @return self + */ + public function setSeatCount($seatCount) + { + $this->setProperty( + self::SEAT_COUNT, + $seatCount + ); + + return $this; + } +} diff --git a/src/Generated/Applications/ApplicationSettings.php b/src/Generated/Applications/ApplicationSettings.php new file mode 100644 index 0000000000..6e50f6a92e --- /dev/null +++ b/src/Generated/Applications/ApplicationSettings.php @@ -0,0 +1,84 @@ +getResourceProperty( + self::APP, + \Okta\Applications\object::class, + $options + ); + } + + /** + * Set the app. + * + * @param \Okta\Applications\object $app The object instance. + * @return self + */ + public function setApp(object $app) + { + $this->setResourceProperty( + self::APP, + $app + ); + + return $this; + } + /** + * Get the notifications. + * + * @return \Okta\Applications\ApplicationSettingsNotifications + */ + public function getNotifications(array $options = []): \Okta\Applications\ApplicationSettingsNotifications + { + return $this->getResourceProperty( + self::NOTIFICATIONS, + \Okta\Applications\ApplicationSettingsNotifications::class, + $options + ); + } + + /** + * Set the notifications. + * + * @param \Okta\Applications\ApplicationSettingsNotifications $notifications The ApplicationSettingsNotifications instance. + * @return self + */ + public function setNotifications(ApplicationSettingsNotifications $notifications) + { + $this->setResourceProperty( + self::NOTIFICATIONS, + $notifications + ); + + return $this; + } +} diff --git a/src/Generated/Applications/ApplicationSettingsApplication.php b/src/Generated/Applications/ApplicationSettingsApplication.php new file mode 100644 index 0000000000..a7820e281e --- /dev/null +++ b/src/Generated/Applications/ApplicationSettingsApplication.php @@ -0,0 +1,24 @@ +getResourceProperty( + self::VPN, + \Okta\Applications\ApplicationSettingsNotificationsVpn::class, + $options + ); + } + + /** + * Set the vpn. + * + * @param \Okta\Applications\ApplicationSettingsNotificationsVpn $vpn The ApplicationSettingsNotificationsVpn instance. + * @return self + */ + public function setVpn(ApplicationSettingsNotificationsVpn $vpn) + { + $this->setResourceProperty( + self::VPN, + $vpn + ); + + return $this; + } +} diff --git a/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php b/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php new file mode 100644 index 0000000000..26475c943b --- /dev/null +++ b/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php @@ -0,0 +1,104 @@ +getProperty(self::HELP_URL); + } + /** + * Set the helpUrl. + * + * @param mixed $helpUrl The value to set. + * @return self + */ + public function setHelpUrl($helpUrl) + { + $this->setProperty( + self::HELP_URL, + $helpUrl + ); + + return $this; + } + /** + * Get the message. + * + * @return string + */ + public function getMessage(): string + { + return $this->getProperty(self::MESSAGE); + } + /** + * Set the message. + * + * @param mixed $message The value to set. + * @return self + */ + public function setMessage($message) + { + $this->setProperty( + self::MESSAGE, + $message + ); + + return $this; + } + /** + * Get the network. + * + * @return \Okta\Applications\ApplicationSettingsNotificationsVpnNetwork + */ + public function getNetwork(array $options = []): \Okta\Applications\ApplicationSettingsNotificationsVpnNetwork + { + return $this->getResourceProperty( + self::NETWORK, + \Okta\Applications\ApplicationSettingsNotificationsVpnNetwork::class, + $options + ); + } + + /** + * Set the network. + * + * @param \Okta\Applications\ApplicationSettingsNotificationsVpnNetwork $network The ApplicationSettingsNotificationsVpnNetwork instance. + * @return self + */ + public function setNetwork(ApplicationSettingsNotificationsVpnNetwork $network) + { + $this->setResourceProperty( + self::NETWORK, + $network + ); + + return $this; + } +} diff --git a/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php b/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php new file mode 100644 index 0000000000..5447fb8e71 --- /dev/null +++ b/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php @@ -0,0 +1,99 @@ +getProperty(self::EXCLUDE); + } + /** + * Set the exclude. + * + * @param mixed $exclude The value to set. + * @return self + */ + public function setExclude($exclude) + { + $this->setProperty( + self::EXCLUDE, + $exclude + ); + + return $this; + } + /** + * Get the include. + * + * @return array + */ + public function getInclude(): array + { + return $this->getProperty(self::INCLUDE); + } + /** + * Set the include. + * + * @param mixed $include The value to set. + * @return self + */ + public function setInclude($include) + { + $this->setProperty( + self::INCLUDE, + $include + ); + + return $this; + } + /** + * Get the connection. + * + * @return string + */ + public function getConnection(): string + { + return $this->getProperty(self::CONNECTION); + } + /** + * Set the connection. + * + * @param mixed $connection The value to set. + * @return self + */ + public function setConnection($connection) + { + $this->setProperty( + self::CONNECTION, + $connection + ); + + return $this; + } +} diff --git a/src/Generated/Applications/ApplicationSignOnMode.php b/src/Generated/Applications/ApplicationSignOnMode.php new file mode 100644 index 0000000000..6c5dadd90a --- /dev/null +++ b/src/Generated/Applications/ApplicationSignOnMode.php @@ -0,0 +1,32 @@ +getResourceProperty( + self::HIDE, + \Okta\Applications\ApplicationVisibilityHide::class, + $options + ); + } + + /** + * Set the hide. + * + * @param \Okta\Applications\ApplicationVisibilityHide $hide The ApplicationVisibilityHide instance. + * @return self + */ + public function setHide(ApplicationVisibilityHide $hide) + { + $this->setResourceProperty( + self::HIDE, + $hide + ); + + return $this; + } + /** + * Get the appLinks. + * + * @return \stdClass + */ + public function getAppLinks(): \stdClass + { + return $this->getProperty(self::APP_LINKS); + } + /** + * Set the appLinks. + * + * @param mixed $appLinks The value to set. + * @return self + */ + public function setAppLinks($appLinks) + { + $this->setProperty( + self::APP_LINKS, + $appLinks + ); + + return $this; + } + /** + * Get the autoSubmitToolbar. + * + * @return bool + */ + public function getAutoSubmitToolbar(): bool + { + return $this->getProperty(self::AUTO_SUBMIT_TOOLBAR); + } + /** + * Set the autoSubmitToolbar. + * + * @param mixed $autoSubmitToolbar The value to set. + * @return self + */ + public function setAutoSubmitToolbar($autoSubmitToolbar) + { + $this->setProperty( + self::AUTO_SUBMIT_TOOLBAR, + $autoSubmitToolbar + ); + + return $this; + } +} diff --git a/src/Generated/Applications/ApplicationVisibilityHide.php b/src/Generated/Applications/ApplicationVisibilityHide.php new file mode 100644 index 0000000000..ce533144bf --- /dev/null +++ b/src/Generated/Applications/ApplicationVisibilityHide.php @@ -0,0 +1,74 @@ +getProperty(self::I_OS); + } + /** + * Set the iOS. + * + * @param mixed $iOS The value to set. + * @return self + */ + public function setIOs($iOS) + { + $this->setProperty( + self::I_OS, + $iOS + ); + + return $this; + } + /** + * Get the web. + * + * @return bool + */ + public function getWeb(): bool + { + return $this->getProperty(self::WEB); + } + /** + * Set the web. + * + * @param mixed $web The value to set. + * @return self + */ + public function setWeb($web) + { + $this->setProperty( + self::WEB, + $web + ); + + return $this; + } +} diff --git a/src/Generated/Applications/AutoLoginApplication.php b/src/Generated/Applications/AutoLoginApplication.php new file mode 100644 index 0000000000..99d7a3ce96 --- /dev/null +++ b/src/Generated/Applications/AutoLoginApplication.php @@ -0,0 +1,84 @@ +getResourceProperty( + self::SETTINGS, + \Okta\Applications\AutoLoginApplicationSettings::class, + $options + ); + } + + /** + * Set the settings. + * + * @param \Okta\Applications\AutoLoginApplicationSettings $settings The AutoLoginApplicationSettings instance. + * @return self + */ + public function setSettings(AutoLoginApplicationSettings $settings) + { + $this->setResourceProperty( + self::SETTINGS, + $settings + ); + + return $this; + } + /** + * Get the credentials. + * + * @return \Okta\Applications\SchemeApplicationCredentials + */ + public function getCredentials(array $options = []): \Okta\Applications\SchemeApplicationCredentials + { + return $this->getResourceProperty( + self::CREDENTIALS, + \Okta\Applications\SchemeApplicationCredentials::class, + $options + ); + } + + /** + * Set the credentials. + * + * @param \Okta\Applications\SchemeApplicationCredentials $credentials The SchemeApplicationCredentials instance. + * @return self + */ + public function setCredentials(SchemeApplicationCredentials $credentials) + { + $this->setResourceProperty( + self::CREDENTIALS, + $credentials + ); + + return $this; + } +} diff --git a/src/Generated/Applications/AutoLoginApplicationSettings.php b/src/Generated/Applications/AutoLoginApplicationSettings.php new file mode 100644 index 0000000000..9edd947581 --- /dev/null +++ b/src/Generated/Applications/AutoLoginApplicationSettings.php @@ -0,0 +1,54 @@ +getResourceProperty( + self::SIGN_ON, + \Okta\Applications\AutoLoginApplicationSettingsSignOn::class, + $options + ); + } + + /** + * Set the signOn. + * + * @param \Okta\Applications\AutoLoginApplicationSettingsSignOn $signOn The AutoLoginApplicationSettingsSignOn instance. + * @return self + */ + public function setSignOn(AutoLoginApplicationSettingsSignOn $signOn) + { + $this->setResourceProperty( + self::SIGN_ON, + $signOn + ); + + return $this; + } +} diff --git a/src/Generated/Applications/AutoLoginApplicationSettingsSignOn.php b/src/Generated/Applications/AutoLoginApplicationSettingsSignOn.php new file mode 100644 index 0000000000..c0af74dfb0 --- /dev/null +++ b/src/Generated/Applications/AutoLoginApplicationSettingsSignOn.php @@ -0,0 +1,74 @@ +getProperty(self::LOGIN_URL); + } + /** + * Set the loginUrl. + * + * @param mixed $loginUrl The value to set. + * @return self + */ + public function setLoginUrl($loginUrl) + { + $this->setProperty( + self::LOGIN_URL, + $loginUrl + ); + + return $this; + } + /** + * Get the redirectUrl. + * + * @return string + */ + public function getRedirectUrl(): string + { + return $this->getProperty(self::REDIRECT_URL); + } + /** + * Set the redirectUrl. + * + * @param mixed $redirectUrl The value to set. + * @return self + */ + public function setRedirectUrl($redirectUrl) + { + $this->setProperty( + self::REDIRECT_URL, + $redirectUrl + ); + + return $this; + } +} diff --git a/src/Generated/Applications/BasicApplicationSettings.php b/src/Generated/Applications/BasicApplicationSettings.php new file mode 100644 index 0000000000..e012ef935c --- /dev/null +++ b/src/Generated/Applications/BasicApplicationSettings.php @@ -0,0 +1,54 @@ +getResourceProperty( + self::APP, + \Okta\Applications\BasicApplicationSettingsApplication::class, + $options + ); + } + + /** + * Set the app. + * + * @param \Okta\Applications\BasicApplicationSettingsApplication $app The BasicApplicationSettingsApplication instance. + * @return self + */ + public function setApp(BasicApplicationSettingsApplication $app) + { + $this->setResourceProperty( + self::APP, + $app + ); + + return $this; + } +} diff --git a/src/Generated/Applications/BasicApplicationSettingsApplication.php b/src/Generated/Applications/BasicApplicationSettingsApplication.php new file mode 100644 index 0000000000..f2b3632589 --- /dev/null +++ b/src/Generated/Applications/BasicApplicationSettingsApplication.php @@ -0,0 +1,74 @@ +getProperty(self::URL); + } + /** + * Set the url. + * + * @param mixed $url The value to set. + * @return self + */ + public function setUrl($url) + { + $this->setProperty( + self::URL, + $url + ); + + return $this; + } + /** + * Get the authURL. + * + * @return string + */ + public function getAuthUrl(): string + { + return $this->getProperty(self::AUTH_URL); + } + /** + * Set the authURL. + * + * @param mixed $authURL The value to set. + * @return self + */ + public function setAuthUrl($authURL) + { + $this->setProperty( + self::AUTH_URL, + $authURL + ); + + return $this; + } +} diff --git a/src/Generated/Applications/BasicAuthApplication.php b/src/Generated/Applications/BasicAuthApplication.php new file mode 100644 index 0000000000..8494193f3c --- /dev/null +++ b/src/Generated/Applications/BasicAuthApplication.php @@ -0,0 +1,84 @@ +getResourceProperty( + self::SETTINGS, + \Okta\Applications\BasicApplicationSettings::class, + $options + ); + } + + /** + * Set the settings. + * + * @param \Okta\Applications\BasicApplicationSettings $settings The BasicApplicationSettings instance. + * @return self + */ + public function setSettings(BasicApplicationSettings $settings) + { + $this->setResourceProperty( + self::SETTINGS, + $settings + ); + + return $this; + } + /** + * Get the credentials. + * + * @return \Okta\Applications\SchemeApplicationCredentials + */ + public function getCredentials(array $options = []): \Okta\Applications\SchemeApplicationCredentials + { + return $this->getResourceProperty( + self::CREDENTIALS, + \Okta\Applications\SchemeApplicationCredentials::class, + $options + ); + } + + /** + * Set the credentials. + * + * @param \Okta\Applications\SchemeApplicationCredentials $credentials The SchemeApplicationCredentials instance. + * @return self + */ + public function setCredentials(SchemeApplicationCredentials $credentials) + { + $this->setResourceProperty( + self::CREDENTIALS, + $credentials + ); + + return $this; + } +} diff --git a/src/Generated/Applications/BookmarkApplication.php b/src/Generated/Applications/BookmarkApplication.php new file mode 100644 index 0000000000..031dac5802 --- /dev/null +++ b/src/Generated/Applications/BookmarkApplication.php @@ -0,0 +1,54 @@ +getResourceProperty( + self::SETTINGS, + \Okta\Applications\BookmarkApplicationSettings::class, + $options + ); + } + + /** + * Set the settings. + * + * @param \Okta\Applications\BookmarkApplicationSettings $settings The BookmarkApplicationSettings instance. + * @return self + */ + public function setSettings(BookmarkApplicationSettings $settings) + { + $this->setResourceProperty( + self::SETTINGS, + $settings + ); + + return $this; + } +} diff --git a/src/Generated/Applications/BookmarkApplicationSettings.php b/src/Generated/Applications/BookmarkApplicationSettings.php new file mode 100644 index 0000000000..0b49e3a761 --- /dev/null +++ b/src/Generated/Applications/BookmarkApplicationSettings.php @@ -0,0 +1,54 @@ +getResourceProperty( + self::APP, + \Okta\Applications\BookmarkApplicationSettingsApplication::class, + $options + ); + } + + /** + * Set the app. + * + * @param \Okta\Applications\BookmarkApplicationSettingsApplication $app The BookmarkApplicationSettingsApplication instance. + * @return self + */ + public function setApp(BookmarkApplicationSettingsApplication $app) + { + $this->setResourceProperty( + self::APP, + $app + ); + + return $this; + } +} diff --git a/src/Generated/Applications/BookmarkApplicationSettingsApplication.php b/src/Generated/Applications/BookmarkApplicationSettingsApplication.php new file mode 100644 index 0000000000..557bfaec8a --- /dev/null +++ b/src/Generated/Applications/BookmarkApplicationSettingsApplication.php @@ -0,0 +1,74 @@ +getProperty(self::URL); + } + /** + * Set the url. + * + * @param mixed $url The value to set. + * @return self + */ + public function setUrl($url) + { + $this->setProperty( + self::URL, + $url + ); + + return $this; + } + /** + * Get the requestIntegration. + * + * @return bool + */ + public function getRequestIntegration(): bool + { + return $this->getProperty(self::REQUEST_INTEGRATION); + } + /** + * Set the requestIntegration. + * + * @param mixed $requestIntegration The value to set. + * @return self + */ + public function setRequestIntegration($requestIntegration) + { + $this->setProperty( + self::REQUEST_INTEGRATION, + $requestIntegration + ); + + return $this; + } +} diff --git a/src/Generated/Applications/BrowserPluginApplication.php b/src/Generated/Applications/BrowserPluginApplication.php new file mode 100644 index 0000000000..bd13a9a00c --- /dev/null +++ b/src/Generated/Applications/BrowserPluginApplication.php @@ -0,0 +1,54 @@ +getResourceProperty( + self::CREDENTIALS, + \Okta\Applications\SchemeApplicationCredentials::class, + $options + ); + } + + /** + * Set the credentials. + * + * @param \Okta\Applications\SchemeApplicationCredentials $credentials The SchemeApplicationCredentials instance. + * @return self + */ + public function setCredentials(SchemeApplicationCredentials $credentials) + { + $this->setResourceProperty( + self::CREDENTIALS, + $credentials + ); + + return $this; + } +} diff --git a/src/Generated/Applications/Collection.php b/src/Generated/Applications/Collection.php new file mode 100644 index 0000000000..2f3c6c759f --- /dev/null +++ b/src/Generated/Applications/Collection.php @@ -0,0 +1,25 @@ +getProperty(self::E); + } + /** + * Get the n. + * + * @return string + */ + public function getN(): string + { + return $this->getProperty(self::N); + } + /** + * Get the alg. + * + * @return string + */ + public function getAlg(): string + { + return $this->getProperty(self::ALG); + } + /** + * Get the kid. + * + * @return string + */ + public function getKid(): string + { + return $this->getProperty(self::KID); + } + /** + * Get the kty. + * + * @return string + */ + public function getKty(): string + { + return $this->getProperty(self::KTY); + } + /** + * Get the use. + * + * @return string + */ + public function getUse(): string + { + return $this->getProperty(self::USE); + } + /** + * Get the x5c. + * + * @return array + */ + public function getX5C(): array + { + return $this->getProperty(self::X_5_C); + } + /** + * Get the x5t. + * + * @return string + */ + public function getX5T(): string + { + return $this->getProperty(self::X_5_T); + } + /** + * Get the x5u. + * + * @return string + */ + public function getX5U(): string + { + return $this->getProperty(self::X_5_U); + } + /** + * Get the status. + * + * @return string + */ + public function getStatus(): string + { + return $this->getProperty(self::STATUS); + } + /** + * Get the created. + * + * @return string + */ + public function getCreated(): string + { + return $this->getProperty(self::CREATED); + } + /** + * Get the key_ops. + * + * @return array + */ + public function getKeyOps(): array + { + return $this->getProperty(self::KEY_OPS); + } + /** + * Get the x5t#S256. + * + * @return string + */ + public function getX5TS256(): string + { + return $this->getProperty(self::X_5_T_S_256); + } + /** + * Get the expiresAt. + * + * @return string + */ + public function getExpiresAt(): string + { + return $this->getProperty(self::EXPIRES_AT); + } + /** + * Get the lastUpdated. + * + * @return string + */ + public function getLastUpdated(): string + { + return $this->getProperty(self::LAST_UPDATED); + } +} diff --git a/src/Generated/Applications/OAuthApplicationCredentials.php b/src/Generated/Applications/OAuthApplicationCredentials.php new file mode 100644 index 0000000000..9389bc15f2 --- /dev/null +++ b/src/Generated/Applications/OAuthApplicationCredentials.php @@ -0,0 +1,54 @@ +getResourceProperty( + self::OAUTH_CLIENT, + \Okta\Applications\ApplicationCredentialsOAuthClient::class, + $options + ); + } + + /** + * Set the oauthClient. + * + * @param \Okta\Applications\ApplicationCredentialsOAuthClient $oauthClient The ApplicationCredentialsOAuthClient instance. + * @return self + */ + public function setOauthClient(ApplicationCredentialsOAuthClient $oauthClient) + { + $this->setResourceProperty( + self::OAUTH_CLIENT, + $oauthClient + ); + + return $this; + } +} diff --git a/src/Generated/Applications/OAuthEndpointAuthenticationMethod.php b/src/Generated/Applications/OAuthEndpointAuthenticationMethod.php new file mode 100644 index 0000000000..28ed0a6167 --- /dev/null +++ b/src/Generated/Applications/OAuthEndpointAuthenticationMethod.php @@ -0,0 +1,28 @@ +getResourceProperty( + self::SETTINGS, + \Okta\Applications\OpenIdConnectApplicationSettings::class, + $options + ); + } + + /** + * Set the settings. + * + * @param \Okta\Applications\OpenIdConnectApplicationSettings $settings The OpenIdConnectApplicationSettings instance. + * @return self + */ + public function setSettings(OpenIdConnectApplicationSettings $settings) + { + $this->setResourceProperty( + self::SETTINGS, + $settings + ); + + return $this; + } + /** + * Get the credentials. + * + * @return \Okta\Applications\OAuthApplicationCredentials + */ + public function getCredentials(array $options = []): \Okta\Applications\OAuthApplicationCredentials + { + return $this->getResourceProperty( + self::CREDENTIALS, + \Okta\Applications\OAuthApplicationCredentials::class, + $options + ); + } + + /** + * Set the credentials. + * + * @param \Okta\Applications\OAuthApplicationCredentials $credentials The OAuthApplicationCredentials instance. + * @return self + */ + public function setCredentials(OAuthApplicationCredentials $credentials) + { + $this->setResourceProperty( + self::CREDENTIALS, + $credentials + ); + + return $this; + } +} diff --git a/src/Generated/Applications/OpenIdConnectApplicationConsentMethod.php b/src/Generated/Applications/OpenIdConnectApplicationConsentMethod.php new file mode 100644 index 0000000000..c50354e2e5 --- /dev/null +++ b/src/Generated/Applications/OpenIdConnectApplicationConsentMethod.php @@ -0,0 +1,26 @@ +getResourceProperty( + self::OAUTH_CLIENT, + \Okta\Applications\OpenIdConnectApplicationSettingsClient::class, + $options + ); + } + + /** + * Set the oauthClient. + * + * @param \Okta\Applications\OpenIdConnectApplicationSettingsClient $oauthClient The OpenIdConnectApplicationSettingsClient instance. + * @return self + */ + public function setOauthClient(OpenIdConnectApplicationSettingsClient $oauthClient) + { + $this->setResourceProperty( + self::OAUTH_CLIENT, + $oauthClient + ); + + return $this; + } +} diff --git a/src/Generated/Applications/OpenIdConnectApplicationSettingsClient.php b/src/Generated/Applications/OpenIdConnectApplicationSettingsClient.php new file mode 100644 index 0000000000..22fab0abfb --- /dev/null +++ b/src/Generated/Applications/OpenIdConnectApplicationSettingsClient.php @@ -0,0 +1,249 @@ +getProperty(self::TOS_URI); + } + /** + * Set the tos_uri. + * + * @param mixed $tos_uri The value to set. + * @return self + */ + public function setTosUri($tos_uri) + { + $this->setProperty( + self::TOS_URI, + $tos_uri + ); + + return $this; + } + /** + * Get the logo_uri. + * + * @return string + */ + public function getLogoUri(): string + { + return $this->getProperty(self::LOGO_URI); + } + /** + * Set the logo_uri. + * + * @param mixed $logo_uri The value to set. + * @return self + */ + public function setLogoUri($logo_uri) + { + $this->setProperty( + self::LOGO_URI, + $logo_uri + ); + + return $this; + } + /** + * Get the client_uri. + * + * @return string + */ + public function getClientUri(): string + { + return $this->getProperty(self::CLIENT_URI); + } + /** + * Set the client_uri. + * + * @param mixed $client_uri The value to set. + * @return self + */ + public function setClientUri($client_uri) + { + $this->setProperty( + self::CLIENT_URI, + $client_uri + ); + + return $this; + } + /** + * Get the policy_uri. + * + * @return string + */ + public function getPolicyUri(): string + { + return $this->getProperty(self::POLICY_URI); + } + /** + * Set the policy_uri. + * + * @param mixed $policy_uri The value to set. + * @return self + */ + public function setPolicyUri($policy_uri) + { + $this->setProperty( + self::POLICY_URI, + $policy_uri + ); + + return $this; + } + /** + * Get the grant_types. + * + * @return array + */ + public function getGrantTypes(): array + { + return $this->getProperty(self::GRANT_TYPES); + } + /** + * Set the grant_types. + * + * @param mixed $grant_types The value to set. + * @return self + */ + public function setGrantTypes($grant_types) + { + $this->setProperty( + self::GRANT_TYPES, + $grant_types + ); + + return $this; + } + /** + * Get the redirect_uris. + * + * @return array + */ + public function getRedirectUris(): array + { + return $this->getProperty(self::REDIRECT_URIS); + } + /** + * Set the redirect_uris. + * + * @param mixed $redirect_uris The value to set. + * @return self + */ + public function setRedirectUris($redirect_uris) + { + $this->setProperty( + self::REDIRECT_URIS, + $redirect_uris + ); + + return $this; + } + /** + * Get the consent_method. + * + * @return string + */ + public function getConsentMethod(): string + { + return $this->getProperty(self::CONSENT_METHOD); + } + /** + * Set the consent_method. + * + * @param mixed $consent_method The value to set. + * @return self + */ + public function setConsentMethod($consent_method) + { + $this->setProperty( + self::CONSENT_METHOD, + $consent_method + ); + + return $this; + } + /** + * Get the response_types. + * + * @return array + */ + public function getResponseTypes(): array + { + return $this->getProperty(self::RESPONSE_TYPES); + } + /** + * Set the response_types. + * + * @param mixed $response_types The value to set. + * @return self + */ + public function setResponseTypes($response_types) + { + $this->setProperty( + self::RESPONSE_TYPES, + $response_types + ); + + return $this; + } + /** + * Get the application_type. + * + * @return string + */ + public function getApplicationType(): string + { + return $this->getProperty(self::APPLICATION_TYPE); + } + /** + * Set the application_type. + * + * @param mixed $application_type The value to set. + * @return self + */ + public function setApplicationType($application_type) + { + $this->setProperty( + self::APPLICATION_TYPE, + $application_type + ); + + return $this; + } +} diff --git a/src/Generated/Applications/OpenIdConnectApplicationType.php b/src/Generated/Applications/OpenIdConnectApplicationType.php new file mode 100644 index 0000000000..df2289768e --- /dev/null +++ b/src/Generated/Applications/OpenIdConnectApplicationType.php @@ -0,0 +1,28 @@ +getResourceProperty( + self::SETTINGS, + \Okta\Applications\SamlApplicationSettings::class, + $options + ); + } + + /** + * Set the settings. + * + * @param \Okta\Applications\SamlApplicationSettings $settings The SamlApplicationSettings instance. + * @return self + */ + public function setSettings(SamlApplicationSettings $settings) + { + $this->setResourceProperty( + self::SETTINGS, + $settings + ); + + return $this; + } +} diff --git a/src/Generated/Applications/SamlApplicationSettings.php b/src/Generated/Applications/SamlApplicationSettings.php new file mode 100644 index 0000000000..38c836330a --- /dev/null +++ b/src/Generated/Applications/SamlApplicationSettings.php @@ -0,0 +1,54 @@ +getResourceProperty( + self::SIGN_ON, + \Okta\Applications\SamlApplicationSettingsSignOn::class, + $options + ); + } + + /** + * Set the signOn. + * + * @param \Okta\Applications\SamlApplicationSettingsSignOn $signOn The SamlApplicationSettingsSignOn instance. + * @return self + */ + public function setSignOn(SamlApplicationSettingsSignOn $signOn) + { + $this->setResourceProperty( + self::SIGN_ON, + $signOn + ); + + return $this; + } +} diff --git a/src/Generated/Applications/SamlApplicationSettingsSignOn.php b/src/Generated/Applications/SamlApplicationSettingsSignOn.php new file mode 100644 index 0000000000..a0d202b4e8 --- /dev/null +++ b/src/Generated/Applications/SamlApplicationSettingsSignOn.php @@ -0,0 +1,549 @@ +getProperty(self::AUDIENCE); + } + /** + * Set the audience. + * + * @param mixed $audience The value to set. + * @return self + */ + public function setAudience($audience) + { + $this->setProperty( + self::AUDIENCE, + $audience + ); + + return $this; + } + /** + * Get the spIssuer. + * + * @return string + */ + public function getSpIssuer(): string + { + return $this->getProperty(self::SP_ISSUER); + } + /** + * Set the spIssuer. + * + * @param mixed $spIssuer The value to set. + * @return self + */ + public function setSpIssuer($spIssuer) + { + $this->setProperty( + self::SP_ISSUER, + $spIssuer + ); + + return $this; + } + /** + * Get the idpIssuer. + * + * @return string + */ + public function getIdpIssuer(): string + { + return $this->getProperty(self::IDP_ISSUER); + } + /** + * Set the idpIssuer. + * + * @param mixed $idpIssuer The value to set. + * @return self + */ + public function setIdpIssuer($idpIssuer) + { + $this->setProperty( + self::IDP_ISSUER, + $idpIssuer + ); + + return $this; + } + /** + * Get the recipient. + * + * @return string + */ + public function getRecipient(): string + { + return $this->getProperty(self::RECIPIENT); + } + /** + * Set the recipient. + * + * @param mixed $recipient The value to set. + * @return self + */ + public function setRecipient($recipient) + { + $this->setProperty( + self::RECIPIENT, + $recipient + ); + + return $this; + } + /** + * Get the ssoAcsUrl. + * + * @return string + */ + public function getSsoAcsUrl(): string + { + return $this->getProperty(self::SSO_ACS_URL); + } + /** + * Set the ssoAcsUrl. + * + * @param mixed $ssoAcsUrl The value to set. + * @return self + */ + public function setSsoAcsUrl($ssoAcsUrl) + { + $this->setProperty( + self::SSO_ACS_URL, + $ssoAcsUrl + ); + + return $this; + } + /** + * Get the destination. + * + * @return string + */ + public function getDestination(): string + { + return $this->getProperty(self::DESTINATION); + } + /** + * Set the destination. + * + * @param mixed $destination The value to set. + * @return self + */ + public function setDestination($destination) + { + $this->setProperty( + self::DESTINATION, + $destination + ); + + return $this; + } + /** + * Get the responseSigned. + * + * @return bool + */ + public function getResponseSigned(): bool + { + return $this->getProperty(self::RESPONSE_SIGNED); + } + /** + * Set the responseSigned. + * + * @param mixed $responseSigned The value to set. + * @return self + */ + public function setResponseSigned($responseSigned) + { + $this->setProperty( + self::RESPONSE_SIGNED, + $responseSigned + ); + + return $this; + } + /** + * Get the assertionSigned. + * + * @return bool + */ + public function getAssertionSigned(): bool + { + return $this->getProperty(self::ASSERTION_SIGNED); + } + /** + * Set the assertionSigned. + * + * @param mixed $assertionSigned The value to set. + * @return self + */ + public function setAssertionSigned($assertionSigned) + { + $this->setProperty( + self::ASSERTION_SIGNED, + $assertionSigned + ); + + return $this; + } + /** + * Get the digestAlgorithm. + * + * @return string + */ + public function getDigestAlgorithm(): string + { + return $this->getProperty(self::DIGEST_ALGORITHM); + } + /** + * Set the digestAlgorithm. + * + * @param mixed $digestAlgorithm The value to set. + * @return self + */ + public function setDigestAlgorithm($digestAlgorithm) + { + $this->setProperty( + self::DIGEST_ALGORITHM, + $digestAlgorithm + ); + + return $this; + } + /** + * Get the honorForceAuthn. + * + * @return bool + */ + public function getHonorForceAuthn(): bool + { + return $this->getProperty(self::HONOR_FORCE_AUTHN); + } + /** + * Set the honorForceAuthn. + * + * @param mixed $honorForceAuthn The value to set. + * @return self + */ + public function setHonorForceAuthn($honorForceAuthn) + { + $this->setProperty( + self::HONOR_FORCE_AUTHN, + $honorForceAuthn + ); + + return $this; + } + /** + * Get the audienceOverride. + * + * @return string + */ + public function getAudienceOverride(): string + { + return $this->getProperty(self::AUDIENCE_OVERRIDE); + } + /** + * Set the audienceOverride. + * + * @param mixed $audienceOverride The value to set. + * @return self + */ + public function setAudienceOverride($audienceOverride) + { + $this->setProperty( + self::AUDIENCE_OVERRIDE, + $audienceOverride + ); + + return $this; + } + /** + * Get the defaultRelayState. + * + * @return string + */ + public function getDefaultRelayState(): string + { + return $this->getProperty(self::DEFAULT_RELAY_STATE); + } + /** + * Set the defaultRelayState. + * + * @param mixed $defaultRelayState The value to set. + * @return self + */ + public function setDefaultRelayState($defaultRelayState) + { + $this->setProperty( + self::DEFAULT_RELAY_STATE, + $defaultRelayState + ); + + return $this; + } + /** + * Get the recipientOverride. + * + * @return string + */ + public function getRecipientOverride(): string + { + return $this->getProperty(self::RECIPIENT_OVERRIDE); + } + /** + * Set the recipientOverride. + * + * @param mixed $recipientOverride The value to set. + * @return self + */ + public function setRecipientOverride($recipientOverride) + { + $this->setProperty( + self::RECIPIENT_OVERRIDE, + $recipientOverride + ); + + return $this; + } + /** + * Get the requestCompressed. + * + * @return bool + */ + public function getRequestCompressed(): bool + { + return $this->getProperty(self::REQUEST_COMPRESSED); + } + /** + * Set the requestCompressed. + * + * @param mixed $requestCompressed The value to set. + * @return self + */ + public function setRequestCompressed($requestCompressed) + { + $this->setProperty( + self::REQUEST_COMPRESSED, + $requestCompressed + ); + + return $this; + } + /** + * Get the ssoAcsUrlOverride. + * + * @return string + */ + public function getSsoAcsUrlOverride(): string + { + return $this->getProperty(self::SSO_ACS_URL_OVERRIDE); + } + /** + * Set the ssoAcsUrlOverride. + * + * @param mixed $ssoAcsUrlOverride The value to set. + * @return self + */ + public function setSsoAcsUrlOverride($ssoAcsUrlOverride) + { + $this->setProperty( + self::SSO_ACS_URL_OVERRIDE, + $ssoAcsUrlOverride + ); + + return $this; + } + /** + * Get the signatureAlgorithm. + * + * @return string + */ + public function getSignatureAlgorithm(): string + { + return $this->getProperty(self::SIGNATURE_ALGORITHM); + } + /** + * Set the signatureAlgorithm. + * + * @param mixed $signatureAlgorithm The value to set. + * @return self + */ + public function setSignatureAlgorithm($signatureAlgorithm) + { + $this->setProperty( + self::SIGNATURE_ALGORITHM, + $signatureAlgorithm + ); + + return $this; + } + /** + * Get the attributeStatements. + * + * @return array + */ + public function getAttributeStatements(): array + { + return $this->getProperty(self::ATTRIBUTE_STATEMENTS); + } + /** + * Set the attributeStatements. + * + * @param mixed $attributeStatements The value to set. + * @return self + */ + public function setAttributeStatements($attributeStatements) + { + $this->setProperty( + self::ATTRIBUTE_STATEMENTS, + $attributeStatements + ); + + return $this; + } + /** + * Get the destinationOverride. + * + * @return string + */ + public function getDestinationOverride(): string + { + return $this->getProperty(self::DESTINATION_OVERRIDE); + } + /** + * Set the destinationOverride. + * + * @param mixed $destinationOverride The value to set. + * @return self + */ + public function setDestinationOverride($destinationOverride) + { + $this->setProperty( + self::DESTINATION_OVERRIDE, + $destinationOverride + ); + + return $this; + } + /** + * Get the subjectNameIdFormat. + * + * @return string + */ + public function getSubjectNameIdFormat(): string + { + return $this->getProperty(self::SUBJECT_NAME_ID_FORMAT); + } + /** + * Set the subjectNameIdFormat. + * + * @param mixed $subjectNameIdFormat The value to set. + * @return self + */ + public function setSubjectNameIdFormat($subjectNameIdFormat) + { + $this->setProperty( + self::SUBJECT_NAME_ID_FORMAT, + $subjectNameIdFormat + ); + + return $this; + } + /** + * Get the authnContextClassRef. + * + * @return string + */ + public function getAuthnContextClassRef(): string + { + return $this->getProperty(self::AUTHN_CONTEXT_CLASS_REF); + } + /** + * Set the authnContextClassRef. + * + * @param mixed $authnContextClassRef The value to set. + * @return self + */ + public function setAuthnContextClassRef($authnContextClassRef) + { + $this->setProperty( + self::AUTHN_CONTEXT_CLASS_REF, + $authnContextClassRef + ); + + return $this; + } + /** + * Get the subjectNameIdTemplate. + * + * @return string + */ + public function getSubjectNameIdTemplate(): string + { + return $this->getProperty(self::SUBJECT_NAME_ID_TEMPLATE); + } + /** + * Set the subjectNameIdTemplate. + * + * @param mixed $subjectNameIdTemplate The value to set. + * @return self + */ + public function setSubjectNameIdTemplate($subjectNameIdTemplate) + { + $this->setProperty( + self::SUBJECT_NAME_ID_TEMPLATE, + $subjectNameIdTemplate + ); + + return $this; + } +} diff --git a/src/Generated/Applications/SchemeApplicationCredentials.php b/src/Generated/Applications/SchemeApplicationCredentials.php new file mode 100644 index 0000000000..6548a71252 --- /dev/null +++ b/src/Generated/Applications/SchemeApplicationCredentials.php @@ -0,0 +1,159 @@ +getProperty(self::SCHEME); + } + /** + * Set the scheme. + * + * @param mixed $scheme The value to set. + * @return self + */ + public function setScheme($scheme) + { + $this->setProperty( + self::SCHEME, + $scheme + ); + + return $this; + } + /** + * Get the signing. + * + * @return \Okta\Applications\ApplicationCredentialsSigning + */ + public function getSigning(array $options = []): \Okta\Applications\ApplicationCredentialsSigning + { + return $this->getResourceProperty( + self::SIGNING, + \Okta\Applications\ApplicationCredentialsSigning::class, + $options + ); + } + + /** + * Set the signing. + * + * @param \Okta\Applications\ApplicationCredentialsSigning $signing The ApplicationCredentialsSigning instance. + * @return self + */ + public function setSigning(ApplicationCredentialsSigning $signing) + { + $this->setResourceProperty( + self::SIGNING, + $signing + ); + + return $this; + } + /** + * Get the password. + * + * @return \Okta\Applications\PasswordCredential + */ + public function getPassword(array $options = []): \Okta\Applications\PasswordCredential + { + return $this->getResourceProperty( + self::PASSWORD, + \Okta\Applications\PasswordCredential::class, + $options + ); + } + + /** + * Set the password. + * + * @param \Okta\Applications\PasswordCredential $password The PasswordCredential instance. + * @return self + */ + public function setPassword(PasswordCredential $password) + { + $this->setResourceProperty( + self::PASSWORD, + $password + ); + + return $this; + } + /** + * Get the userName. + * + * @return string + */ + public function getUserName(): string + { + return $this->getProperty(self::USER_NAME); + } + /** + * Set the userName. + * + * @param mixed $userName The value to set. + * @return self + */ + public function setUserName($userName) + { + $this->setProperty( + self::USER_NAME, + $userName + ); + + return $this; + } + /** + * Get the revealPassword. + * + * @return bool + */ + public function getRevealPassword(): bool + { + return $this->getProperty(self::REVEAL_PASSWORD); + } + /** + * Set the revealPassword. + * + * @param mixed $revealPassword The value to set. + * @return self + */ + public function setRevealPassword($revealPassword) + { + $this->setProperty( + self::REVEAL_PASSWORD, + $revealPassword + ); + + return $this; + } +} diff --git a/src/Generated/Applications/SecurePasswordStoreApplication.php b/src/Generated/Applications/SecurePasswordStoreApplication.php new file mode 100644 index 0000000000..deda02a229 --- /dev/null +++ b/src/Generated/Applications/SecurePasswordStoreApplication.php @@ -0,0 +1,84 @@ +getResourceProperty( + self::SETTINGS, + \Okta\Applications\SecurePasswordStoreApplicationSettings::class, + $options + ); + } + + /** + * Set the settings. + * + * @param \Okta\Applications\SecurePasswordStoreApplicationSettings $settings The SecurePasswordStoreApplicationSettings instance. + * @return self + */ + public function setSettings(SecurePasswordStoreApplicationSettings $settings) + { + $this->setResourceProperty( + self::SETTINGS, + $settings + ); + + return $this; + } + /** + * Get the credentials. + * + * @return \Okta\Applications\SchemeApplicationCredentials + */ + public function getCredentials(array $options = []): \Okta\Applications\SchemeApplicationCredentials + { + return $this->getResourceProperty( + self::CREDENTIALS, + \Okta\Applications\SchemeApplicationCredentials::class, + $options + ); + } + + /** + * Set the credentials. + * + * @param \Okta\Applications\SchemeApplicationCredentials $credentials The SchemeApplicationCredentials instance. + * @return self + */ + public function setCredentials(SchemeApplicationCredentials $credentials) + { + $this->setResourceProperty( + self::CREDENTIALS, + $credentials + ); + + return $this; + } +} diff --git a/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php b/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php new file mode 100644 index 0000000000..b66d5c5477 --- /dev/null +++ b/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php @@ -0,0 +1,54 @@ +getResourceProperty( + self::APP, + \Okta\Applications\SecurePasswordStoreApplicationSettingsApplication::class, + $options + ); + } + + /** + * Set the app. + * + * @param \Okta\Applications\SecurePasswordStoreApplicationSettingsApplication $app The SecurePasswordStoreApplicationSettingsApplication instance. + * @return self + */ + public function setApp(SecurePasswordStoreApplicationSettingsApplication $app) + { + $this->setResourceProperty( + self::APP, + $app + ); + + return $this; + } +} diff --git a/src/Generated/Applications/SecurePasswordStoreApplicationSettingsApplication.php b/src/Generated/Applications/SecurePasswordStoreApplicationSettingsApplication.php new file mode 100644 index 0000000000..dee277fc6c --- /dev/null +++ b/src/Generated/Applications/SecurePasswordStoreApplicationSettingsApplication.php @@ -0,0 +1,249 @@ +getProperty(self::URL); + } + /** + * Set the url. + * + * @param mixed $url The value to set. + * @return self + */ + public function setUrl($url) + { + $this->setProperty( + self::URL, + $url + ); + + return $this; + } + /** + * Get the passwordField. + * + * @return string + */ + public function getPasswordField(): string + { + return $this->getProperty(self::PASSWORD_FIELD); + } + /** + * Set the passwordField. + * + * @param mixed $passwordField The value to set. + * @return self + */ + public function setPasswordField($passwordField) + { + $this->setProperty( + self::PASSWORD_FIELD, + $passwordField + ); + + return $this; + } + /** + * Get the usernameField. + * + * @return string + */ + public function getUsernameField(): string + { + return $this->getProperty(self::USERNAME_FIELD); + } + /** + * Set the usernameField. + * + * @param mixed $usernameField The value to set. + * @return self + */ + public function setUsernameField($usernameField) + { + $this->setProperty( + self::USERNAME_FIELD, + $usernameField + ); + + return $this; + } + /** + * Get the optionalField1. + * + * @return string + */ + public function getOptionalField1(): string + { + return $this->getProperty(self::OPTIONAL_FIELD_1); + } + /** + * Set the optionalField1. + * + * @param mixed $optionalField1 The value to set. + * @return self + */ + public function setOptionalField1($optionalField1) + { + $this->setProperty( + self::OPTIONAL_FIELD_1, + $optionalField1 + ); + + return $this; + } + /** + * Get the optionalField2. + * + * @return string + */ + public function getOptionalField2(): string + { + return $this->getProperty(self::OPTIONAL_FIELD_2); + } + /** + * Set the optionalField2. + * + * @param mixed $optionalField2 The value to set. + * @return self + */ + public function setOptionalField2($optionalField2) + { + $this->setProperty( + self::OPTIONAL_FIELD_2, + $optionalField2 + ); + + return $this; + } + /** + * Get the optionalField3. + * + * @return string + */ + public function getOptionalField3(): string + { + return $this->getProperty(self::OPTIONAL_FIELD_3); + } + /** + * Set the optionalField3. + * + * @param mixed $optionalField3 The value to set. + * @return self + */ + public function setOptionalField3($optionalField3) + { + $this->setProperty( + self::OPTIONAL_FIELD_3, + $optionalField3 + ); + + return $this; + } + /** + * Get the optionalField1Value. + * + * @return string + */ + public function getOptionalField1Value(): string + { + return $this->getProperty(self::OPTIONAL_FIELD_1_VALUE); + } + /** + * Set the optionalField1Value. + * + * @param mixed $optionalField1Value The value to set. + * @return self + */ + public function setOptionalField1Value($optionalField1Value) + { + $this->setProperty( + self::OPTIONAL_FIELD_1_VALUE, + $optionalField1Value + ); + + return $this; + } + /** + * Get the optionalField2Value. + * + * @return string + */ + public function getOptionalField2Value(): string + { + return $this->getProperty(self::OPTIONAL_FIELD_2_VALUE); + } + /** + * Set the optionalField2Value. + * + * @param mixed $optionalField2Value The value to set. + * @return self + */ + public function setOptionalField2Value($optionalField2Value) + { + $this->setProperty( + self::OPTIONAL_FIELD_2_VALUE, + $optionalField2Value + ); + + return $this; + } + /** + * Get the optionalField3Value. + * + * @return string + */ + public function getOptionalField3Value(): string + { + return $this->getProperty(self::OPTIONAL_FIELD_3_VALUE); + } + /** + * Set the optionalField3Value. + * + * @param mixed $optionalField3Value The value to set. + * @return self + */ + public function setOptionalField3Value($optionalField3Value) + { + $this->setProperty( + self::OPTIONAL_FIELD_3_VALUE, + $optionalField3Value + ); + + return $this; + } +} diff --git a/src/Generated/Applications/SwaApplication.php b/src/Generated/Applications/SwaApplication.php new file mode 100644 index 0000000000..7a43ad2eda --- /dev/null +++ b/src/Generated/Applications/SwaApplication.php @@ -0,0 +1,54 @@ +getResourceProperty( + self::SETTINGS, + \Okta\Applications\SwaApplicationSettings::class, + $options + ); + } + + /** + * Set the settings. + * + * @param \Okta\Applications\SwaApplicationSettings $settings The SwaApplicationSettings instance. + * @return self + */ + public function setSettings(SwaApplicationSettings $settings) + { + $this->setResourceProperty( + self::SETTINGS, + $settings + ); + + return $this; + } +} diff --git a/src/Generated/Applications/SwaApplicationSettings.php b/src/Generated/Applications/SwaApplicationSettings.php new file mode 100644 index 0000000000..83c92d773a --- /dev/null +++ b/src/Generated/Applications/SwaApplicationSettings.php @@ -0,0 +1,54 @@ +getResourceProperty( + self::APP, + \Okta\Applications\SwaApplicationSettingsApplication::class, + $options + ); + } + + /** + * Set the app. + * + * @param \Okta\Applications\SwaApplicationSettingsApplication $app The SwaApplicationSettingsApplication instance. + * @return self + */ + public function setApp(SwaApplicationSettingsApplication $app) + { + $this->setResourceProperty( + self::APP, + $app + ); + + return $this; + } +} diff --git a/src/Generated/Applications/SwaApplicationSettingsApplication.php b/src/Generated/Applications/SwaApplicationSettingsApplication.php new file mode 100644 index 0000000000..c31eb10846 --- /dev/null +++ b/src/Generated/Applications/SwaApplicationSettingsApplication.php @@ -0,0 +1,124 @@ +getProperty(self::URL); + } + /** + * Set the url. + * + * @param mixed $url The value to set. + * @return self + */ + public function setUrl($url) + { + $this->setProperty( + self::URL, + $url + ); + + return $this; + } + /** + * Get the buttonField. + * + * @return string + */ + public function getButtonField(): string + { + return $this->getProperty(self::BUTTON_FIELD); + } + /** + * Set the buttonField. + * + * @param mixed $buttonField The value to set. + * @return self + */ + public function setButtonField($buttonField) + { + $this->setProperty( + self::BUTTON_FIELD, + $buttonField + ); + + return $this; + } + /** + * Get the passwordField. + * + * @return string + */ + public function getPasswordField(): string + { + return $this->getProperty(self::PASSWORD_FIELD); + } + /** + * Set the passwordField. + * + * @param mixed $passwordField The value to set. + * @return self + */ + public function setPasswordField($passwordField) + { + $this->setProperty( + self::PASSWORD_FIELD, + $passwordField + ); + + return $this; + } + /** + * Get the usernameField. + * + * @return string + */ + public function getUsernameField(): string + { + return $this->getProperty(self::USERNAME_FIELD); + } + /** + * Set the usernameField. + * + * @param mixed $usernameField The value to set. + * @return self + */ + public function setUsernameField($usernameField) + { + $this->setProperty( + self::USERNAME_FIELD, + $usernameField + ); + + return $this; + } +} diff --git a/src/Generated/Applications/SwaThreeFieldApplication.php b/src/Generated/Applications/SwaThreeFieldApplication.php new file mode 100644 index 0000000000..02c93a690c --- /dev/null +++ b/src/Generated/Applications/SwaThreeFieldApplication.php @@ -0,0 +1,54 @@ +getResourceProperty( + self::SETTINGS, + \Okta\Applications\SwaThreeFieldApplicationSettings::class, + $options + ); + } + + /** + * Set the settings. + * + * @param \Okta\Applications\SwaThreeFieldApplicationSettings $settings The SwaThreeFieldApplicationSettings instance. + * @return self + */ + public function setSettings(SwaThreeFieldApplicationSettings $settings) + { + $this->setResourceProperty( + self::SETTINGS, + $settings + ); + + return $this; + } +} diff --git a/src/Generated/Applications/SwaThreeFieldApplicationSettings.php b/src/Generated/Applications/SwaThreeFieldApplicationSettings.php new file mode 100644 index 0000000000..e391721925 --- /dev/null +++ b/src/Generated/Applications/SwaThreeFieldApplicationSettings.php @@ -0,0 +1,54 @@ +getResourceProperty( + self::APP, + \Okta\Applications\SwaThreeFieldApplicationSettingsApplication::class, + $options + ); + } + + /** + * Set the app. + * + * @param \Okta\Applications\SwaThreeFieldApplicationSettingsApplication $app The SwaThreeFieldApplicationSettingsApplication instance. + * @return self + */ + public function setApp(SwaThreeFieldApplicationSettingsApplication $app) + { + $this->setResourceProperty( + self::APP, + $app + ); + + return $this; + } +} diff --git a/src/Generated/Applications/SwaThreeFieldApplicationSettingsApplication.php b/src/Generated/Applications/SwaThreeFieldApplicationSettingsApplication.php new file mode 100644 index 0000000000..ef3996ac70 --- /dev/null +++ b/src/Generated/Applications/SwaThreeFieldApplicationSettingsApplication.php @@ -0,0 +1,174 @@ +getProperty(self::URL); + } + /** + * Set the url. + * + * @param mixed $url The value to set. + * @return self + */ + public function setUrl($url) + { + $this->setProperty( + self::URL, + $url + ); + + return $this; + } + /** + * Get the buttonSelector. + * + * @return string + */ + public function getButtonSelector(): string + { + return $this->getProperty(self::BUTTON_SELECTOR); + } + /** + * Set the buttonSelector. + * + * @param mixed $buttonSelector The value to set. + * @return self + */ + public function setButtonSelector($buttonSelector) + { + $this->setProperty( + self::BUTTON_SELECTOR, + $buttonSelector + ); + + return $this; + } + /** + * Get the extraFieldValue. + * + * @return string + */ + public function getExtraFieldValue(): string + { + return $this->getProperty(self::EXTRA_FIELD_VALUE); + } + /** + * Set the extraFieldValue. + * + * @param mixed $extraFieldValue The value to set. + * @return self + */ + public function setExtraFieldValue($extraFieldValue) + { + $this->setProperty( + self::EXTRA_FIELD_VALUE, + $extraFieldValue + ); + + return $this; + } + /** + * Get the passwordSelector. + * + * @return string + */ + public function getPasswordSelector(): string + { + return $this->getProperty(self::PASSWORD_SELECTOR); + } + /** + * Set the passwordSelector. + * + * @param mixed $passwordSelector The value to set. + * @return self + */ + public function setPasswordSelector($passwordSelector) + { + $this->setProperty( + self::PASSWORD_SELECTOR, + $passwordSelector + ); + + return $this; + } + /** + * Get the userNameSelector. + * + * @return string + */ + public function getUserNameSelector(): string + { + return $this->getProperty(self::USER_NAME_SELECTOR); + } + /** + * Set the userNameSelector. + * + * @param mixed $userNameSelector The value to set. + * @return self + */ + public function setUserNameSelector($userNameSelector) + { + $this->setProperty( + self::USER_NAME_SELECTOR, + $userNameSelector + ); + + return $this; + } + /** + * Get the extraFieldSelector. + * + * @return string + */ + public function getExtraFieldSelector(): string + { + return $this->getProperty(self::EXTRA_FIELD_SELECTOR); + } + /** + * Set the extraFieldSelector. + * + * @param mixed $extraFieldSelector The value to set. + * @return self + */ + public function setExtraFieldSelector($extraFieldSelector) + { + $this->setProperty( + self::EXTRA_FIELD_SELECTOR, + $extraFieldSelector + ); + + return $this; + } +} diff --git a/src/Generated/Applications/WsFederationApplication.php b/src/Generated/Applications/WsFederationApplication.php new file mode 100644 index 0000000000..7c4f98408b --- /dev/null +++ b/src/Generated/Applications/WsFederationApplication.php @@ -0,0 +1,54 @@ +getResourceProperty( + self::SETTINGS, + \Okta\Applications\WsFederationApplicationSettings::class, + $options + ); + } + + /** + * Set the settings. + * + * @param \Okta\Applications\WsFederationApplicationSettings $settings The WsFederationApplicationSettings instance. + * @return self + */ + public function setSettings(WsFederationApplicationSettings $settings) + { + $this->setResourceProperty( + self::SETTINGS, + $settings + ); + + return $this; + } +} diff --git a/src/Generated/Applications/WsFederationApplicationSettings.php b/src/Generated/Applications/WsFederationApplicationSettings.php new file mode 100644 index 0000000000..833ef78b3a --- /dev/null +++ b/src/Generated/Applications/WsFederationApplicationSettings.php @@ -0,0 +1,54 @@ +getResourceProperty( + self::APP, + \Okta\Applications\WsFederationApplicationSettingsApplication::class, + $options + ); + } + + /** + * Set the app. + * + * @param \Okta\Applications\WsFederationApplicationSettingsApplication $app The WsFederationApplicationSettingsApplication instance. + * @return self + */ + public function setApp(WsFederationApplicationSettingsApplication $app) + { + $this->setResourceProperty( + self::APP, + $app + ); + + return $this; + } +} diff --git a/src/Generated/Applications/WsFederationApplicationSettingsApplication.php b/src/Generated/Applications/WsFederationApplicationSettingsApplication.php new file mode 100644 index 0000000000..2ac854dfe5 --- /dev/null +++ b/src/Generated/Applications/WsFederationApplicationSettingsApplication.php @@ -0,0 +1,324 @@ +getProperty(self::REALM); + } + /** + * Set the realm. + * + * @param mixed $realm The value to set. + * @return self + */ + public function setRealm($realm) + { + $this->setProperty( + self::REALM, + $realm + ); + + return $this; + } + /** + * Get the siteURL. + * + * @return string + */ + public function getSiteUrl(): string + { + return $this->getProperty(self::SITE_URL); + } + /** + * Set the siteURL. + * + * @param mixed $siteURL The value to set. + * @return self + */ + public function setSiteUrl($siteURL) + { + $this->setProperty( + self::SITE_URL, + $siteURL + ); + + return $this; + } + /** + * Get the groupName. + * + * @return string + */ + public function getGroupName(): string + { + return $this->getProperty(self::GROUP_NAME); + } + /** + * Set the groupName. + * + * @param mixed $groupName The value to set. + * @return self + */ + public function setGroupName($groupName) + { + $this->setProperty( + self::GROUP_NAME, + $groupName + ); + + return $this; + } + /** + * Get the wReplyURL. + * + * @return string + */ + public function getWReplyUrl(): string + { + return $this->getProperty(self::W_REPLY_URL); + } + /** + * Set the wReplyURL. + * + * @param mixed $wReplyURL The value to set. + * @return self + */ + public function setWReplyUrl($wReplyURL) + { + $this->setProperty( + self::W_REPLY_URL, + $wReplyURL + ); + + return $this; + } + /** + * Get the groupFilter. + * + * @return string + */ + public function getGroupFilter(): string + { + return $this->getProperty(self::GROUP_FILTER); + } + /** + * Set the groupFilter. + * + * @param mixed $groupFilter The value to set. + * @return self + */ + public function setGroupFilter($groupFilter) + { + $this->setProperty( + self::GROUP_FILTER, + $groupFilter + ); + + return $this; + } + /** + * Get the nameIDFormat. + * + * @return string + */ + public function getNameIdFormat(): string + { + return $this->getProperty(self::NAME_ID_FORMAT); + } + /** + * Set the nameIDFormat. + * + * @param mixed $nameIDFormat The value to set. + * @return self + */ + public function setNameIdFormat($nameIDFormat) + { + $this->setProperty( + self::NAME_ID_FORMAT, + $nameIDFormat + ); + + return $this; + } + /** + * Get the wReplyOverride. + * + * @return string + */ + public function getWReplyOverride(): string + { + return $this->getProperty(self::W_REPLY_OVERRIDE); + } + /** + * Set the wReplyOverride. + * + * @param mixed $wReplyOverride The value to set. + * @return self + */ + public function setWReplyOverride($wReplyOverride) + { + $this->setProperty( + self::W_REPLY_OVERRIDE, + $wReplyOverride + ); + + return $this; + } + /** + * Get the groupValueFormat. + * + * @return string + */ + public function getGroupValueFormat(): string + { + return $this->getProperty(self::GROUP_VALUE_FORMAT); + } + /** + * Set the groupValueFormat. + * + * @param mixed $groupValueFormat The value to set. + * @return self + */ + public function setGroupValueFormat($groupValueFormat) + { + $this->setProperty( + self::GROUP_VALUE_FORMAT, + $groupValueFormat + ); + + return $this; + } + /** + * Get the usernameAttribute. + * + * @return string + */ + public function getUsernameAttribute(): string + { + return $this->getProperty(self::USERNAME_ATTRIBUTE); + } + /** + * Set the usernameAttribute. + * + * @param mixed $usernameAttribute The value to set. + * @return self + */ + public function setUsernameAttribute($usernameAttribute) + { + $this->setProperty( + self::USERNAME_ATTRIBUTE, + $usernameAttribute + ); + + return $this; + } + /** + * Get the attributeStatements. + * + * @return string + */ + public function getAttributeStatements(): string + { + return $this->getProperty(self::ATTRIBUTE_STATEMENTS); + } + /** + * Set the attributeStatements. + * + * @param mixed $attributeStatements The value to set. + * @return self + */ + public function setAttributeStatements($attributeStatements) + { + $this->setProperty( + self::ATTRIBUTE_STATEMENTS, + $attributeStatements + ); + + return $this; + } + /** + * Get the audienceRestriction. + * + * @return string + */ + public function getAudienceRestriction(): string + { + return $this->getProperty(self::AUDIENCE_RESTRICTION); + } + /** + * Set the audienceRestriction. + * + * @param mixed $audienceRestriction The value to set. + * @return self + */ + public function setAudienceRestriction($audienceRestriction) + { + $this->setProperty( + self::AUDIENCE_RESTRICTION, + $audienceRestriction + ); + + return $this; + } + /** + * Get the authnContextClassRef. + * + * @return string + */ + public function getAuthnContextClassRef(): string + { + return $this->getProperty(self::AUTHN_CONTEXT_CLASS_REF); + } + /** + * Set the authnContextClassRef. + * + * @param mixed $authnContextClassRef The value to set. + * @return self + */ + public function setAuthnContextClassRef($authnContextClassRef) + { + $this->setProperty( + self::AUTHN_CONTEXT_CLASS_REF, + $authnContextClassRef + ); + + return $this; + } +} From 0aa75568aef0707fd54b0cb7b87b0bb161560182 Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Wed, 22 Nov 2017 09:51:11 -0500 Subject: [PATCH 12/22] Updating Test Classes --- src/Applications/BookmarkApplication.php | 2 +- tests/BaseTestCase.php | 41 +- tests/BaseUnitTestCase.php | 65 +++ tests/Integration/FactorsTest.php | 2 +- tests/Unit/Applications/ApplicationTest.php | 402 ++++++++++++++++++ .../GroupRules/GroupRuleConditionsTest.php | 2 +- .../UserFactors/CallFactorProfileTest.php | 42 +- tests/Unit/UserFactors/CallFactorTest.php | 22 +- .../UserFactors/EmailFactorProfileTest.php | 27 +- tests/Unit/UserFactors/EmailFactorTest.php | 22 +- tests/Unit/UserFactors/FactorTest.php | 51 +-- .../UserFactors/HardwareFactorProfileTest.php | 27 +- tests/Unit/UserFactors/HardwareFactorTest.php | 21 +- .../UserFactors/PushFactorProfileTest.php | 59 ++- tests/Unit/UserFactors/PushFactorTest.php | 22 +- .../SecurityQuestionFactorProfileTest.php | 52 +-- .../SecurityQuestionFactorTest.php | 22 +- .../UserFactors/TokenFactorProfileTest.php | 28 +- tests/Unit/UserFactors/TokenFactorTest.php | 22 +- .../UserFactors/TotpFactorProfileTest.php | 28 +- tests/Unit/UserFactors/TotpFactorTest.php | 22 +- .../Unit/UserFactors/WebFactorProfileTest.php | 28 +- tests/Unit/UserFactors/WebFactorTest.php | 22 +- tests/Unit/Users/UserTest.php | 131 +++--- tests/bootstrap.php | 3 +- tests/models/Applications/customSwa.json | 83 ++++ 26 files changed, 801 insertions(+), 447 deletions(-) create mode 100644 tests/BaseUnitTestCase.php create mode 100644 tests/Unit/Applications/ApplicationTest.php create mode 100644 tests/models/Applications/customSwa.json diff --git a/src/Applications/BookmarkApplication.php b/src/Applications/BookmarkApplication.php index 1cf9adc09f..2cfefede67 100644 --- a/src/Applications/BookmarkApplication.php +++ b/src/Applications/BookmarkApplication.php @@ -20,5 +20,5 @@ class BookmarkApplication extends \Okta\Generated\Applications\BookmarkApplication { - + private $name = "bookmark"; } diff --git a/tests/BaseTestCase.php b/tests/BaseTestCase.php index 892aa554d5..90b3055fb3 100644 --- a/tests/BaseTestCase.php +++ b/tests/BaseTestCase.php @@ -15,11 +15,19 @@ * limitations under the License. * ******************************************************************************/ +use Okta\ClientBuilder; use PHPUnit\Framework\TestCase; class BaseTestCase extends TestCase { protected $token = 'abc123'; + + public static function setUpBeforeClass() + { + parent::setUpBeforeClass(); + (new ClientBuilder())->build(); + } + /** * @param array $returns * @@ -34,11 +42,14 @@ protected function createNewHttpClient($returns = []): \Http\Mock\Client $mockReturns = array_replace_recursive($defaults, $returns); + $httpClient = new \Http\Mock\Client; + $response = $this->createMock('Psr\Http\Message\ResponseInterface'); + foreach($mockReturns as $method=>$return) { $response->method($method)->willReturn($return); + } - $httpClient = new \Http\Mock\Client; $httpClient->addResponse($response); (new \Okta\ClientBuilder()) @@ -67,32 +78,4 @@ protected function createNewUser($properties = []): \Okta\Users\User } - protected function createModel($model, $returnType, $properties = []) - { - - $properties = json_decode($this->getModel($model, $properties)); - - $class = new \stdClass(); - foreach($properties as $prop=>$value) - { - $class->{$prop} = $value; - } - - return new $returnType(null, $class); - } - - protected function getModel($model, $overrides = []) - { - $model = json_decode($this->getModelJson($model), true); - - return json_encode(array_replace_recursive($model, $overrides)); - - } - - protected function getModelJson($model) - { - if(is_readable($fileName = __DIR__ . "/models/{$model}")) { - return (string) file_get_contents($fileName); - } - } } \ No newline at end of file diff --git a/tests/BaseUnitTestCase.php b/tests/BaseUnitTestCase.php new file mode 100644 index 0000000000..6a481edbe6 --- /dev/null +++ b/tests/BaseUnitTestCase.php @@ -0,0 +1,65 @@ +properties = json_decode($this->getModelJson($this->model)); + $this->testable = $this->createModel($this->model, $this->modelType); + } + + protected function createModel($model, $returnType, $properties = []) + { + $properties = json_decode($this->getModel($model, $properties)); + + $class = new \stdClass(); + foreach($properties as $prop=>$value) + { + $class->{$prop} = $value; + } + + return new $returnType(null, $class); + } + + protected function getModel($model, $overrides = []) + { + $model = json_decode($this->getModelJson($model), true); + + return json_encode(array_replace_recursive($model, $overrides)); + + } + + protected function getModelJson($model) + { + if(is_readable($fileName = __DIR__ . "/models/{$model}")) { + return (string) file_get_contents($fileName); + } + + return (string)$model; + } +} \ No newline at end of file diff --git a/tests/Integration/FactorsTest.php b/tests/Integration/FactorsTest.php index 22f3180908..eab2f08a59 100644 --- a/tests/Integration/FactorsTest.php +++ b/tests/Integration/FactorsTest.php @@ -25,7 +25,7 @@ public function a_user_should_be_able_to_get_a_factor_by_factor_id_only() 'getBody' => file_get_contents(__DIR__ . '/../responses/factors/getFactor.json') ]); - $user = $this->createnewUser(); + $user = $this->createNewUser(); $factor = $user->getFactor('FactorId123'); $requests = $client->getRequests(); diff --git a/tests/Unit/Applications/ApplicationTest.php b/tests/Unit/Applications/ApplicationTest.php new file mode 100644 index 0000000000..44d3075bbf --- /dev/null +++ b/tests/Unit/Applications/ApplicationTest.php @@ -0,0 +1,402 @@ +createNewHttpClient(); + + $this->testable->get('abc123'); + + $requests = $client->getRequests(); + + $this->assertEquals('/api/v1/apps/abc123', $requests[0]->getUri()->getPath()); + $this->assertEquals('GET', $requests[0]->getMethod()); + } + + /** + * @test + * @covers Application::get() + */ + public function getting_an_application_will_return_application_object() + { + $client = $this->createNewHttpClient(); + + $app = $this->testable->get('abc123'); + + $this->assertInstanceOf(Application::class, $app); + } + + /** + * @test + * @covers Application::save() + */ + public function saving_an_application_makes_requests_to_correct_endpoint() + { + $client = $this->createNewHttpClient(); + $this->testable->save(); + + $requests = $client->getRequests(); + + $this->assertEquals("/api/v1/apps/{$this->testable->getId()}", $requests[0]->getUri()->getPath()); + $this->assertEquals('POST', $requests[0]->getMethod()); + } + + /** + * @test + * @covers Application::save() + */ + public function saving_an_application_will_return_correct_type() + { + $client = $this->createNewHttpClient(); + + $app = $this->testable->save(); + + $this->assertInstanceOf(Application::class, $app); + } + + /** + * @test + * @covers Application::delete() + */ + public function deleting_an_application_makes_requests_to_correct_endpoint() + { + $client = $this->createNewHttpClient(); + $this->testable->delete(); + + $requests = $client->getRequests(); + + $this->assertEquals("/api/v1/apps/{$this->testable->getId()}", $requests[0]->getUri()->getPath()); + $this->assertEquals('DELETE', $requests[0]->getMethod()); + } + + /** @test */ + public function id_is_accessible() + { + $this->assertEquals($this->properties->id, $this->testable->getId()); + $this->assertEquals($this->properties->id, $this->testable->id); + } + + /** @test */ + public function name_is_accessible() + { + $this->assertEquals($this->properties->name, $this->testable->getName()); + $this->assertEquals($this->properties->name, $this->testable->name); + } + + /** @test */ + public function label_is_accessible() + { + $this->assertEquals($this->properties->label, $this->testable->getLabel()); + $this->assertEquals($this->properties->label, $this->testable->label); + } + + /** @test */ + public function label_is_settable() + { + $this->testable->setLabel('CustomApp'); + $this->assertEquals('CustomApp', $this->testable->getLabel()); + + $this->testable->label = 'Custom App 2'; + $this->assertEquals('Custom App 2', $this->testable->getLabel()); + } + + /** @test */ + public function links_is_accessible() + { + $this->assertEquals($this->properties->_links, $this->testable->getLinks()); + $this->assertEquals($this->properties->_links, $this->testable->links); + } + + /** @test */ + public function status_is_accessible() + { + $this->assertEquals($this->properties->status, $this->testable->getStatus()); + $this->assertEquals($this->properties->status, $this->testable->status); + } + + /** @test */ + public function status_is_settable() + { + $this->testable->setStatus('ACTIVE'); + $this->assertEquals('ACTIVE', $this->testable->getStatus()); + + $this->testable->status = 'INACTIVE'; + $this->assertEquals('INACTIVE', $this->testable->getStatus()); + } + + /** @test */ + public function created_is_accessible() + { + $ts = Carbon::parse($this->properties->created)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->created); + $this->assertEquals($ts, $this->testable->getCreated()->timestamp); + $this->assertEquals($ts, $this->testable->created->timestamp); + } + + /** @test */ + public function features_is_accessible() + { + $this->assertEquals($this->properties->features, $this->testable->getFeatures()); + $this->assertEquals($this->properties->features, $this->testable->features); + } + + /** @test */ + public function features_is_settable() + { + $this->testable->setFeatures(['IMPORT_NEW_USERS']); + $this->assertEquals(['IMPORT_NEW_USERS'], $this->testable->getFeatures()); + + $this->testable->features = ['PROFILE_MASTERING']; + $this->assertEquals(['PROFILE_MASTERING'], $this->testable->getFeatures()); + } + + /** @test */ + public function settings_is_accessible() + { + $this->assertInstanceOf(\Okta\Applications\ApplicationSettings::class, $this->testable->getSettings()); + $this->assertInstanceOf(\Okta\Applications\ApplicationSettings::class, $this->testable->settings); + } + + /** @test */ + public function settings_is_settable() + { + $settings1 = $this->testable->getSettings(); + $settings2 = $this->testable->getSettings(); + + $settings1->signOn = 'test'; + $settings2->signOn = 'hello'; + + $this->testable->setSettings($settings1); + $this->assertInstanceOf(\Okta\Applications\ApplicationSettings::class, $this->testable->getSettings()); + $this->assertEquals('test', $this->testable->getSettings()->signOn); + + $this->testable->settings = $settings2; + $this->assertInstanceOf(\Okta\Applications\ApplicationSettings::class, $this->testable->getSettings()); + $this->assertEquals('hello', $this->testable->getSettings()->signOn); + + } + + /** @test */ + public function embedded_is_accessible() + { + $this->assertEquals($this->properties->_embedded, $this->testable->getEmbedded()); + $this->assertEquals($this->properties->_embedded, $this->testable->embedded); + } + + /** @test */ + public function licensing_is_accessible() + { + $this->assertInstanceOf(\Okta\Applications\ApplicationLicensing::class, $this->testable->getLicensing()); + $this->assertInstanceOf(\Okta\Applications\ApplicationLicensing::class, $this->testable->licensing); + } + + /** @test */ + public function licensing_is_settable() + { + $licensing1 = $this->testable->getLicensing(); + $licensing2 = $this->testable->getLicensing(); + + $licensing1->seatCount = 10; + $licensing2->seatCount = 20; + + $this->testable->setLicensing($licensing1); + $this->assertInstanceOf(\Okta\Applications\ApplicationLicensing::class, $this->testable->getLicensing()); + $this->assertEquals(10, $this->testable->getLicensing()->seatCount); + + $this->testable->licensing = $licensing2; + $this->assertInstanceOf(\Okta\Applications\ApplicationLicensing::class, $this->testable->getLicensing()); + $this->assertEquals(20, $this->testable->getLicensing()->seatCount); + + } + + /** @test */ + public function sign_on_mode_is_accessible() + { + $this->assertEquals($this->properties->signOnMode, $this->testable->getSignOnMode()); + $this->assertEquals($this->properties->signOnMode, $this->testable->signOnMode); + } + + /** @test */ + public function sign_on_mode_is_settable() + { + $this->testable->setSignOnMode('BOOKMARK'); + $this->assertEquals('BOOKMARK', $this->testable->getSignOnMode()); + + $this->testable->signOnMode = 'BASIC_AUTH'; + $this->assertEquals('BASIC_AUTH', $this->testable->getSignOnMode()); + } + + /** @test */ + public function visibility_is_accessible() + { + $this->assertInstanceOf(\Okta\Applications\ApplicationVisibility::class, $this->testable->getVisibility()); + $this->assertInstanceOf(\Okta\Applications\ApplicationVisibility::class, $this->testable->visibility); + } + + /** @test */ + public function visibility_is_settable() + { + $visibility1 = $this->testable->getVisibility(); + $visibility2 = $this->testable->getVisibility(); + + $visibility1->autoSubmitToolbar = true; + $visibility2->autoSubmitToolbar = false; + + $this->testable->setVisibility($visibility1); + $this->assertInstanceOf(\Okta\Applications\ApplicationVisibility::class, $this->testable->getVisibility()); + $this->assertTrue($this->testable->getVisibility()->autoSubmitToolbar); + + $this->testable->visibility = $visibility2; + $this->assertInstanceOf(\Okta\Applications\ApplicationVisibility::class, $this->testable->getVisibility()); + $this->assertFalse($this->testable->getVisibility()->autoSubmitToolbar); + + } + + /** @test */ + public function credentials_is_accessible() + { + $this->assertInstanceOf(\Okta\Applications\ApplicationCredentials::class, $this->testable->getCredentials()); + $this->assertInstanceOf(\Okta\Applications\ApplicationCredentials::class, $this->testable->credentials); + } + + /** @test */ + public function credentials_is_settable() + { + $credentials1 = $this->testable->getCredentials(); + $credentials2 = $this->testable->getCredentials(); + + $credentials1->test1 = 'test1'; + $credentials2->test2 = 'test2'; + + $this->testable->setCredentials($credentials1); + $this->assertInstanceOf(\Okta\Applications\ApplicationCredentials::class, $this->testable->getCredentials()); + $this->assertEquals('test1', $this->testable->getCredentials()->test1); + + $this->testable->credentials = $credentials2; + $this->assertInstanceOf(\Okta\Applications\ApplicationCredentials::class, $this->testable->getCredentials()); + $this->assertEquals('test2', $this->testable->getCredentials()->test2); + + } + + /** @test */ + public function last_updated_is_accessible() + { + $ts = Carbon::parse($this->properties->lastUpdated)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->lastUpdated); + $this->assertEquals($ts, $this->testable->getLastUpdated()->timestamp); + $this->assertEquals($ts, $this->testable->lastUpdated->timestamp); + } + + /** @test */ + public function accessibility_is_accessible() + { + $this->assertInstanceOf(\Okta\Applications\ApplicationAccessibility::class, $this->testable->getAccessibility()); + $this->assertInstanceOf(\Okta\Applications\ApplicationAccessibility::class, $this->testable->accessibility); + + } + + /** @test */ + public function accessibility_is_settable() + { + $accessibility1 = $this->testable->getAccessibility(); + $accessibility2 = $this->testable->getAccessibility(); + + $accessibility1->test1 = 'test1'; + $accessibility2->test2 = 'test2'; + + $this->testable->setAccessibility($accessibility1); + $this->assertInstanceOf(\Okta\Applications\ApplicationAccessibility::class, $this->testable->getAccessibility()); + $this->assertEquals('test1', $this->testable->getAccessibility()->test1); + + $this->testable->accessibility = $accessibility2; + $this->assertInstanceOf(\Okta\Applications\ApplicationAccessibility::class, $this->testable->getAccessibility()); + $this->assertEquals('test2', $this->testable->getAccessibility()->test2); + + } + + /** @test */ + public function activate_makes_request_to_correct_endpoint() + { + $client = $this->createNewHttpClient(); + + $app = $this->createModel($this->model, Application::class); + $app->activate(); + $request = $client->getRequests(); + + $this->assertEquals('POST', $request[0]->getMethod()); + $this->assertEquals( + "/api/v1/apps/{$this->testable->getId()}/lifecycle/activate", + $request[0]->getUri()->getPath() + ); + } + + /** @test */ + public function deactivate_makes_request_to_correct_endpoint() + { + $client = $this->createNewHttpClient(); + $app = $this->createModel($this->model, Application::class); + $app->deactivate(); + + $request = $client->getRequests(); + + $this->assertEquals('POST', $request[0]->getMethod()); + $this->assertEquals( + "/api/v1/apps/{$this->testable->getId()}/lifecycle/deactivate", + $request[0]->getUri()->getPath() + ); + } + + /** @test */ + public function get_application_users_makes_request_to_correct_endpoint() + { + + $httpClient = $this->createNewHttpClient([ + 'getBody' => '[{"id": "00uaz81i7cHX3cSsg0h7"}]' + ]); + + $app = $this->createModel($this->model, Application::class); + $app->getApplicationUsers(); + + $request = $httpClient->getRequests(); + + $this->assertEquals('GET', $request[0]->getMethod()); + $this->assertEquals( + "/api/v1/apps/{$this->testable->getId()}/users", + $request[0]->getUri()->getPath() + ); + } + + + +} diff --git a/tests/Unit/GroupRules/GroupRuleConditionsTest.php b/tests/Unit/GroupRules/GroupRuleConditionsTest.php index 0a8645f168..fa385aa6a8 100644 --- a/tests/Unit/GroupRules/GroupRuleConditionsTest.php +++ b/tests/Unit/GroupRules/GroupRuleConditionsTest.php @@ -57,7 +57,7 @@ public static function setUpBeforeClass() } self::$testable = new GroupRuleConditions(NULL, $class); } - + /** @test */ public function people_is_accessible() { diff --git a/tests/Unit/UserFactors/CallFactorProfileTest.php b/tests/Unit/UserFactors/CallFactorProfileTest.php index b3061f18b2..d5dafd5b0a 100644 --- a/tests/Unit/UserFactors/CallFactorProfileTest.php +++ b/tests/Unit/UserFactors/CallFactorProfileTest.php @@ -1,4 +1,7 @@ createNewHttpClient(); - $model = '/UserFactors/factorProfileCall.json'; - static::$properties = json_decode($this->getModelJson($model)); - static::$testable = $this->createModel($model, \Okta\UserFactors\CallFactorProfile::class); - } + protected $model = '/UserFactors/factorProfileCall.json'; + protected $modelType = CallFactorProfile::class; /** @test */ public function phone_number_is_gettable() { - $this->assertEquals(static::$properties->phoneNumber, static::$testable->getPhoneNumber()); - $this->assertEquals(static::$properties->phoneNumber, static::$testable->phoneNumber); + $this->assertEquals($this->properties->phoneNumber, $this->testable->getPhoneNumber()); + $this->assertEquals($this->properties->phoneNumber, $this->testable->phoneNumber); } /** @test */ public function phone_number_is_settable() { - static::$testable->setPhoneNumber('5555551212'); - static::assertEquals('5555551212', static::$testable->getPhoneNumber()); + $this->testable->setPhoneNumber('5555551212'); + static::assertEquals('5555551212', $this->testable->getPhoneNumber()); - static::$testable->phoneNumber = '5551112222'; - static::assertEquals('5551112222', static::$testable->getPhoneNumber()); + $this->testable->phoneNumber = '5551112222'; + static::assertEquals('5551112222', $this->testable->getPhoneNumber()); } /** @test */ public function extension_is_gettable() { - $this->assertEquals(static::$properties->phoneExtension, static::$testable->getPhoneExtension()); - $this->assertEquals(static::$properties->phoneExtension, static::$testable->phoneExtension); + $this->assertEquals($this->properties->phoneExtension, $this->testable->getPhoneExtension()); + $this->assertEquals($this->properties->phoneExtension, $this->testable->phoneExtension); } /** @test */ public function extension_is_settable() { - static::$testable->setPhoneExtension('123'); - static::assertEquals('123', static::$testable->getPhoneExtension()); + $this->testable->setPhoneExtension('123'); + static::assertEquals('123', $this->testable->getPhoneExtension()); - static::$testable->phoneExtension = '789'; - static::assertEquals('789', static::$testable->getPhoneExtension()); + $this->testable->phoneExtension = '789'; + static::assertEquals('789', $this->testable->getPhoneExtension()); } diff --git a/tests/Unit/UserFactors/CallFactorTest.php b/tests/Unit/UserFactors/CallFactorTest.php index 2323851eeb..7d81ba43ae 100644 --- a/tests/Unit/UserFactors/CallFactorTest.php +++ b/tests/Unit/UserFactors/CallFactorTest.php @@ -17,25 +17,15 @@ use Okta\ClientBuilder; -class CallFactorTest extends BaseTestCase +class CallFactorTest extends BaseUnitTestCase { - protected static $properties; - /** @var User */ - protected static $testable; - - public function setUp() - { - parent::setUp(); - $this->createNewHttpClient(); - $model = '/UserFactors/callFactor.json'; - static::$properties = json_decode($this->getModelJson($model)); - static::$testable = $this->createModel($model, \Okta\UserFactors\CallFactor::class); - } + protected $model = '/UserFactors/callFactor.json'; + protected $modelType = \Okta\UserFactors\CallFactor::class; /** @test */ public function can_get_profile_from_factor() { - $profile = self::$testable->getProfile(); + $profile = $this->testable->getProfile(); $this->assertInstanceOf(\Okta\UserFactors\CallFactorProfile::class, $profile); @@ -45,10 +35,10 @@ public function can_get_profile_from_factor() public function a_profile_can_be_set_on_the_factor() { /** @var \Okta\UserFactors\SecurityQuestionFactorProfile $profile */ - $profile = static::$testable->getProfile(); + $profile = $this->testable->getProfile(); $profile->setAnswer = 'Test'; - $factor = static::$testable->setProfile($profile); + $factor = $this->testable->setProfile($profile); $this->assertInstanceOf(\Okta\UserFactors\CallFactor::class, $factor); } diff --git a/tests/Unit/UserFactors/EmailFactorProfileTest.php b/tests/Unit/UserFactors/EmailFactorProfileTest.php index 18cda8d17a..3c41b85bd5 100644 --- a/tests/Unit/UserFactors/EmailFactorProfileTest.php +++ b/tests/Unit/UserFactors/EmailFactorProfileTest.php @@ -15,36 +15,27 @@ * limitations under the License. * ******************************************************************************/ -class EmailFactorProfileTest extends BaseTestCase +class EmailFactorProfileTest extends BaseUnitTestCase { - protected static $properties; - protected static $testable; - - public function setUp() - { - parent::setUp(); - $this->createNewHttpClient(); - $model = '/UserFactors/factorProfileEmail.json'; - static::$properties = json_decode($this->getModel($model)); - static::$testable = $this->createModel($model, \Okta\UserFactors\EmailFactorProfile::class); - } + protected $model = '/UserFactors/factorProfileEmail.json'; + protected $modelType = \Okta\UserFactors\EmailFactorProfile::class; /** @test */ public function email_is_gettable() { - $this->assertEquals(static::$properties->email, static::$testable->getEmail()); - $this->assertEquals(static::$properties->email, static::$testable->email); + $this->assertEquals($this->properties->email, $this->testable->getEmail()); + $this->assertEquals($this->properties->email, $this->testable->email); } /** @test */ public function email_is_settable() { - static::$testable->setEmail('test@mailinator.com'); - static::assertEquals('test@mailinator.com', static::$testable->getEmail()); + $this->testable->setEmail('test@mailinator.com'); + static::assertEquals('test@mailinator.com', $this->testable->getEmail()); - static::$testable->email = 'test2@mailinator.com'; - static::assertEquals('test2@mailinator.com', static::$testable->getEmail()); + $this->testable->email = 'test2@mailinator.com'; + static::assertEquals('test2@mailinator.com', $this->testable->getEmail()); } } diff --git a/tests/Unit/UserFactors/EmailFactorTest.php b/tests/Unit/UserFactors/EmailFactorTest.php index c5cedd562c..8ddcbb25ec 100644 --- a/tests/Unit/UserFactors/EmailFactorTest.php +++ b/tests/Unit/UserFactors/EmailFactorTest.php @@ -17,25 +17,15 @@ use Okta\ClientBuilder; -class EmailFactorTest extends BaseTestCase +class EmailFactorTest extends BaseUnitTestCase { - protected static $properties; - /** @var User */ - protected static $testable; - - public function setUp() - { - parent::setUp(); - $this->createNewHttpClient(); - $model = '/UserFactors/emailFactor.json'; - static::$properties = json_decode($this->getModelJson($model)); - static::$testable = $this->createModel($model, \Okta\UserFactors\EmailFactor::class); - } + protected $model = '/UserFactors/emailFactor.json'; + protected $modelType = \Okta\UserFactors\EmailFactor::class; /** @test */ public function can_get_profile_from_factor() { - $profile = self::$testable->getProfile(); + $profile = $this->testable->getProfile(); $this->assertInstanceOf(\Okta\UserFactors\EmailFactorProfile::class, $profile); @@ -45,10 +35,10 @@ public function can_get_profile_from_factor() public function a_profile_can_be_set_on_the_factor() { /** @var \Okta\UserFactors\SecurityQuestionFactorProfile $profile */ - $profile = static::$testable->getProfile(); + $profile = $this->testable->getProfile(); $profile->setAnswer = 'Test'; - $factor = static::$testable->setProfile($profile); + $factor = $this->testable->setProfile($profile); $this->assertInstanceOf(\Okta\UserFactors\EmailFactor::class, $factor); } diff --git a/tests/Unit/UserFactors/FactorTest.php b/tests/Unit/UserFactors/FactorTest.php index ee89e7896d..d65497ba13 100644 --- a/tests/Unit/UserFactors/FactorTest.php +++ b/tests/Unit/UserFactors/FactorTest.php @@ -18,73 +18,64 @@ use Okta\UserFactors\Factor; use PHPUnit\Framework\TestCase; -class FactorTest extends BaseTestCase +class FactorTest extends BaseUnitTestCase { - protected static $properties; - protected static $testable; - - public function setUp() - { - parent::setUp(); - $this->createNewHttpClient(); - $model = '/UserFactors/generalFactor.json'; - static::$properties = json_decode($this->getModelJson($model)); - static::$testable = $this->createModel($model, \Okta\UserFactors\Factor::class); - } + protected $model = '/UserFactors/generalFactor.json'; + protected $modelType = \Okta\UserFactors\Factor::class; /** @test */ public function id_is_accessible() { - $this->assertEquals(static::$properties->id, static::$testable->getId()); - $this->assertEquals(static::$properties->id, static::$testable->id); + $this->assertEquals($this->properties->id, $this->testable->getId()); + $this->assertEquals($this->properties->id, $this->testable->id); } /** @test */ public function links_is_accessible() { - $this->assertEquals(static::$properties->_links, static::$testable->getLinks()); - $this->assertEquals(static::$properties->_links, static::$testable->links); + $this->assertEquals($this->properties->_links, $this->testable->getLinks()); + $this->assertEquals($this->properties->_links, $this->testable->links); } /** @test */ public function device_is_accessible() { - $this->assertEquals(static::$properties->device, static::$testable->getDevice()); - $this->assertEquals(static::$properties->device, static::$testable->device); + $this->assertEquals($this->properties->device, $this->testable->getDevice()); + $this->assertEquals($this->properties->device, $this->testable->device); } /** @test */ public function device_is_settable() { - static::$testable->setDevice('test1'); - static::assertEquals('test1', static::$testable->getDevice()); + $this->testable->setDevice('test1'); + static::assertEquals('test1', $this->testable->getDevice()); - static::$testable->device = 'test2'; - static::assertEquals('test2', static::$testable->getDevice()); + $this->testable->device = 'test2'; + static::assertEquals('test2', $this->testable->getDevice()); } /** @test */ public function status_is_accessible() { - $this->assertEquals(static::$properties->status, static::$testable->getStatus()); - $this->assertEquals(static::$properties->status, static::$testable->status); + $this->assertEquals($this->properties->status, $this->testable->getStatus()); + $this->assertEquals($this->properties->status, $this->testable->status); } /** @test */ public function user_id_is_accessible() { - $this->assertEquals(static::$properties->userId, static::$testable->getUserId()); - $this->assertEquals(static::$properties->userId, static::$testable->userId); + $this->assertEquals($this->properties->userId, $this->testable->getUserId()); + $this->assertEquals($this->properties->userId, $this->testable->userId); } /** @test */ public function user_id_is_settable() { - static::$testable->setUserId('123'); - static::assertEquals('123', static::$testable->getUserId()); + $this->testable->setUserId('123'); + static::assertEquals('123', $this->testable->getUserId()); - static::$testable->userId = '456'; - static::assertEquals('456', static::$testable->getUserId()); + $this->testable->userId = '456'; + static::assertEquals('456', $this->testable->getUserId()); } } diff --git a/tests/Unit/UserFactors/HardwareFactorProfileTest.php b/tests/Unit/UserFactors/HardwareFactorProfileTest.php index a1d248644b..8f0cda7526 100644 --- a/tests/Unit/UserFactors/HardwareFactorProfileTest.php +++ b/tests/Unit/UserFactors/HardwareFactorProfileTest.php @@ -15,36 +15,27 @@ * limitations under the License. * ******************************************************************************/ -class HardwareFactorProfileTest extends BaseTestCase +class HardwareFactorProfileTest extends BaseUnitTestCase { - protected static $properties; - protected static $testable; - - public function setUp() - { - parent::setUp(); - $this->createNewHttpClient(); - $model = '/UserFactors/factorProfileHardware.json'; - static::$properties = json_decode($this->getModel($model)); - static::$testable = $this->createModel($model, \Okta\UserFactors\HardwareFactorProfile::class); - } + protected $model = '/UserFactors/factorProfileHardware.json'; + protected $modelType = \Okta\UserFactors\HardwareFactorProfile::class; /** @test */ public function credential_id_is_gettable() { - $this->assertEquals(static::$properties->credentialId, static::$testable->getCredentialId()); - $this->assertEquals(static::$properties->credentialId, static::$testable->credentialId); + $this->assertEquals($this->properties->credentialId, $this->testable->getCredentialId()); + $this->assertEquals($this->properties->credentialId, $this->testable->credentialId); } /** @test */ public function credential_id_is_settable() { - static::$testable->setCredentialId('test@mailinator.com'); - static::assertEquals('test@mailinator.com', static::$testable->getCredentialId()); + $this->testable->setCredentialId('test@mailinator.com'); + static::assertEquals('test@mailinator.com', $this->testable->getCredentialId()); - static::$testable->credentialId = 'test2@mailinator.com'; - static::assertEquals('test2@mailinator.com', static::$testable->getCredentialId()); + $this->testable->credentialId = 'test2@mailinator.com'; + static::assertEquals('test2@mailinator.com', $this->testable->getCredentialId()); } } diff --git a/tests/Unit/UserFactors/HardwareFactorTest.php b/tests/Unit/UserFactors/HardwareFactorTest.php index 2bc1da42f6..22c25e4250 100644 --- a/tests/Unit/UserFactors/HardwareFactorTest.php +++ b/tests/Unit/UserFactors/HardwareFactorTest.php @@ -17,25 +17,16 @@ use Okta\ClientBuilder; -class HardwareFactorTest extends BaseTestCase +class HardwareFactorTest extends BaseUnitTestCase { - protected static $properties; - /** @var User */ - protected static $testable; + protected $model = '/UserFactors/hardwareFactor.json'; + protected $modelType = \Okta\UserFactors\HardwareFactor::class; - public function setUp() - { - parent::setUp(); - $this->createNewHttpClient(); - $model = '/UserFactors/hardwareFactor.json'; - static::$properties = json_decode($this->getModelJson($model)); - static::$testable = $this->createModel($model, \Okta\UserFactors\HardwareFactor::class); - } /** @test */ public function can_get_profile_from_factor() { - $profile = self::$testable->getProfile(); + $profile = $this->testable->getProfile(); $this->assertInstanceOf(\Okta\UserFactors\HardwareFactorProfile::class, $profile); @@ -45,10 +36,10 @@ public function can_get_profile_from_factor() public function a_profile_can_be_set_on_the_factor() { /** @var \Okta\UserFactors\SecurityQuestionFactorProfile $profile */ - $profile = static::$testable->getProfile(); + $profile = $this->testable->getProfile(); $profile->setAnswer = 'Test'; - $factor = static::$testable->setProfile($profile); + $factor = $this->testable->setProfile($profile); $this->assertInstanceOf(\Okta\UserFactors\HardwareFactor::class, $factor); } diff --git a/tests/Unit/UserFactors/PushFactorProfileTest.php b/tests/Unit/UserFactors/PushFactorProfileTest.php index a8ed4d4ed7..aa079247b4 100644 --- a/tests/Unit/UserFactors/PushFactorProfileTest.php +++ b/tests/Unit/UserFactors/PushFactorProfileTest.php @@ -15,84 +15,75 @@ * limitations under the License. * ******************************************************************************/ -class PushFactorProfileTest extends BaseTestCase +class PushFactorProfileTest extends BaseUnitTestCase { - protected static $properties; - protected static $testable; - - public function setUp() - { - parent::setUp(); - $this->createNewHttpClient(); - $model = '/UserFactors/factorProfilePush.json'; - static::$properties = json_decode($this->getModel($model)); - static::$testable = $this->createModel($model, \Okta\UserFactors\PushFactorProfile::class); - } + protected $model = '/UserFactors/factorProfilePush.json'; + protected $modelType = \Okta\UserFactors\PushFactorProfile::class; /** @test */ public function name_is_gettable() { - $this->assertEquals(static::$properties->name, static::$testable->getName()); - $this->assertEquals(static::$properties->name, static::$testable->name); + $this->assertEquals($this->properties->name, $this->testable->getName()); + $this->assertEquals($this->properties->name, $this->testable->name); } /** @test */ public function name_is_settable() { - static::$testable->setName('some name'); - static::assertEquals('some name', static::$testable->getName()); + $this->testable->setName('some name'); + static::assertEquals('some name', $this->testable->getName()); - static::$testable->name = 'some name 2'; - static::assertEquals('some name 2', static::$testable->getName()); + $this->testable->name = 'some name 2'; + static::assertEquals('some name 2', $this->testable->getName()); } /** @test */ public function version_is_gettable() { - $this->assertEquals(static::$properties->version, static::$testable->getVersion()); - $this->assertEquals(static::$properties->version, static::$testable->version); + $this->assertEquals($this->properties->version, $this->testable->getVersion()); + $this->assertEquals($this->properties->version, $this->testable->version); } /** @test */ public function version_is_settable() { - static::$testable->setVersion('some version'); - static::assertEquals('some version', static::$testable->getVersion()); + $this->testable->setVersion('some version'); + static::assertEquals('some version', $this->testable->getVersion()); - static::$testable->version = 'some version 2'; - static::assertEquals('some version 2', static::$testable->getVersion()); + $this->testable->version = 'some version 2'; + static::assertEquals('some version 2', $this->testable->getVersion()); } /** @test */ public function platform_is_gettable() { - $this->assertEquals(static::$properties->platform, static::$testable->getPlatform()); - $this->assertEquals(static::$properties->platform, static::$testable->platform); + $this->assertEquals($this->properties->platform, $this->testable->getPlatform()); + $this->assertEquals($this->properties->platform, $this->testable->platform); } /** @test */ public function device_type_is_accessible() { - $this->assertEquals(static::$properties->deviceType, static::$testable->getDeviceType()); - $this->assertEquals(static::$properties->deviceType, static::$testable->deviceType); + $this->assertEquals($this->properties->deviceType, $this->testable->getDeviceType()); + $this->assertEquals($this->properties->deviceType, $this->testable->deviceType); } /** @test */ public function credential_id_is_accessible() { - $this->assertEquals(static::$properties->credentialId, static::$testable->getCredentialId()); - $this->assertEquals(static::$properties->credentialId, static::$testable->credentialId); + $this->assertEquals($this->properties->credentialId, $this->testable->getCredentialId()); + $this->assertEquals($this->properties->credentialId, $this->testable->credentialId); } /** @test */ public function credential_id_is_settable() { - static::$testable->setCredentialId('test@mailinator.com'); - static::assertEquals('test@mailinator.com', static::$testable->getCredentialId()); + $this->testable->setCredentialId('test@mailinator.com'); + static::assertEquals('test@mailinator.com', $this->testable->getCredentialId()); - static::$testable->credentialId = 'test2@mailinator.com'; - static::assertEquals('test2@mailinator.com', static::$testable->getCredentialId()); + $this->testable->credentialId = 'test2@mailinator.com'; + static::assertEquals('test2@mailinator.com', $this->testable->getCredentialId()); } diff --git a/tests/Unit/UserFactors/PushFactorTest.php b/tests/Unit/UserFactors/PushFactorTest.php index 31543b3b77..9786e926a2 100644 --- a/tests/Unit/UserFactors/PushFactorTest.php +++ b/tests/Unit/UserFactors/PushFactorTest.php @@ -17,25 +17,15 @@ use Okta\ClientBuilder; -class PushFactor extends BaseTestCase +class PushFactor extends BaseUnitTestCase { - protected static $properties; - /** @var User */ - protected static $testable; - - public function setUp() - { - parent::setUp(); - $this->createNewHttpClient(); - $model = '/UserFactors/pushFactor.json'; - static::$properties = json_decode($this->getModelJson($model)); - static::$testable = $this->createModel($model, \Okta\UserFactors\PushFactor::class); - } + protected $model = '/UserFactors/pushFactor.json'; + protected $modelType = \Okta\UserFactors\PushFactor::class; /** @test */ public function can_get_profile_from_factor() { - $profile = self::$testable->getProfile(); + $profile = $this->testable->getProfile(); $this->assertInstanceOf(\Okta\UserFactors\PushFactorProfile::class, $profile); @@ -45,10 +35,10 @@ public function can_get_profile_from_factor() public function a_profile_can_be_set_on_the_factor() { /** @var \Okta\UserFactors\SecurityQuestionFactorProfile $profile */ - $profile = static::$testable->getProfile(); + $profile = $this->testable->getProfile(); $profile->setAnswer = 'Test'; - $factor = static::$testable->setProfile($profile); + $factor = $this->testable->setProfile($profile); $this->assertInstanceOf(\Okta\UserFactors\PushFactor::class, $factor); } diff --git a/tests/Unit/UserFactors/SecurityQuestionFactorProfileTest.php b/tests/Unit/UserFactors/SecurityQuestionFactorProfileTest.php index 1f27336f0a..5c9d55d727 100644 --- a/tests/Unit/UserFactors/SecurityQuestionFactorProfileTest.php +++ b/tests/Unit/UserFactors/SecurityQuestionFactorProfileTest.php @@ -15,70 +15,60 @@ * limitations under the License. * ******************************************************************************/ -class SecurityQuestionFactorProfileTest extends BaseTestCase +class SecurityQuestionFactorProfileTest extends BaseUnitTestCase { - - protected static $properties; - protected static $testable; - - public function setUp() - { - parent::setUp(); - $this->createNewHttpClient(); - $model = '/UserFactors/factorProfileQuestion.json'; - static::$properties = json_decode($this->getModel($model)); - static::$testable = $this->createModel($model, \Okta\UserFactors\SecurityQuestionFactorProfile::class); - } + protected $model = '/UserFactors/factorProfileQuestion.json'; + protected $modelType = \Okta\UserFactors\SecurityQuestionFactorProfile::class; /** @test */ public function answer_is_accessible() { - $this->assertEquals(static::$properties->answer, static::$testable->getAnswer()); - $this->assertEquals(static::$properties->answer, static::$testable->answer); + $this->assertEquals($this->properties->answer, $this->testable->getAnswer()); + $this->assertEquals($this->properties->answer, $this->testable->answer); } /** @test */ public function answer_is_settable() { - static::$testable->setAnswer('My Answer'); - static::assertEquals('My Answer', static::$testable->getAnswer()); + $this->testable->setAnswer('My Answer'); + static::assertEquals('My Answer', $this->testable->getAnswer()); - static::$testable->answer = 'Custom Answer'; - static::assertEquals('Custom Answer', static::$testable->getAnswer()); + $this->testable->answer = 'Custom Answer'; + static::assertEquals('Custom Answer', $this->testable->getAnswer()); } /** @test */ public function question_is_accessible() { - $this->assertEquals(static::$properties->question, static::$testable->getQuestion()); - $this->assertEquals(static::$properties->question, static::$testable->question); + $this->assertEquals($this->properties->question, $this->testable->getQuestion()); + $this->assertEquals($this->properties->question, $this->testable->question); } /** @test */ public function question_is_settable() { - static::$testable->setQuestion('my_question'); - static::assertEquals('my_question', static::$testable->getQuestion()); + $this->testable->setQuestion('my_question'); + static::assertEquals('my_question', $this->testable->getQuestion()); - static::$testable->question = 'custom_question'; - static::assertEquals('custom_question', static::$testable->getQuestion()); + $this->testable->question = 'custom_question'; + static::assertEquals('custom_question', $this->testable->getQuestion()); } /** @test */ public function question_text_is_accessible() { - $this->assertEquals(static::$properties->questionText, static::$testable->getQuestionText()); - $this->assertEquals(static::$properties->questionText, static::$testable->questionText); + $this->assertEquals($this->properties->questionText, $this->testable->getQuestionText()); + $this->assertEquals($this->properties->questionText, $this->testable->questionText); } /** @test */ public function question_text_is_settable() { - static::$testable->setQuestionText('My Answer'); - static::assertEquals('My Answer', static::$testable->getQuestionText()); + $this->testable->setQuestionText('My Answer'); + static::assertEquals('My Answer', $this->testable->getQuestionText()); - static::$testable->questionText = "Custom Answer"; - static::assertEquals("Custom Answer", static::$testable->getQuestionText()); + $this->testable->questionText = "Custom Answer"; + static::assertEquals("Custom Answer", $this->testable->getQuestionText()); } } diff --git a/tests/Unit/UserFactors/SecurityQuestionFactorTest.php b/tests/Unit/UserFactors/SecurityQuestionFactorTest.php index c26734d7b8..c5c2724d78 100644 --- a/tests/Unit/UserFactors/SecurityQuestionFactorTest.php +++ b/tests/Unit/UserFactors/SecurityQuestionFactorTest.php @@ -17,25 +17,15 @@ use Okta\ClientBuilder; -class SecurityQuestionFactorTest extends BaseTestCase +class SecurityQuestionFactorTest extends BaseUnitTestCase { - protected static $properties; - /** @var User */ - protected static $testable; - - public function setUp() - { - parent::setUp(); - $this->createNewHttpClient(); - $model = '/UserFactors/securityQuestionFactor.json'; - static::$properties = json_decode($this->getModelJson($model)); - static::$testable = $this->createModel($model, \Okta\UserFactors\SecurityQuestionFactor::class); - } + protected $model = '/UserFactors/securityQuestionFactor.json'; + protected $modelType = \Okta\UserFactors\SecurityQuestionFactor::class; /** @test */ public function can_get_profile_from_factor() { - $profile = self::$testable->getProfile(); + $profile = $this->testable->getProfile(); $this->assertInstanceOf(\Okta\UserFactors\SecurityQuestionFactorProfile::class, $profile); @@ -45,10 +35,10 @@ public function can_get_profile_from_factor() public function a_profile_can_be_set_on_the_factor() { /** @var \Okta\UserFactors\SecurityQuestionFactorProfile $profile */ - $profile = static::$testable->getProfile(); + $profile = $this->testable->getProfile(); $profile->setAnswer = 'Test'; - $factor = static::$testable->setProfile($profile); + $factor = $this->testable->setProfile($profile); $this->assertInstanceOf(\Okta\UserFactors\SecurityQuestionFactor::class, $factor); } diff --git a/tests/Unit/UserFactors/TokenFactorProfileTest.php b/tests/Unit/UserFactors/TokenFactorProfileTest.php index ba250e023a..2ff217f126 100644 --- a/tests/Unit/UserFactors/TokenFactorProfileTest.php +++ b/tests/Unit/UserFactors/TokenFactorProfileTest.php @@ -15,36 +15,26 @@ * limitations under the License. * ******************************************************************************/ -class TokenFactorProfileTest extends BaseTestCase +class TokenFactorProfileTest extends BaseUnitTestCase { - - protected static $properties; - protected static $testable; - - public function setUp() - { - parent::setUp(); - $this->createNewHttpClient(); - $model = '/UserFactors/factorProfileToken.json'; - static::$properties = json_decode($this->getModel($model)); - static::$testable = $this->createModel($model, \Okta\UserFactors\TokenFactorProfile::class); - } + protected $model = '/UserFactors/factorProfileToken.json'; + protected $modelType = \Okta\UserFactors\TokenFactorProfile::class; /** @test */ public function credential_id_is_gettable() { - $this->assertEquals(static::$properties->credentialId, static::$testable->getCredentialId()); - $this->assertEquals(static::$properties->credentialId, static::$testable->credentialId); + $this->assertEquals($this->properties->credentialId, $this->testable->getCredentialId()); + $this->assertEquals($this->properties->credentialId, $this->testable->credentialId); } /** @test */ public function credential_id_is_settable() { - static::$testable->setCredentialId('test@mailinator.com'); - static::assertEquals('test@mailinator.com', static::$testable->getCredentialId()); + $this->testable->setCredentialId('test@mailinator.com'); + static::assertEquals('test@mailinator.com', $this->testable->getCredentialId()); - static::$testable->credentialId = 'test2@mailinator.com'; - static::assertEquals('test2@mailinator.com', static::$testable->getCredentialId()); + $this->testable->credentialId = 'test2@mailinator.com'; + static::assertEquals('test2@mailinator.com', $this->testable->getCredentialId()); } } diff --git a/tests/Unit/UserFactors/TokenFactorTest.php b/tests/Unit/UserFactors/TokenFactorTest.php index 6285af7570..b45578ba0d 100644 --- a/tests/Unit/UserFactors/TokenFactorTest.php +++ b/tests/Unit/UserFactors/TokenFactorTest.php @@ -17,25 +17,15 @@ use Okta\ClientBuilder; -class TokenFactor extends BaseTestCase +class TokenFactor extends BaseUnitTestCase { - protected static $properties; - /** @var User */ - protected static $testable; - - public function setUp() - { - parent::setUp(); - $this->createNewHttpClient(); - $model = '/UserFactors/pushFactor.json'; - static::$properties = json_decode($this->getModelJson($model)); - static::$testable = $this->createModel($model, \Okta\UserFactors\TokenFactor::class); - } + protected $model = '/UserFactors/pushFactor.json'; + protected $modelType = \Okta\UserFactors\TokenFactor::class; /** @test */ public function can_get_profile_from_factor() { - $profile = self::$testable->getProfile(); + $profile = $this->testable->getProfile(); $this->assertInstanceOf(\Okta\UserFactors\TokenFactorProfile::class, $profile); @@ -45,10 +35,10 @@ public function can_get_profile_from_factor() public function a_profile_can_be_set_on_the_factor() { /** @var \Okta\UserFactors\SecurityQuestionFactorProfile $profile */ - $profile = static::$testable->getProfile(); + $profile = $this->testable->getProfile(); $profile->setAnswer = 'Test'; - $factor = static::$testable->setProfile($profile); + $factor = $this->testable->setProfile($profile); $this->assertInstanceOf(\Okta\UserFactors\TokenFactor::class, $factor); } diff --git a/tests/Unit/UserFactors/TotpFactorProfileTest.php b/tests/Unit/UserFactors/TotpFactorProfileTest.php index 5904fe1265..75901e3269 100644 --- a/tests/Unit/UserFactors/TotpFactorProfileTest.php +++ b/tests/Unit/UserFactors/TotpFactorProfileTest.php @@ -15,36 +15,26 @@ * limitations under the License. * ******************************************************************************/ -class TotpFactorProfileTest extends BaseTestCase +class TotpFactorProfileTest extends BaseUnitTestCase { - - protected static $properties; - protected static $testable; - - public function setUp() - { - parent::setUp(); - $this->createNewHttpClient(); - $model = '/UserFactors/factorProfileTotp.json'; - static::$properties = json_decode($this->getModel($model)); - static::$testable = $this->createModel($model, \Okta\UserFactors\TotpFactorProfile::class); - } + protected $model = '/UserFactors/factorProfileTotp.json'; + protected $modelType = \Okta\UserFactors\TotpFactorProfile::class; /** @test */ public function credential_id_is_gettable() { - $this->assertEquals(static::$properties->credentialId, static::$testable->getCredentialId()); - $this->assertEquals(static::$properties->credentialId, static::$testable->credentialId); + $this->assertEquals($this->properties->credentialId, $this->testable->getCredentialId()); + $this->assertEquals($this->properties->credentialId, $this->testable->credentialId); } /** @test */ public function credential_id_is_settable() { - static::$testable->setCredentialId('test@mailinator.com'); - static::assertEquals('test@mailinator.com', static::$testable->getCredentialId()); + $this->testable->setCredentialId('test@mailinator.com'); + static::assertEquals('test@mailinator.com', $this->testable->getCredentialId()); - static::$testable->credentialId = 'test2@mailinator.com'; - static::assertEquals('test2@mailinator.com', static::$testable->getCredentialId()); + $this->testable->credentialId = 'test2@mailinator.com'; + static::assertEquals('test2@mailinator.com', $this->testable->getCredentialId()); } } diff --git a/tests/Unit/UserFactors/TotpFactorTest.php b/tests/Unit/UserFactors/TotpFactorTest.php index eface088cd..665ff32cde 100644 --- a/tests/Unit/UserFactors/TotpFactorTest.php +++ b/tests/Unit/UserFactors/TotpFactorTest.php @@ -17,25 +17,15 @@ use Okta\ClientBuilder; -class TotpFactor extends BaseTestCase +class TotpFactor extends BaseUnitTestCase { - protected static $properties; - /** @var User */ - protected static $testable; - - public function setUp() - { - parent::setUp(); - $this->createNewHttpClient(); - $model = '/UserFactors/totpFactor.json'; - static::$properties = json_decode($this->getModelJson($model)); - static::$testable = $this->createModel($model, \Okta\UserFactors\TotpFactor::class); - } + protected $model = '/UserFactors/totpFactor.json'; + protected $modelType = \Okta\UserFactors\TotpFactor::class; /** @test */ public function can_get_profile_from_factor() { - $profile = self::$testable->getProfile(); + $profile = $this->testable->getProfile(); $this->assertInstanceOf(\Okta\UserFactors\TotpFactorProfile::class, $profile); @@ -45,10 +35,10 @@ public function can_get_profile_from_factor() public function a_profile_can_be_set_on_the_factor() { /** @var \Okta\UserFactors\SecurityQuestionFactorProfile $profile */ - $profile = static::$testable->getProfile(); + $profile = $this->testable->getProfile(); $profile->setAnswer = 'Test'; - $factor = static::$testable->setProfile($profile); + $factor = $this->testable->setProfile($profile); $this->assertInstanceOf(\Okta\UserFactors\TotpFactor::class, $factor); } diff --git a/tests/Unit/UserFactors/WebFactorProfileTest.php b/tests/Unit/UserFactors/WebFactorProfileTest.php index 89c8d6fd7e..03f2a0830e 100644 --- a/tests/Unit/UserFactors/WebFactorProfileTest.php +++ b/tests/Unit/UserFactors/WebFactorProfileTest.php @@ -15,36 +15,26 @@ * limitations under the License. * ******************************************************************************/ -class WebFactorProfileTest extends BaseTestCase +class WebFactorProfileTest extends BaseUnitTestCase { - - protected static $properties; - protected static $testable; - - public function setUp() - { - parent::setUp(); - $this->createNewHttpClient(); - $model = '/UserFactors/factorProfileWeb.json'; - static::$properties = json_decode($this->getModel($model)); - static::$testable = $this->createModel($model, \Okta\UserFactors\WebFactorProfile::class); - } + protected $model = '/UserFactors/factorProfileWeb.json'; + protected $modelType = \Okta\UserFactors\WebFactorProfile::class; /** @test */ public function credential_id_is_gettable() { - $this->assertEquals(static::$properties->credentialId, static::$testable->getCredentialId()); - $this->assertEquals(static::$properties->credentialId, static::$testable->credentialId); + $this->assertEquals($this->properties->credentialId, $this->testable->getCredentialId()); + $this->assertEquals($this->properties->credentialId, $this->testable->credentialId); } /** @test */ public function credential_id_is_settable() { - static::$testable->setCredentialId('test@mailinator.com'); - static::assertEquals('test@mailinator.com', static::$testable->getCredentialId()); + $this->testable->setCredentialId('test@mailinator.com'); + static::assertEquals('test@mailinator.com', $this->testable->getCredentialId()); - static::$testable->credentialId = 'test2@mailinator.com'; - static::assertEquals('test2@mailinator.com', static::$testable->getCredentialId()); + $this->testable->credentialId = 'test2@mailinator.com'; + static::assertEquals('test2@mailinator.com', $this->testable->getCredentialId()); } } diff --git a/tests/Unit/UserFactors/WebFactorTest.php b/tests/Unit/UserFactors/WebFactorTest.php index 6d829f01f4..744583ba50 100644 --- a/tests/Unit/UserFactors/WebFactorTest.php +++ b/tests/Unit/UserFactors/WebFactorTest.php @@ -17,25 +17,15 @@ use Okta\ClientBuilder; -class WebFactor extends BaseTestCase +class WebFactor extends BaseUnitTestCase { - protected static $properties; - /** @var User */ - protected static $testable; - - public function setUp() - { - parent::setUp(); - $this->createNewHttpClient(); - $model = '/UserFactors/webFactor.json'; - static::$properties = json_decode($this->getModelJson($model)); - static::$testable = $this->createModel($model, \Okta\UserFactors\WebFactor::class); - } + protected $model = '/UserFactors/webFactor.json'; + protected $modelType = \Okta\UserFactors\WebFactor::class; /** @test */ public function can_get_profile_from_factor() { - $profile = self::$testable->getProfile(); + $profile = $this->testable->getProfile(); $this->assertInstanceOf(\Okta\UserFactors\WebFactorProfile::class, $profile); @@ -45,10 +35,10 @@ public function can_get_profile_from_factor() public function a_profile_can_be_set_on_the_factor() { /** @var \Okta\UserFactors\SecurityQuestionFactorProfile $profile */ - $profile = static::$testable->getProfile(); + $profile = $this->testable->getProfile(); $profile->setAnswer = 'Test'; - $factor = static::$testable->setProfile($profile); + $factor = $this->testable->setProfile($profile); $this->assertInstanceOf(\Okta\UserFactors\WebFactor::class, $factor); } diff --git a/tests/Unit/Users/UserTest.php b/tests/Unit/Users/UserTest.php index 2a34d3171f..7251e86144 100644 --- a/tests/Unit/Users/UserTest.php +++ b/tests/Unit/Users/UserTest.php @@ -20,18 +20,9 @@ use Okta\Users\User; use PHPUnit\Framework\TestCase; -class UserTest extends BaseTestCase +class UserTest extends BaseUnitTestCase { - protected static $properties; - /** @var User */ - protected static $testable; - - public static function setUpBeforeClass() - { - $clientBuilder = (new ClientBuilder())->build(); - - static::$properties = json_decode( - '{ + protected $model = '{ "id": "00ub0oNGTSWTBKOLGLNR", "status": "ACTIVE", "transitioningToStatus": "ACTIVE", @@ -104,150 +95,141 @@ public static function setUpBeforeClass() "withValue": 30 } } -}' - ); - - $class = new \stdClass(); - foreach(static::$properties as $prop=>$value) - { - $class->{$prop} = $value; - } - self::$testable = new User(null, $class); - - } +}'; + protected $modelType = \Okta\Users\User::class; /** @test */ public function can_get_id_property() { - $this->assertEquals(static::$properties->id, static::$testable->getId()); - $this->assertEquals(static::$properties->id, static::$testable->id); + $this->assertEquals($this->properties->id, $this->testable->getId()); + $this->assertEquals($this->properties->id, $this->testable->id); } /** @test */ public function status_is_accessible() { - $this->assertEquals(static::$properties->status, static::$testable->getStatus()); - $this->assertEquals(static::$properties->status, static::$testable->status); + $this->assertEquals($this->properties->status, $this->testable->getStatus()); + $this->assertEquals($this->properties->status, $this->testable->status); } /** @test */ public function created_is_accessible() { - $ts = Carbon::parse(static::$properties->created)->timestamp; - $this->assertInstanceOf(\Carbon\Carbon::class, static::$testable->created); - $this->assertEquals($ts, static::$testable->getCreated()->timestamp); - $this->assertEquals($ts, static::$testable->created->timestamp); + $ts = Carbon::parse($this->properties->created)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->created); + $this->assertEquals($ts, $this->testable->getCreated()->timestamp); + $this->assertEquals($ts, $this->testable->created->timestamp); } /** @test */ public function activated_is_accessible() { - $ts = Carbon::parse(static::$properties->activated)->timestamp; - $this->assertInstanceOf(\Carbon\Carbon::class, static::$testable->activated); - $this->assertEquals($ts, static::$testable->getActivated()->timestamp); - $this->assertEquals($ts, static::$testable->activated->timestamp); + $ts = Carbon::parse($this->properties->activated)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->activated); + $this->assertEquals($ts, $this->testable->getActivated()->timestamp); + $this->assertEquals($ts, $this->testable->activated->timestamp); } /** @test */ public function status_changed_is_accessible() { - $ts = Carbon::parse(static::$properties->statusChanged)->timestamp; - $this->assertInstanceOf(\Carbon\Carbon::class, static::$testable->statusChanged); - $this->assertEquals($ts, static::$testable->getStatusChanged()->timestamp); - $this->assertEquals($ts, static::$testable->statusChanged->timestamp); + $ts = Carbon::parse($this->properties->statusChanged)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->statusChanged); + $this->assertEquals($ts, $this->testable->getStatusChanged()->timestamp); + $this->assertEquals($ts, $this->testable->statusChanged->timestamp); } /** @test */ public function last_login_is_accessible() { - $ts = Carbon::parse(static::$properties->lastLogin)->timestamp; - $this->assertInstanceOf(\Carbon\Carbon::class, static::$testable->lastLogin); - $this->assertEquals($ts, static::$testable->getLastLogin()->timestamp); - $this->assertEquals($ts, static::$testable->lastLogin->timestamp); + $ts = Carbon::parse($this->properties->lastLogin)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->lastLogin); + $this->assertEquals($ts, $this->testable->getLastLogin()->timestamp); + $this->assertEquals($ts, $this->testable->lastLogin->timestamp); } /** @test */ public function last_updated_is_accessible() { - $ts = Carbon::parse(static::$properties->lastUpdated)->timestamp; - $this->assertInstanceOf(\Carbon\Carbon::class, static::$testable->lastUpdated); - $this->assertEquals($ts, static::$testable->getLastUpdated()->timestamp); - $this->assertEquals($ts, static::$testable->lastUpdated->timestamp); + $ts = Carbon::parse($this->properties->lastUpdated)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->lastUpdated); + $this->assertEquals($ts, $this->testable->getLastUpdated()->timestamp); + $this->assertEquals($ts, $this->testable->lastUpdated->timestamp); } /** @test */ public function password_changed_is_accessible() { - $ts = Carbon::parse(static::$properties->passwordChanged)->timestamp; - $this->assertInstanceOf(\Carbon\Carbon::class, static::$testable->passwordChanged); - $this->assertEquals($ts, static::$testable->getPasswordChanged()->timestamp); - $this->assertEquals($ts, static::$testable->passwordChanged->timestamp); + $ts = Carbon::parse($this->properties->passwordChanged)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->passwordChanged); + $this->assertEquals($ts, $this->testable->getPasswordChanged()->timestamp); + $this->assertEquals($ts, $this->testable->passwordChanged->timestamp); } /** @test */ public function profile_is_accessible() { - $this->assertInstanceOf(\Okta\Users\UserProfile::class, static::$testable->getProfile()); - $this->assertInstanceOf(\Okta\Users\UserProfile::class, static::$testable->profile); + $this->assertInstanceOf(\Okta\Users\UserProfile::class, $this->testable->getProfile()); + $this->assertInstanceOf(\Okta\Users\UserProfile::class, $this->testable->profile); } /** @test */ public function credentials_is_accessible() { - $this->assertInstanceOf(\Okta\Users\UserCredentials::class, static::$testable->getCredentials()); - $this->assertInstanceOf(\Okta\Users\UserCredentials::class, static::$testable->credentials); + $this->assertInstanceOf(\Okta\Users\UserCredentials::class, $this->testable->getCredentials()); + $this->assertInstanceOf(\Okta\Users\UserCredentials::class, $this->testable->credentials); } /** @test */ public function transitioning_to_status_is_accessible() { - $this->assertEquals(static::$properties->transitioningToStatus, static::$testable->getTransitioningToStatus()); - $this->assertEquals(static::$properties->transitioningToStatus, static::$testable->transitioningToStatus); + $this->assertEquals($this->properties->transitioningToStatus, $this->testable->getTransitioningToStatus()); + $this->assertEquals($this->properties->transitioningToStatus, $this->testable->transitioningToStatus); } /** @test */ public function links_is_accessible() { - $this->assertEquals(static::$properties->_links, static::$testable->getLinks()); - $this->assertEquals(static::$properties->_links, static::$testable->links); + $this->assertEquals($this->properties->_links, $this->testable->getLinks()); + $this->assertEquals($this->properties->_links, $this->testable->links); } /** @test */ public function embedded_is_accessible() { - $this->assertEquals(static::$properties->_embedded, static::$testable->getEmbedded()); - $this->assertEquals(static::$properties->_embedded, static::$testable->embedded); + $this->assertEquals($this->properties->_embedded, $this->testable->getEmbedded()); + $this->assertEquals($this->properties->_embedded, $this->testable->embedded); } /** @test */ public function credentials_is_settable() { - $credentials = static::$testable->getCredentials(); + $credentials = $this->testable->getCredentials(); $credentials->testProp = 'Hello'; - static::$testable->setCredentials($credentials); - static::assertInstanceOf(\Okta\Users\UserCredentials::class, static::$testable->getCredentials()); - static::assertEquals('Hello', static::$testable->getCredentials()->testProp); + $this->testable->setCredentials($credentials); + static::assertInstanceOf(\Okta\Users\UserCredentials::class, $this->testable->getCredentials()); + static::assertEquals('Hello', $this->testable->getCredentials()->testProp); - static::$testable->credentials = $credentials; - static::assertInstanceOf(\Okta\Users\UserCredentials::class, static::$testable->credentials); - static::assertEquals('Hello', static::$testable->credentials->testProp); + $this->testable->credentials = $credentials; + static::assertInstanceOf(\Okta\Users\UserCredentials::class, $this->testable->credentials); + static::assertEquals('Hello', $this->testable->credentials->testProp); } /** @test */ public function profile_is_settable() { - $profile = static::$testable->getProfile(); + $profile = $this->testable->getProfile(); $profile->firstName = 'Test'; - static::$testable->setProfile($profile); - static::assertInstanceOf(\Okta\Users\UserProfile::class, static::$testable->getProfile()); - static::assertEquals('Test', static::$testable->getProfile()->getFirstName()); + $this->testable->setProfile($profile); + static::assertInstanceOf(\Okta\Users\UserProfile::class, $this->testable->getProfile()); + static::assertEquals('Test', $this->testable->getProfile()->getFirstName()); - static::$testable->profile = $profile; - static::assertInstanceOf(\Okta\Users\UserProfile::class, static::$testable->profile); - static::assertEquals('Test', static::$testable->profile->firstName); + $this->testable->profile = $profile; + static::assertInstanceOf(\Okta\Users\UserProfile::class, $this->testable->profile); + static::assertEquals('Test', $this->testable->profile->firstName); } /** @test */ @@ -399,7 +381,6 @@ public function change_recovery_question_requests_correct_location() ); } - /** @test */ public function get_groups_makes_request_to_correct_location() { diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 6ebbf554f4..ced9b07728 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,3 +1,4 @@ Date: Wed, 22 Nov 2017 15:16:04 -0500 Subject: [PATCH 13/22] WIP --- openapi/generator/index.js | 19 +++++ openapi/generator/templates/model.php.hbs | 23 ++++++ src/Applications/AppUser.php | 1 - src/Applications/AppUserCredentials.php | 1 - src/Applications/Application.php | 1 - src/Applications/ApplicationAccessibility.php | 1 - src/Applications/ApplicationCredentials.php | 1 - .../ApplicationCredentialsOAuthClient.php | 1 - .../ApplicationCredentialsSigning.php | 1 - ...ApplicationCredentialsUsernameTemplate.php | 1 - .../ApplicationGroupAssignment.php | 1 - src/Applications/ApplicationLicensing.php | 1 - src/Applications/ApplicationSettings.php | 1 - .../ApplicationSettingsApplication.php | 1 - .../ApplicationSettingsNotifications.php | 1 - .../ApplicationSettingsNotificationsVpn.php | 1 - ...icationSettingsNotificationsVpnNetwork.php | 1 - src/Applications/ApplicationVisibility.php | 1 - .../ApplicationVisibilityHide.php | 1 - src/Applications/AutoLoginApplication.php | 1 - .../AutoLoginApplicationSettings.php | 1 - .../AutoLoginApplicationSettingsSignOn.php | 1 - src/Applications/BasicApplicationSettings.php | 1 - .../BasicApplicationSettingsApplication.php | 1 - src/Applications/BasicAuthApplication.php | 1 - src/Applications/BookmarkApplication.php | 1 - .../BookmarkApplicationSettings.php | 1 - ...BookmarkApplicationSettingsApplication.php | 1 - src/Applications/BrowserPluginApplication.php | 1 - src/Applications/JsonWebKeyRSAMediated.php | 1 - .../OAuthApplicationCredentials.php | 1 - src/Applications/OpenIdConnectApplication.php | 1 - .../OpenIdConnectApplicationSettings.php | 1 - ...OpenIdConnectApplicationSettingsClient.php | 1 - src/Applications/PublicSignOnModeMediated.php | 1 - src/Applications/SamlApplication.php | 1 - src/Applications/SamlApplicationSettings.php | 1 - .../SamlApplicationSettingsSignOn.php | 1 - .../SchemeApplicationCredentials.php | 1 - .../SecurePasswordStoreApplication.php | 1 - ...SecurePasswordStoreApplicationSettings.php | 1 - ...ordStoreApplicationSettingsApplication.php | 1 - src/Applications/SwaApplication.php | 1 - src/Applications/SwaApplicationSettings.php | 1 - .../SwaApplicationSettingsApplication.php | 1 - src/Applications/SwaThreeFieldApplication.php | 1 - .../SwaThreeFieldApplicationSettings.php | 1 - ...reeFieldApplicationSettingsApplication.php | 1 - src/Applications/WsFederationApplication.php | 1 - .../WsFederationApplicationSettings.php | 1 - ...derationApplicationSettingsApplication.php | 1 - src/DataStore/DefaultDataStore.php | 20 +++++ src/Generated/Applications/AppUser.php | 15 ++++ src/Generated/Applications/Application.php | 67 +++-------------- .../AutoLoginApplicationSettings.php | 2 +- ...onWebKeyRSAMediated.php => JsonWebKey.php} | 2 +- .../OpenIdConnectApplicationSettings.php | 2 +- .../Applications/PublicSignOnModeMediated.php | 24 ------ .../Applications/SamlApplicationSettings.php | 2 +- .../Applications/SamlAttributeStatement.php | 74 +++++++++++++++++++ ...SecurePasswordStoreApplicationSettings.php | 2 +- .../WsFederationApplicationSettings.php | 2 +- tests/Unit/Applications/ApplicationTest.php | 73 ++++++++++-------- tests/Unit/Users/UserTest.php | 2 +- 64 files changed, 210 insertions(+), 168 deletions(-) rename src/Generated/Applications/{JsonWebKeyRSAMediated.php => JsonWebKey.php} (98%) delete mode 100644 src/Generated/Applications/PublicSignOnModeMediated.php create mode 100644 src/Generated/Applications/SamlAttributeStatement.php diff --git a/openapi/generator/index.js b/openapi/generator/index.js index 611f3a54a5..803c1fe2bc 100644 --- a/openapi/generator/index.js +++ b/openapi/generator/index.js @@ -111,6 +111,15 @@ function getExtends(modelName) { case 'SecurePasswordStoreApplication': case 'WsFederationApplication': return '\\Okta\\Applications\\Application'; + case 'AutoLoginApplicationSettings': + case 'BasicAuthApplicationSettings': + case 'BookmarApplicationSettings': + case 'BrowserPluginApplicationSettings': + case 'OpenIdConnectApplicationSettings': + case 'SamlApplicationSettings': + case 'SecurePasswordStoreApplicationSettings': + case 'WsFederationApplicationSettings': + return '\\Okta\\Applications\\ApplicationSettings'; case 'SwaApplication': case 'SwaThreeFieldApplication': return '\\Okta\\Application\\BrowserPluginApplication'; @@ -359,6 +368,16 @@ function buildGetResourceParams(model) { } +function buildPostParams(model) { + + switch(model.operation.operationId) { + case 'getFactor': + return String.raw`"factors/{$factorId}", \Okta\UserFactors\Factor::class, "/users/{$this->id}", []`; + + } + +} + php.process = ({ spec, operations, models, handlebars }) => { const templates = []; diff --git a/openapi/generator/templates/model.php.hbs b/openapi/generator/templates/model.php.hbs index 6a0440ffd4..d890f00d72 100644 --- a/openapi/generator/templates/model.php.hbs +++ b/openapi/generator/templates/model.php.hbs @@ -196,6 +196,29 @@ class {{modelName}} extends {{getExtends modelName}} return $response; {{/if}} } + {{elseif (eq this.operation.method "post")}} + /** + * {{this.operation.description}} + * + {{getMethodParamsComment this}} + * @return mixed|null + */ + public function {{camelCase alias}}({{{getMethodParams this}}}) + { + $uri = "{{{getMethodPath this}}}"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + $response = $this + ->getDataStore() + ->post({{{buildPostParams this}}}); + + {{#if (eq this.operation.responseModel "Factor")}} + return $response->convertFromGenericFactor(); + {{else}} + return $response; + {{/if}} + } {{else}} /** * {{this.operation.description}} diff --git a/src/Applications/AppUser.php b/src/Applications/AppUser.php index d835030547..2722df9270 100644 --- a/src/Applications/AppUser.php +++ b/src/Applications/AppUser.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class AppUser extends \Okta\Generated\Applications\AppUser { diff --git a/src/Applications/AppUserCredentials.php b/src/Applications/AppUserCredentials.php index fb9129e371..e941588f9b 100644 --- a/src/Applications/AppUserCredentials.php +++ b/src/Applications/AppUserCredentials.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class AppUserCredentials extends \Okta\Generated\Applications\AppUserCredentials { diff --git a/src/Applications/Application.php b/src/Applications/Application.php index 94e0508bbc..77f6c45388 100644 --- a/src/Applications/Application.php +++ b/src/Applications/Application.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class Application extends \Okta\Generated\Applications\Application { diff --git a/src/Applications/ApplicationAccessibility.php b/src/Applications/ApplicationAccessibility.php index ee7b3a9cf2..312718b767 100644 --- a/src/Applications/ApplicationAccessibility.php +++ b/src/Applications/ApplicationAccessibility.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class ApplicationAccessibility extends \Okta\Generated\Applications\ApplicationAccessibility { diff --git a/src/Applications/ApplicationCredentials.php b/src/Applications/ApplicationCredentials.php index e5fca8a721..9e66913b73 100644 --- a/src/Applications/ApplicationCredentials.php +++ b/src/Applications/ApplicationCredentials.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class ApplicationCredentials extends \Okta\Generated\Applications\ApplicationCredentials { diff --git a/src/Applications/ApplicationCredentialsOAuthClient.php b/src/Applications/ApplicationCredentialsOAuthClient.php index ed38d7aa13..09fd33ce3f 100644 --- a/src/Applications/ApplicationCredentialsOAuthClient.php +++ b/src/Applications/ApplicationCredentialsOAuthClient.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class ApplicationCredentialsOAuthClient extends \Okta\Generated\Applications\ApplicationCredentialsOAuthClient { diff --git a/src/Applications/ApplicationCredentialsSigning.php b/src/Applications/ApplicationCredentialsSigning.php index 97c0468a8c..6b26cb1918 100644 --- a/src/Applications/ApplicationCredentialsSigning.php +++ b/src/Applications/ApplicationCredentialsSigning.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class ApplicationCredentialsSigning extends \Okta\Generated\Applications\ApplicationCredentialsSigning { diff --git a/src/Applications/ApplicationCredentialsUsernameTemplate.php b/src/Applications/ApplicationCredentialsUsernameTemplate.php index c5212365a0..f2c1881027 100644 --- a/src/Applications/ApplicationCredentialsUsernameTemplate.php +++ b/src/Applications/ApplicationCredentialsUsernameTemplate.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class ApplicationCredentialsUsernameTemplate extends \Okta\Generated\Applications\ApplicationCredentialsUsernameTemplate { diff --git a/src/Applications/ApplicationGroupAssignment.php b/src/Applications/ApplicationGroupAssignment.php index d333c8ee3b..52052362b4 100644 --- a/src/Applications/ApplicationGroupAssignment.php +++ b/src/Applications/ApplicationGroupAssignment.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class ApplicationGroupAssignment extends \Okta\Generated\Applications\ApplicationGroupAssignment { diff --git a/src/Applications/ApplicationLicensing.php b/src/Applications/ApplicationLicensing.php index df3f9430c6..9de678e7ce 100644 --- a/src/Applications/ApplicationLicensing.php +++ b/src/Applications/ApplicationLicensing.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class ApplicationLicensing extends \Okta\Generated\Applications\ApplicationLicensing { diff --git a/src/Applications/ApplicationSettings.php b/src/Applications/ApplicationSettings.php index fcf6fee1aa..e4c24c40be 100644 --- a/src/Applications/ApplicationSettings.php +++ b/src/Applications/ApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class ApplicationSettings extends \Okta\Generated\Applications\ApplicationSettings { diff --git a/src/Applications/ApplicationSettingsApplication.php b/src/Applications/ApplicationSettingsApplication.php index 549f45dd6b..0cdfd79e9e 100644 --- a/src/Applications/ApplicationSettingsApplication.php +++ b/src/Applications/ApplicationSettingsApplication.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class ApplicationSettingsApplication extends \Okta\Generated\Applications\ApplicationSettingsApplication { diff --git a/src/Applications/ApplicationSettingsNotifications.php b/src/Applications/ApplicationSettingsNotifications.php index 1d291bbaef..d2acf01dc4 100644 --- a/src/Applications/ApplicationSettingsNotifications.php +++ b/src/Applications/ApplicationSettingsNotifications.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class ApplicationSettingsNotifications extends \Okta\Generated\Applications\ApplicationSettingsNotifications { diff --git a/src/Applications/ApplicationSettingsNotificationsVpn.php b/src/Applications/ApplicationSettingsNotificationsVpn.php index 64cd38d7b2..b3dfefeb02 100644 --- a/src/Applications/ApplicationSettingsNotificationsVpn.php +++ b/src/Applications/ApplicationSettingsNotificationsVpn.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class ApplicationSettingsNotificationsVpn extends \Okta\Generated\Applications\ApplicationSettingsNotificationsVpn { diff --git a/src/Applications/ApplicationSettingsNotificationsVpnNetwork.php b/src/Applications/ApplicationSettingsNotificationsVpnNetwork.php index f6fa2947f6..6b1e76493b 100644 --- a/src/Applications/ApplicationSettingsNotificationsVpnNetwork.php +++ b/src/Applications/ApplicationSettingsNotificationsVpnNetwork.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class ApplicationSettingsNotificationsVpnNetwork extends \Okta\Generated\Applications\ApplicationSettingsNotificationsVpnNetwork { diff --git a/src/Applications/ApplicationVisibility.php b/src/Applications/ApplicationVisibility.php index 5ff9d3772f..22f108f3b0 100644 --- a/src/Applications/ApplicationVisibility.php +++ b/src/Applications/ApplicationVisibility.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class ApplicationVisibility extends \Okta\Generated\Applications\ApplicationVisibility { diff --git a/src/Applications/ApplicationVisibilityHide.php b/src/Applications/ApplicationVisibilityHide.php index 2b8cda71be..2542f43cbf 100644 --- a/src/Applications/ApplicationVisibilityHide.php +++ b/src/Applications/ApplicationVisibilityHide.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class ApplicationVisibilityHide extends \Okta\Generated\Applications\ApplicationVisibilityHide { diff --git a/src/Applications/AutoLoginApplication.php b/src/Applications/AutoLoginApplication.php index 9b95982b47..429ee9cb7d 100644 --- a/src/Applications/AutoLoginApplication.php +++ b/src/Applications/AutoLoginApplication.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class AutoLoginApplication extends \Okta\Generated\Applications\AutoLoginApplication { diff --git a/src/Applications/AutoLoginApplicationSettings.php b/src/Applications/AutoLoginApplicationSettings.php index 08f037e6d7..db64cbcea6 100644 --- a/src/Applications/AutoLoginApplicationSettings.php +++ b/src/Applications/AutoLoginApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class AutoLoginApplicationSettings extends \Okta\Generated\Applications\AutoLoginApplicationSettings { diff --git a/src/Applications/AutoLoginApplicationSettingsSignOn.php b/src/Applications/AutoLoginApplicationSettingsSignOn.php index 1c3112e107..f9fe7a45e6 100644 --- a/src/Applications/AutoLoginApplicationSettingsSignOn.php +++ b/src/Applications/AutoLoginApplicationSettingsSignOn.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class AutoLoginApplicationSettingsSignOn extends \Okta\Generated\Applications\AutoLoginApplicationSettingsSignOn { diff --git a/src/Applications/BasicApplicationSettings.php b/src/Applications/BasicApplicationSettings.php index b39e3cda27..cf07dd6402 100644 --- a/src/Applications/BasicApplicationSettings.php +++ b/src/Applications/BasicApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class BasicApplicationSettings extends \Okta\Generated\Applications\BasicApplicationSettings { diff --git a/src/Applications/BasicApplicationSettingsApplication.php b/src/Applications/BasicApplicationSettingsApplication.php index 42d21143cf..c89acf6c93 100644 --- a/src/Applications/BasicApplicationSettingsApplication.php +++ b/src/Applications/BasicApplicationSettingsApplication.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class BasicApplicationSettingsApplication extends \Okta\Generated\Applications\BasicApplicationSettingsApplication { diff --git a/src/Applications/BasicAuthApplication.php b/src/Applications/BasicAuthApplication.php index f4630d7ac6..9bd491e4e4 100644 --- a/src/Applications/BasicAuthApplication.php +++ b/src/Applications/BasicAuthApplication.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class BasicAuthApplication extends \Okta\Generated\Applications\BasicAuthApplication { diff --git a/src/Applications/BookmarkApplication.php b/src/Applications/BookmarkApplication.php index 2cfefede67..1742926ec4 100644 --- a/src/Applications/BookmarkApplication.php +++ b/src/Applications/BookmarkApplication.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class BookmarkApplication extends \Okta\Generated\Applications\BookmarkApplication { private $name = "bookmark"; diff --git a/src/Applications/BookmarkApplicationSettings.php b/src/Applications/BookmarkApplicationSettings.php index d2c4ef33e2..4bcdc3a3b6 100644 --- a/src/Applications/BookmarkApplicationSettings.php +++ b/src/Applications/BookmarkApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class BookmarkApplicationSettings extends \Okta\Generated\Applications\BookmarkApplicationSettings { diff --git a/src/Applications/BookmarkApplicationSettingsApplication.php b/src/Applications/BookmarkApplicationSettingsApplication.php index c5f157b7f4..421ae334a5 100644 --- a/src/Applications/BookmarkApplicationSettingsApplication.php +++ b/src/Applications/BookmarkApplicationSettingsApplication.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class BookmarkApplicationSettingsApplication extends \Okta\Generated\Applications\BookmarkApplicationSettingsApplication { diff --git a/src/Applications/BrowserPluginApplication.php b/src/Applications/BrowserPluginApplication.php index f24756fdc5..b645ce9d6c 100644 --- a/src/Applications/BrowserPluginApplication.php +++ b/src/Applications/BrowserPluginApplication.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class BrowserPluginApplication extends \Okta\Generated\Applications\BrowserPluginApplication { diff --git a/src/Applications/JsonWebKeyRSAMediated.php b/src/Applications/JsonWebKeyRSAMediated.php index 4ff574a8ca..7c2020603c 100644 --- a/src/Applications/JsonWebKeyRSAMediated.php +++ b/src/Applications/JsonWebKeyRSAMediated.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class JsonWebKeyRSAMediated extends \Okta\Generated\Applications\JsonWebKeyRSAMediated { diff --git a/src/Applications/OAuthApplicationCredentials.php b/src/Applications/OAuthApplicationCredentials.php index fa6aac9280..918da1f1b9 100644 --- a/src/Applications/OAuthApplicationCredentials.php +++ b/src/Applications/OAuthApplicationCredentials.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class OAuthApplicationCredentials extends \Okta\Generated\Applications\OAuthApplicationCredentials { diff --git a/src/Applications/OpenIdConnectApplication.php b/src/Applications/OpenIdConnectApplication.php index 4724c496f8..da66ac6826 100644 --- a/src/Applications/OpenIdConnectApplication.php +++ b/src/Applications/OpenIdConnectApplication.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class OpenIdConnectApplication extends \Okta\Generated\Applications\OpenIdConnectApplication { diff --git a/src/Applications/OpenIdConnectApplicationSettings.php b/src/Applications/OpenIdConnectApplicationSettings.php index 0d097f1806..45c244a9a6 100644 --- a/src/Applications/OpenIdConnectApplicationSettings.php +++ b/src/Applications/OpenIdConnectApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class OpenIdConnectApplicationSettings extends \Okta\Generated\Applications\OpenIdConnectApplicationSettings { diff --git a/src/Applications/OpenIdConnectApplicationSettingsClient.php b/src/Applications/OpenIdConnectApplicationSettingsClient.php index 9e9c10f384..d9f9ddac0b 100644 --- a/src/Applications/OpenIdConnectApplicationSettingsClient.php +++ b/src/Applications/OpenIdConnectApplicationSettingsClient.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class OpenIdConnectApplicationSettingsClient extends \Okta\Generated\Applications\OpenIdConnectApplicationSettingsClient { diff --git a/src/Applications/PublicSignOnModeMediated.php b/src/Applications/PublicSignOnModeMediated.php index 28878c4e97..299f13dc51 100644 --- a/src/Applications/PublicSignOnModeMediated.php +++ b/src/Applications/PublicSignOnModeMediated.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class PublicSignOnModeMediated extends \Okta\Generated\Applications\PublicSignOnModeMediated { diff --git a/src/Applications/SamlApplication.php b/src/Applications/SamlApplication.php index 9b9fffe5ef..9ee285999c 100644 --- a/src/Applications/SamlApplication.php +++ b/src/Applications/SamlApplication.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class SamlApplication extends \Okta\Generated\Applications\SamlApplication { diff --git a/src/Applications/SamlApplicationSettings.php b/src/Applications/SamlApplicationSettings.php index 750c0de132..0d720e5a05 100644 --- a/src/Applications/SamlApplicationSettings.php +++ b/src/Applications/SamlApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class SamlApplicationSettings extends \Okta\Generated\Applications\SamlApplicationSettings { diff --git a/src/Applications/SamlApplicationSettingsSignOn.php b/src/Applications/SamlApplicationSettingsSignOn.php index c5bffd1bd1..cc692f675e 100644 --- a/src/Applications/SamlApplicationSettingsSignOn.php +++ b/src/Applications/SamlApplicationSettingsSignOn.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class SamlApplicationSettingsSignOn extends \Okta\Generated\Applications\SamlApplicationSettingsSignOn { diff --git a/src/Applications/SchemeApplicationCredentials.php b/src/Applications/SchemeApplicationCredentials.php index 1403ab8f75..8b65f77103 100644 --- a/src/Applications/SchemeApplicationCredentials.php +++ b/src/Applications/SchemeApplicationCredentials.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class SchemeApplicationCredentials extends \Okta\Generated\Applications\SchemeApplicationCredentials { diff --git a/src/Applications/SecurePasswordStoreApplication.php b/src/Applications/SecurePasswordStoreApplication.php index 6bad2f8ba3..3d93be61b8 100644 --- a/src/Applications/SecurePasswordStoreApplication.php +++ b/src/Applications/SecurePasswordStoreApplication.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class SecurePasswordStoreApplication extends \Okta\Generated\Applications\SecurePasswordStoreApplication { diff --git a/src/Applications/SecurePasswordStoreApplicationSettings.php b/src/Applications/SecurePasswordStoreApplicationSettings.php index 2cf32b013d..f5155e9423 100644 --- a/src/Applications/SecurePasswordStoreApplicationSettings.php +++ b/src/Applications/SecurePasswordStoreApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class SecurePasswordStoreApplicationSettings extends \Okta\Generated\Applications\SecurePasswordStoreApplicationSettings { diff --git a/src/Applications/SecurePasswordStoreApplicationSettingsApplication.php b/src/Applications/SecurePasswordStoreApplicationSettingsApplication.php index 20c98f9ecf..4dc08b7ec5 100644 --- a/src/Applications/SecurePasswordStoreApplicationSettingsApplication.php +++ b/src/Applications/SecurePasswordStoreApplicationSettingsApplication.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class SecurePasswordStoreApplicationSettingsApplication extends \Okta\Generated\Applications\SecurePasswordStoreApplicationSettingsApplication { diff --git a/src/Applications/SwaApplication.php b/src/Applications/SwaApplication.php index 9aad1fdef6..1b42920b1a 100644 --- a/src/Applications/SwaApplication.php +++ b/src/Applications/SwaApplication.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class SwaApplication extends \Okta\Generated\Applications\SwaApplication { diff --git a/src/Applications/SwaApplicationSettings.php b/src/Applications/SwaApplicationSettings.php index ec9e8ff0f7..2e84efd749 100644 --- a/src/Applications/SwaApplicationSettings.php +++ b/src/Applications/SwaApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class SwaApplicationSettings extends \Okta\Generated\Applications\SwaApplicationSettings { diff --git a/src/Applications/SwaApplicationSettingsApplication.php b/src/Applications/SwaApplicationSettingsApplication.php index 2848054374..8a44400765 100644 --- a/src/Applications/SwaApplicationSettingsApplication.php +++ b/src/Applications/SwaApplicationSettingsApplication.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class SwaApplicationSettingsApplication extends \Okta\Generated\Applications\SwaApplicationSettingsApplication { diff --git a/src/Applications/SwaThreeFieldApplication.php b/src/Applications/SwaThreeFieldApplication.php index 4b12252c28..ad3c248d14 100644 --- a/src/Applications/SwaThreeFieldApplication.php +++ b/src/Applications/SwaThreeFieldApplication.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class SwaThreeFieldApplication extends \Okta\Generated\Applications\SwaThreeFieldApplication { diff --git a/src/Applications/SwaThreeFieldApplicationSettings.php b/src/Applications/SwaThreeFieldApplicationSettings.php index 571c896b77..b73cec1097 100644 --- a/src/Applications/SwaThreeFieldApplicationSettings.php +++ b/src/Applications/SwaThreeFieldApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class SwaThreeFieldApplicationSettings extends \Okta\Generated\Applications\SwaThreeFieldApplicationSettings { diff --git a/src/Applications/SwaThreeFieldApplicationSettingsApplication.php b/src/Applications/SwaThreeFieldApplicationSettingsApplication.php index 4130a3657e..878b273564 100644 --- a/src/Applications/SwaThreeFieldApplicationSettingsApplication.php +++ b/src/Applications/SwaThreeFieldApplicationSettingsApplication.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class SwaThreeFieldApplicationSettingsApplication extends \Okta\Generated\Applications\SwaThreeFieldApplicationSettingsApplication { diff --git a/src/Applications/WsFederationApplication.php b/src/Applications/WsFederationApplication.php index 0825c465e8..cb77b38de0 100644 --- a/src/Applications/WsFederationApplication.php +++ b/src/Applications/WsFederationApplication.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class WsFederationApplication extends \Okta\Generated\Applications\WsFederationApplication { diff --git a/src/Applications/WsFederationApplicationSettings.php b/src/Applications/WsFederationApplicationSettings.php index 28f27fabda..66551157e5 100644 --- a/src/Applications/WsFederationApplicationSettings.php +++ b/src/Applications/WsFederationApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class WsFederationApplicationSettings extends \Okta\Generated\Applications\WsFederationApplicationSettings { diff --git a/src/Applications/WsFederationApplicationSettingsApplication.php b/src/Applications/WsFederationApplicationSettingsApplication.php index 905c304a20..9032fe0390 100644 --- a/src/Applications/WsFederationApplicationSettingsApplication.php +++ b/src/Applications/WsFederationApplicationSettingsApplication.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class WsFederationApplicationSettingsApplication extends \Okta\Generated\Applications\WsFederationApplicationSettingsApplication { diff --git a/src/DataStore/DefaultDataStore.php b/src/DataStore/DefaultDataStore.php index 4bfc38922c..2a442cd1d6 100644 --- a/src/DataStore/DefaultDataStore.php +++ b/src/DataStore/DefaultDataStore.php @@ -208,6 +208,26 @@ public function createResource($href, $resource, $returnType) return new $returnType(null, $result); } + /** + * Issues a save request to the API. + * + * @param string $href The path to the resource + * @param AbstractResource $resource The resource to save. + * @param string $returnType The Resource class you want to return. + * + * @return mixed + */ + public function post(UriInterface $uri, $body, $returnType = null) + { + $result = $this->executeRequest('POST', $uri, json_encode($this->toStdClass($body))); + + if(null === $returnType) { + return $result; + } + + return new $returnType(null, $result); + } + /** * Issues a delete request to the API. * diff --git a/src/Generated/Applications/AppUser.php b/src/Generated/Applications/AppUser.php index 9745093494..c6864113fc 100644 --- a/src/Generated/Applications/AppUser.php +++ b/src/Generated/Applications/AppUser.php @@ -44,6 +44,21 @@ public function getId(): string { return $this->getProperty(self::ID); } + /** + * Set the id. + * + * @param mixed $id The value to set. + * @return self + */ + public function setId($id) + { + $this->setProperty( + self::ID, + $id + ); + + return $this; + } /** * Get the scope. * diff --git a/src/Generated/Applications/Application.php b/src/Generated/Applications/Application.php index 87ef9b9030..fe127217cf 100644 --- a/src/Generated/Applications/Application.php +++ b/src/Generated/Applications/Application.php @@ -84,21 +84,6 @@ public function getName(): string { return $this->getProperty(self::NAME); } - /** - * Set the name. - * - * @param mixed $name The value to set. - * @return self - */ - public function setName($name) - { - $this->setProperty( - self::NAME, - $name - ); - - return $this; - } /** * Get the label. * @@ -141,44 +126,14 @@ public function getStatus(): string { return $this->getProperty(self::STATUS); } - /** - * Set the status. - * - * @param mixed $status The value to set. - * @return self - */ - public function setStatus($status) - { - $this->setProperty( - self::STATUS, - $status - ); - - return $this; - } /** * Get the created. * - * @return string + * @return \Carbon\Carbon|null */ - public function getCreated(): string - { - return $this->getProperty(self::CREATED); - } - /** - * Set the created. - * - * @param mixed $created The value to set. - * @return self - */ - public function setCreated($created) + public function getCreated() { - $this->setProperty( - self::CREATED, - $created - ); - - return $this; + return $this->getDateProperty(self::CREATED); } /** * Get the features. @@ -459,7 +414,7 @@ public function assignUserToApplication(AppUser $appUser) ); return $this ->getDataStore() - ->executeRequest('POST', $uri, $appUser); + ->post($uri, $appUser, \Okta\Applications\AppUser::class); } /** @@ -521,7 +476,7 @@ public function deleteApplicationUser($userId) * * @return mixed|null */ - public function updateGroupApplicationAssignment($groupId, ApplicationGroupAssignment $applicationGroupAssignment) + public function updateApplicationGroupAssignment($groupId, ApplicationGroupAssignment $applicationGroupAssignment) { $uri = "/api/v1/apps/{$this->getId()}/groups/{$groupId}"; $uri = $this->getDataStore()->buildUri( @@ -538,7 +493,7 @@ public function updateGroupApplicationAssignment($groupId, ApplicationGroupAssig * * @return mixed|null */ - public function getGroupApplicationAssignment($groupId) + public function getApplicationGroupAssignment($groupId) { $uri = "/api/v1/apps/{$this->getId()}/groups/{$groupId}"; $uri = $this->getDataStore()->buildUri( @@ -557,7 +512,7 @@ public function getGroupApplicationAssignment($groupId) * * @return mixed|null */ - public function deleteGroupApplicationAssignment($groupId) + public function deleteApplicationGroupAssignment($groupId) { $uri = "/api/v1/apps/{$this->getId()}/groups/{$groupId}"; $uri = $this->getDataStore()->buildUri( @@ -627,7 +582,7 @@ public function getApplicationKey($keyId) * @param array $options The options for the request. * @return \Okta\Applications\Collection */ - public function getGroupAssignments(array $options = []): \Okta\Applications\Collection + public function getApplicationGroupAssignments(array $options = []): \Okta\Applications\Collection { return $this @@ -641,19 +596,19 @@ public function getGroupAssignments(array $options = []): \Okta\Applications\Col } /** - * Get the JsonWebKeyRSAMediated object. + * Get the JsonWebKey object. * * @param array $options The options for the request. * @return \Okta\Applications\Collection */ - public function getKeys(array $options = []): \Okta\Applications\Collection + public function getApplicationKeys(array $options = []): \Okta\Applications\Collection { return $this ->getDataStore() ->getCollection( "/api/v1/apps/{$this->getId()}/credentials/keys", - \Okta\Applications\JsonWebKeyRSAMediated::class, + \Okta\Applications\JsonWebKey::class, \Okta\Applications\Collection::class, $options ); diff --git a/src/Generated/Applications/AutoLoginApplicationSettings.php b/src/Generated/Applications/AutoLoginApplicationSettings.php index 9edd947581..9d15f26baf 100644 --- a/src/Generated/Applications/AutoLoginApplicationSettings.php +++ b/src/Generated/Applications/AutoLoginApplicationSettings.php @@ -18,7 +18,7 @@ namespace Okta\Generated\Applications; -class AutoLoginApplicationSettings extends \Okta\Resource\AbstractResource +class AutoLoginApplicationSettings extends \Okta\Applications\ApplicationSettings { const SIGN_ON = 'signOn'; diff --git a/src/Generated/Applications/JsonWebKeyRSAMediated.php b/src/Generated/Applications/JsonWebKey.php similarity index 98% rename from src/Generated/Applications/JsonWebKeyRSAMediated.php rename to src/Generated/Applications/JsonWebKey.php index aab1af3261..12f04629cb 100644 --- a/src/Generated/Applications/JsonWebKeyRSAMediated.php +++ b/src/Generated/Applications/JsonWebKey.php @@ -18,7 +18,7 @@ namespace Okta\Generated\Applications; -class JsonWebKeyRSAMediated extends \Okta\Resource\AbstractResource +class JsonWebKey extends \Okta\Resource\AbstractResource { const E = 'e'; const N = 'n'; diff --git a/src/Generated/Applications/OpenIdConnectApplicationSettings.php b/src/Generated/Applications/OpenIdConnectApplicationSettings.php index 146f9faaf0..46db0140b2 100644 --- a/src/Generated/Applications/OpenIdConnectApplicationSettings.php +++ b/src/Generated/Applications/OpenIdConnectApplicationSettings.php @@ -18,7 +18,7 @@ namespace Okta\Generated\Applications; -class OpenIdConnectApplicationSettings extends \Okta\Resource\AbstractResource +class OpenIdConnectApplicationSettings extends \Okta\Applications\ApplicationSettings { const OAUTH_CLIENT = 'oauthClient'; diff --git a/src/Generated/Applications/PublicSignOnModeMediated.php b/src/Generated/Applications/PublicSignOnModeMediated.php deleted file mode 100644 index 06ec929811..0000000000 --- a/src/Generated/Applications/PublicSignOnModeMediated.php +++ /dev/null @@ -1,24 +0,0 @@ -getProperty(self::NAME); + } + /** + * Set the name. + * + * @param mixed $name The value to set. + * @return self + */ + public function setName($name) + { + $this->setProperty( + self::NAME, + $name + ); + + return $this; + } + /** + * Get the namespace. + * + * @return string + */ + public function getNamespace(): string + { + return $this->getProperty(self::NAMESPACE); + } + /** + * Set the namespace. + * + * @param mixed $namespace The value to set. + * @return self + */ + public function setNamespace($namespace) + { + $this->setProperty( + self::NAMESPACE, + $namespace + ); + + return $this; + } +} diff --git a/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php b/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php index b66d5c5477..e1223cdfbd 100644 --- a/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php +++ b/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php @@ -18,7 +18,7 @@ namespace Okta\Generated\Applications; -class SecurePasswordStoreApplicationSettings extends \Okta\Resource\AbstractResource +class SecurePasswordStoreApplicationSettings extends \Okta\Applications\ApplicationSettings { const APP = 'app'; diff --git a/src/Generated/Applications/WsFederationApplicationSettings.php b/src/Generated/Applications/WsFederationApplicationSettings.php index 833ef78b3a..492665803a 100644 --- a/src/Generated/Applications/WsFederationApplicationSettings.php +++ b/src/Generated/Applications/WsFederationApplicationSettings.php @@ -18,7 +18,7 @@ namespace Okta\Generated\Applications; -class WsFederationApplicationSettings extends \Okta\Resource\AbstractResource +class WsFederationApplicationSettings extends \Okta\Applications\ApplicationSettings { const APP = 'app'; diff --git a/tests/Unit/Applications/ApplicationTest.php b/tests/Unit/Applications/ApplicationTest.php index 44d3075bbf..b7c029c081 100644 --- a/tests/Unit/Applications/ApplicationTest.php +++ b/tests/Unit/Applications/ApplicationTest.php @@ -28,10 +28,7 @@ class ApplicationTest extends BaseUnitTestCase protected $model = '/Applications/customSwa.json'; protected $modelType = Application::class; - /** - * @test - * @covers Application::get() - */ + /** @test */ public function getting_an_application_will_make_request_to_correct_endpoint() { $client = $this->createNewHttpClient(); @@ -44,10 +41,7 @@ public function getting_an_application_will_make_request_to_correct_endpoint() $this->assertEquals('GET', $requests[0]->getMethod()); } - /** - * @test - * @covers Application::get() - */ + /** @test */ public function getting_an_application_will_return_application_object() { $client = $this->createNewHttpClient(); @@ -57,10 +51,7 @@ public function getting_an_application_will_return_application_object() $this->assertInstanceOf(Application::class, $app); } - /** - * @test - * @covers Application::save() - */ + /** @test */ public function saving_an_application_makes_requests_to_correct_endpoint() { $client = $this->createNewHttpClient(); @@ -72,10 +63,7 @@ public function saving_an_application_makes_requests_to_correct_endpoint() $this->assertEquals('POST', $requests[0]->getMethod()); } - /** - * @test - * @covers Application::save() - */ + /** @test */ public function saving_an_application_will_return_correct_type() { $client = $this->createNewHttpClient(); @@ -85,10 +73,7 @@ public function saving_an_application_will_return_correct_type() $this->assertInstanceOf(Application::class, $app); } - /** - * @test - * @covers Application::delete() - */ + /** @test */ public function deleting_an_application_makes_requests_to_correct_endpoint() { $client = $this->createNewHttpClient(); @@ -144,16 +129,6 @@ public function status_is_accessible() $this->assertEquals($this->properties->status, $this->testable->getStatus()); $this->assertEquals($this->properties->status, $this->testable->status); } - - /** @test */ - public function status_is_settable() - { - $this->testable->setStatus('ACTIVE'); - $this->assertEquals('ACTIVE', $this->testable->getStatus()); - - $this->testable->status = 'INACTIVE'; - $this->assertEquals('INACTIVE', $this->testable->getStatus()); - } /** @test */ public function created_is_accessible() @@ -385,8 +360,8 @@ public function get_application_users_makes_request_to_correct_endpoint() 'getBody' => '[{"id": "00uaz81i7cHX3cSsg0h7"}]' ]); - $app = $this->createModel($this->model, Application::class); - $app->getApplicationUsers(); + $app = $this->createModel($this->model, $this->modelType); + $appUsers = $app->getApplicationUsers(); $request = $httpClient->getRequests(); @@ -395,6 +370,40 @@ public function get_application_users_makes_request_to_correct_endpoint() "/api/v1/apps/{$this->testable->getId()}/users", $request[0]->getUri()->getPath() ); + + $this->assertInstanceOf(\Okta\Applications\Collection::class, $appUsers); + $this->assertInstanceOf(\Okta\Applications\AppUser::class, $appUsers->first()); + } + + /** @test */ + public function assign_user_to_application_makes_request_to_correct_endpoint() + { + + $httpClient = $this->createNewHttpClient([ + "getBody" => '{"id":"abc123"}' + ]); + + $app = $this->createModel($this->model, $this->modelType); + + $appUser = json_decode('{ + "id": "abc123", + "scope": "USER", + "credentials": { + "userName": "user@example.com" + } + } '); + + $appUser = $app->assignUserToApplication(new \Okta\Applications\AppUser(null, $appUser)); + + $request = $httpClient->getRequests(); + + $this->assertEquals('POST', $request[0]->getMethod()); + $this->assertEquals( + "/api/v1/apps/{$this->testable->getId()}/users", + $request[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\AppUser::class, $appUser); } diff --git a/tests/Unit/Users/UserTest.php b/tests/Unit/Users/UserTest.php index 7251e86144..08006d7b64 100644 --- a/tests/Unit/Users/UserTest.php +++ b/tests/Unit/Users/UserTest.php @@ -408,7 +408,7 @@ public function activate_makes_request_to_correct_location() $user = $this->createNewUser(); $user->activate(); - $user->activate(false); + $userResponse = $user->activate(false); $request = $httpClient->getRequests(); From dc29eed7f4dc77508ad39d5ba072fa42ee1c8537 Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Wed, 29 Nov 2017 17:16:36 -0500 Subject: [PATCH 14/22] Almost finished --- openapi/generator/index.js | 165 ++++++-- openapi/generator/templates/model.php.hbs | 72 +--- .../AppUserPasswordCredential.php | 24 ++ src/Applications/Application.php | 2 +- src/Applications/JsonWebKey.php | 23 ++ src/Applications/SamlAttributeStatement.php | 23 ++ src/DataStore/DefaultDataStore.php | 20 - src/Generated/Applications/AppUser.php | 188 ++------- .../Applications/AppUserCredentials.php | 11 +- .../AppUserPasswordCredential.php | 50 +++ src/Generated/Applications/Application.php | 127 +++--- .../Applications/ApplicationAccessibility.php | 1 + .../Applications/ApplicationCredentials.php | 5 +- .../ApplicationCredentialsOAuthClient.php | 1 + .../ApplicationCredentialsSigning.php | 43 +- ...ApplicationCredentialsUsernameTemplate.php | 1 + .../ApplicationGroupAssignment.php | 31 +- .../Applications/ApplicationLicensing.php | 1 + .../Applications/ApplicationSettings.php | 13 +- .../ApplicationSettingsApplication.php | 1 + .../ApplicationSettingsNotifications.php | 3 +- .../ApplicationSettingsNotificationsVpn.php | 3 +- ...icationSettingsNotificationsVpnNetwork.php | 1 + .../Applications/ApplicationVisibility.php | 3 +- .../ApplicationVisibilityHide.php | 1 + .../Applications/AutoLoginApplication.php | 17 +- .../AutoLoginApplicationSettings.php | 3 +- .../AutoLoginApplicationSettingsSignOn.php | 1 + .../Applications/BasicApplicationSettings.php | 11 +- .../BasicApplicationSettingsApplication.php | 3 +- .../Applications/BasicAuthApplication.php | 19 +- .../Applications/BookmarkApplication.php | 5 +- .../BookmarkApplicationSettings.php | 3 +- ...BookmarkApplicationSettingsApplication.php | 1 + .../Applications/BrowserPluginApplication.php | 9 +- src/Generated/Applications/JsonWebKey.php | 19 +- .../OAuthApplicationCredentials.php | 5 +- .../Applications/OpenIdConnectApplication.php | 19 +- .../OpenIdConnectApplicationSettings.php | 3 +- ...OpenIdConnectApplicationSettingsClient.php | 1 + .../Applications/SamlApplication.php | 9 +- .../Applications/SamlApplicationSettings.php | 3 +- .../SamlApplicationSettingsSignOn.php | 1 + .../Applications/SamlAttributeStatement.php | 55 ++- .../SchemeApplicationCredentials.php | 7 +- .../SecurePasswordStoreApplication.php | 19 +- ...SecurePasswordStoreApplicationSettings.php | 9 +- ...ordStoreApplicationSettingsApplication.php | 3 +- src/Generated/Applications/SwaApplication.php | 13 +- .../Applications/SwaApplicationSettings.php | 11 +- .../SwaApplicationSettingsApplication.php | 28 +- .../Applications/SwaThreeFieldApplication.php | 13 +- .../SwaThreeFieldApplicationSettings.php | 11 +- ...reeFieldApplicationSettingsApplication.php | 46 ++- .../Applications/WsFederationApplication.php | 11 +- .../WsFederationApplicationSettings.php | 9 +- ...derationApplicationSettingsApplication.php | 7 +- src/Generated/GroupRules/GroupRule.php | 15 +- src/Generated/GroupRules/GroupRuleAction.php | 3 +- .../GroupRules/GroupRuleConditions.php | 5 +- .../GroupRules/GroupRuleExpression.php | 1 + .../GroupRules/GroupRuleGroupAssignment.php | 1 + .../GroupRules/GroupRuleGroupCondition.php | 1 + .../GroupRules/GroupRulePeopleCondition.php | 5 +- .../GroupRules/GroupRuleUserCondition.php | 1 + src/Generated/Groups/Group.php | 8 +- src/Generated/Groups/GroupProfile.php | 1 + src/Generated/UserFactors/CallFactor.php | 1 + .../UserFactors/CallFactorProfile.php | 1 + src/Generated/UserFactors/EmailFactor.php | 1 + .../UserFactors/EmailFactorProfile.php | 1 + src/Generated/UserFactors/Factor.php | 14 +- src/Generated/UserFactors/FactorProfile.php | 1 + src/Generated/UserFactors/HardwareFactor.php | 1 + .../UserFactors/HardwareFactorProfile.php | 1 + src/Generated/UserFactors/PushFactor.php | 1 + .../UserFactors/PushFactorProfile.php | 1 + .../UserFactors/SecurityQuestion.php | 1 + .../UserFactors/SecurityQuestionFactor.php | 1 + .../SecurityQuestionFactorProfile.php | 1 + src/Generated/UserFactors/SmsFactor.php | 1 + .../UserFactors/SmsFactorProfile.php | 1 + src/Generated/UserFactors/TokenFactor.php | 1 + .../UserFactors/TokenFactorProfile.php | 1 + src/Generated/UserFactors/TotpFactor.php | 1 + .../UserFactors/TotpFactorProfile.php | 1 + .../UserFactors/VerifyFactorRequest.php | 1 + .../UserFactors/VerifyFactorResponse.php | 1 + src/Generated/UserFactors/WebFactor.php | 1 + .../UserFactors/WebFactorProfile.php | 1 + src/Generated/Users/AppLink.php | 1 + .../Users/AuthenticationProvider.php | 1 + src/Generated/Users/ChangePasswordRequest.php | 5 +- .../Users/ForgotPasswordResponse.php | 1 + src/Generated/Users/PasswordCredential.php | 1 + .../Users/RecoveryQuestionCredential.php | 1 + src/Generated/Users/ResetPasswordToken.php | 1 + src/Generated/Users/Role.php | 1 + src/Generated/Users/TempPassword.php | 1 + src/Generated/Users/User.php | 101 +++-- src/Generated/Users/UserActivationToken.php | 1 + src/Generated/Users/UserCredentials.php | 7 +- src/Generated/Users/UserProfile.php | 1 + tests/BaseUnitTestCase.php | 1 - .../Applications/AppUserCredentialsTest.php | 69 ++++ .../AppUserPasswordCredentialTest.php | 48 +++ tests/Unit/Applications/AppUserTest.php | 176 ++++++++ .../ApplicationAccessibilityTest.php | 89 ++++ .../ApplicationCredentialsOAuthClientTest.php | 105 +++++ .../ApplicationCredentialsSigningTest.php | 89 ++++ .../ApplicationCredentialsTest.php | 93 +++++ ...icationCredentialsUsernameTemplateTest.php | 89 ++++ .../ApplicationGroupAssignmentTest.php | 104 +++++ .../Applications/ApplicationLicensingTest.php | 48 +++ .../ApplicationSettingsNotificationsTest.php | 52 +++ ...ionSettingsNotificationsVpnNetworkTest.php | 86 ++++ ...pplicationSettingsNotificationsVpnTest.php | 90 ++++ .../Applications/ApplicationSettingsTest.php | 78 ++++ tests/Unit/Applications/ApplicationTest.php | 183 +++++++++ .../ApplicationVisibilityHideTest.php | 63 +++ .../ApplicationVisibilityTest.php | 89 ++++ ...AutoLoginApplicationSettingsSignOnTest.php | 69 ++++ .../AutoLoginApplicationSettingsTest.php | 58 +++ .../Applications/AutoLoginApplicationTest.php | 73 ++++ ...asicApplicationSettingsApplicationTest.php | 68 +++ .../BasicApplicationSettingsTest.php | 54 +++ .../Applications/BasicAuthApplicationTest.php | 72 ++++ ...markApplicationSettingsApplicationTest.php | 69 ++++ .../BookmarkApplicationSettingsTest.php | 60 +++ .../Applications/BookmarkApplicationTest.php | 52 +++ .../BrowserPluginApplicationTest.php | 51 +++ tests/Unit/Applications/JsonWebKeyTest.php | 137 +++++++ .../OAuthApplicationCredentialsTest.php | 61 +++ .../OpenIdConnectApplicationSettingsTest.php | 73 ++++ .../OpenIdConnectApplicationTest.php | 73 ++++ .../SamlApplicationSettingsSignOnTest.php | 387 ++++++++++++++++++ .../SamlAttributeStatementTest.php | 106 +++++ .../SchemeApplicationCredentialsTest.php | 115 ++++++ ...toreApplicationSettingsApplicationTest.php | 196 +++++++++ ...rePasswordStoreApplicationSettingsTest.php | 54 +++ .../SecurePasswordStoreApplicationTest.php | 75 ++++ .../SwaApplicationSettingsApplicationTest.php | 122 ++++++ .../SwaApplicationSettingsTest.php | 60 +++ .../Unit/Applications/SwaApplicationTest.php | 52 +++ ...ieldApplicationSettingsApplicationTest.php | 161 ++++++++ .../SwaThreeFieldApplicationSettingsTest.php | 62 +++ .../SwaThreeFieldApplicationTest.php | 52 +++ ...tionApplicationSettingsApplicationTest.php | 248 +++++++++++ .../WsFederationApplicationSettingsTest.php | 67 +++ .../WsFederationApplicationTest.php | 52 +++ tests/Unit/Users/UserTest.php | 4 +- .../models/Applications/applicationUser.json | 39 ++ .../Applications/applicationVisibility.json | 10 + .../models/Applications/groupAssignment.json | 19 + tests/models/Applications/jsonWebKey.json | 19 + .../samlApplicationSettingsSignOn.json | 32 ++ 156 files changed, 5283 insertions(+), 558 deletions(-) create mode 100644 src/Applications/AppUserPasswordCredential.php create mode 100644 src/Applications/JsonWebKey.php create mode 100644 src/Applications/SamlAttributeStatement.php create mode 100644 src/Generated/Applications/AppUserPasswordCredential.php create mode 100644 tests/Unit/Applications/AppUserCredentialsTest.php create mode 100644 tests/Unit/Applications/AppUserPasswordCredentialTest.php create mode 100644 tests/Unit/Applications/AppUserTest.php create mode 100644 tests/Unit/Applications/ApplicationAccessibilityTest.php create mode 100644 tests/Unit/Applications/ApplicationCredentialsOAuthClientTest.php create mode 100644 tests/Unit/Applications/ApplicationCredentialsSigningTest.php create mode 100644 tests/Unit/Applications/ApplicationCredentialsTest.php create mode 100644 tests/Unit/Applications/ApplicationCredentialsUsernameTemplateTest.php create mode 100644 tests/Unit/Applications/ApplicationGroupAssignmentTest.php create mode 100644 tests/Unit/Applications/ApplicationLicensingTest.php create mode 100644 tests/Unit/Applications/ApplicationSettingsNotificationsTest.php create mode 100644 tests/Unit/Applications/ApplicationSettingsNotificationsVpnNetworkTest.php create mode 100644 tests/Unit/Applications/ApplicationSettingsNotificationsVpnTest.php create mode 100644 tests/Unit/Applications/ApplicationSettingsTest.php create mode 100644 tests/Unit/Applications/ApplicationVisibilityHideTest.php create mode 100644 tests/Unit/Applications/ApplicationVisibilityTest.php create mode 100644 tests/Unit/Applications/AutoLoginApplicationSettingsSignOnTest.php create mode 100644 tests/Unit/Applications/AutoLoginApplicationSettingsTest.php create mode 100644 tests/Unit/Applications/AutoLoginApplicationTest.php create mode 100644 tests/Unit/Applications/BasicApplicationSettingsApplicationTest.php create mode 100644 tests/Unit/Applications/BasicApplicationSettingsTest.php create mode 100644 tests/Unit/Applications/BasicAuthApplicationTest.php create mode 100644 tests/Unit/Applications/BookmarkApplicationSettingsApplicationTest.php create mode 100644 tests/Unit/Applications/BookmarkApplicationSettingsTest.php create mode 100644 tests/Unit/Applications/BookmarkApplicationTest.php create mode 100644 tests/Unit/Applications/BrowserPluginApplicationTest.php create mode 100644 tests/Unit/Applications/JsonWebKeyTest.php create mode 100644 tests/Unit/Applications/OAuthApplicationCredentialsTest.php create mode 100644 tests/Unit/Applications/OpenIdConnectApplicationSettingsTest.php create mode 100644 tests/Unit/Applications/OpenIdConnectApplicationTest.php create mode 100644 tests/Unit/Applications/SamlApplicationSettingsSignOnTest.php create mode 100644 tests/Unit/Applications/SamlAttributeStatementTest.php create mode 100644 tests/Unit/Applications/SchemeApplicationCredentialsTest.php create mode 100644 tests/Unit/Applications/SecurePasswordStoreApplicationSettingsApplicationTest.php create mode 100644 tests/Unit/Applications/SecurePasswordStoreApplicationSettingsTest.php create mode 100644 tests/Unit/Applications/SecurePasswordStoreApplicationTest.php create mode 100644 tests/Unit/Applications/SwaApplicationSettingsApplicationTest.php create mode 100644 tests/Unit/Applications/SwaApplicationSettingsTest.php create mode 100644 tests/Unit/Applications/SwaApplicationTest.php create mode 100644 tests/Unit/Applications/SwaThreeFieldApplicationSettingsApplicationTest.php create mode 100644 tests/Unit/Applications/SwaThreeFieldApplicationSettingsTest.php create mode 100644 tests/Unit/Applications/SwaThreeFieldApplicationTest.php create mode 100644 tests/Unit/Applications/WsFederationApplicationSettingsApplicationTest.php create mode 100644 tests/Unit/Applications/WsFederationApplicationSettingsTest.php create mode 100644 tests/Unit/Applications/WsFederationApplicationTest.php create mode 100644 tests/models/Applications/applicationUser.json create mode 100644 tests/models/Applications/applicationVisibility.json create mode 100644 tests/models/Applications/groupAssignment.json create mode 100644 tests/models/Applications/jsonWebKey.json create mode 100644 tests/models/Applications/samlApplicationSettingsSignOn.json diff --git a/openapi/generator/index.js b/openapi/generator/index.js index 803c1fe2bc..5f04241758 100644 --- a/openapi/generator/index.js +++ b/openapi/generator/index.js @@ -20,6 +20,41 @@ function getType(obj, model) { case 'WebFactorProfile': case 'FactorProfile': return '\\Okta\\UserFactors\\FactorProfile'; + case 'AutoLoginApplicationSettings': + case 'BasicAuthApplicationSettings': + case 'BasicApplicationSettings': + case 'BookmarApplicationSettings': + case 'BrowserPluginApplicationSettings': + case 'OpenIdConnectApplicationSettings': + case 'SamlApplicationSettings': + case 'SecurePasswordStoreApplicationSettings': + case 'SwaApplicationSettings': + case 'SwaThreeFieldApplicationSettings': + case 'WsFederationApplicationSettings': + return '\\Okta\\Applications\\ApplicationSettings'; + case 'AutoLoginApplicationSettingsApplication': + case 'BasicAuthApplicationSettingsApplication': + case 'BasicApplicationSettingsApplication': + case 'BookmarApplicationSettingsApplication': + case 'BrowserPluginApplicationSettingsApplication': + case 'OpenIdConnectApplicationSettingsApplication': + case 'SamlApplicationSettingsApplication': + case 'SecurePasswordStoreApplicationSettingsApplication': + case 'SwaApplicationSettingsApplication': + case 'SwaThreeFieldApplicationSettingsApplication': + case 'WsFederationApplicationSettingsApplication': + return '\\Okta\\Applications\\ApplicationSettingsApplication'; + case 'AutoLoginApplicationCredentials': + case 'BasicAuthApplicationCredentials': + case 'BookmarApplicationCredentials': + case 'BrowserPluginApplicationCredentials': + case 'OAuthApplicationCredentials': + case 'OpenIdConnectApplicationCredentials': + case 'SamlApplicationCredentials': + case 'SchemeApplicationCredentials': + case 'SecurePasswordStoreApplicationCredentials': + case 'WsFederationApplicationCredentials': + return '\\Okta\\Applications\\ApplicationCredentials'; default: return `\\${model}\\${obj.model}`; } @@ -53,6 +88,41 @@ function getSafeType(obj, model) { case 'WebFactorProfile': case 'FactorProfile': return ': \\Okta\\UserFactors\\FactorProfile'; + case 'AutoLoginApplicationSettings': + case 'BasicAuthApplicationSettings': + case 'BasicApplicationSettings': + case 'BookmarApplicationSettings': + case 'BrowserPluginApplicationSettings': + case 'OpenIdConnectApplicationSettings': + case 'SamlApplicationSettings': + case 'SecurePasswordStoreApplicationSettings': + case 'SwaApplicationSettings': + case 'SwaThreeFieldApplicationSettings': + case 'WsFederationApplicationSettings': + return ': \\Okta\\Applications\\ApplicationSettings'; + case 'AutoLoginApplicationCredentials': + case 'BasicAuthApplicationCredentials': + case 'BookmarApplicationCredentials': + case 'BrowserPluginApplicationCredentials': + case 'OAuthApplicationCredentials': + case 'OpenIdConnectApplicationCredentials': + case 'SamlApplicationCredentials': + case 'SchemeApplicationCredentials': + case 'SecurePasswordStoreApplicationCredentials': + case 'WsFederationApplicationCredentials': + return ': \\Okta\\Applications\\ApplicationCredentials'; + case 'AutoLoginApplicationSettingsApplication': + case 'BasicAuthApplicationSettingsApplication': + case 'BasicApplicationSettingsApplication': + case 'BookmarApplicationSettingsApplication': + case 'BrowserPluginApplicationSettingsApplication': + case 'OpenIdConnectApplicationSettingsApplication': + case 'SamlApplicationSettingsApplication': + case 'SecurePasswordStoreApplicationSettingsApplication': + case 'SwaApplicationSettingsApplication': + case 'SwaThreeFieldApplicationSettingsApplication': + case 'WsFederationApplicationSettingsApplication': + return ': \\Okta\\Applications\\ApplicationSettingsApplication'; default: return `: \\${model}\\${obj.model}`; } @@ -72,8 +142,8 @@ function getSafeType(obj, model) { } } -function getTypeHint(model) { - switch(model) { +function getTypeHint(obj) { + switch(obj.model) { case 'CallFactorProfile': case 'EmailFactorProfile': case 'HardwareFactorProfile': @@ -85,8 +155,43 @@ function getTypeHint(model) { case 'WebFactorProfile': case 'FactorProfile': return '\\Okta\\UserFactors\\FactorProfile'; + case 'AutoLoginApplicationSettings': + case 'BasicAuthApplicationSettings': + case 'BasicApplicationSettings': + case 'BookmarApplicationSettings': + case 'BrowserPluginApplicationSettings': + case 'OpenIdConnectApplicationSettings': + case 'SamlApplicationSettings': + case 'SecurePasswordStoreApplicationSettings': + case 'SwaApplicationSettings': + case 'SwaThreeFieldApplicationSettings': + case 'WsFederationApplicationSettings': + return '\\Okta\\Applications\\ApplicationSettings'; + case 'AutoLoginApplicationCredentials': + case 'BasicAuthApplicationCredentials': + case 'BookmarApplicationCredentials': + case 'BrowserPluginApplicationCredentials': + case 'OAuthApplicationCredentials': + case 'OpenIdConnectApplicationCredentials': + case 'SamlApplicationCredentials': + case 'SchemeApplicationCredentials': + case 'SecurePasswordStoreApplicationCredentials': + case 'WsFederationApplicationCredentials': + return '\\Okta\\Applications\\ApplicationCredentials'; + case 'AutoLoginApplicationSettingsApplication': + case 'BasicAuthApplicationSettingsApplication': + case 'BasicApplicationSettingsApplication': + case 'BookmarApplicationSettingsApplication': + case 'BrowserPluginApplicationSettingsApplication': + case 'OpenIdConnectApplicationSettingsApplication': + case 'SamlApplicationSettingsApplication': + case 'SecurePasswordStoreApplicationSettingsApplication': + case 'SwaApplicationSettingsApplication': + case 'SwaThreeFieldApplicationSettingsApplication': + case 'WsFederationApplicationSettingsApplication': + return '\\Okta\\Applications\\ApplicationSettingsApplication'; default: - return model; + return `\\${obj.baseClass}\\${obj.model}`; } } @@ -113,16 +218,42 @@ function getExtends(modelName) { return '\\Okta\\Applications\\Application'; case 'AutoLoginApplicationSettings': case 'BasicAuthApplicationSettings': + case 'BasicApplicationSettings': case 'BookmarApplicationSettings': case 'BrowserPluginApplicationSettings': case 'OpenIdConnectApplicationSettings': case 'SamlApplicationSettings': case 'SecurePasswordStoreApplicationSettings': + case 'SwaApplicationSettings': + case 'SwaThreeFieldApplicationSettings': case 'WsFederationApplicationSettings': return '\\Okta\\Applications\\ApplicationSettings'; + case 'AutoLoginApplicationCredentials': + case 'BasicAuthApplicationCredentials': + case 'BookmarApplicationCredentials': + case 'BrowserPluginApplicationCredentials': + case 'OAuthApplicationCredentials': + case 'OpenIdConnectApplicationCredentials': + case 'SamlApplicationCredentials': + case 'SchemeApplicationCredentials': + case 'SecurePasswordStoreApplicationCredentials': + case 'WsFederationApplicationCredentials': + return '\\Okta\\Applications\\ApplicationCredentials'; + case 'AutoLoginApplicationSettingsApplication': + case 'BasicAuthApplicationSettingsApplication': + case 'BasicApplicationSettingsApplication': + case 'BookmarApplicationSettingsApplication': + case 'BrowserPluginApplicationSettingsApplication': + case 'OpenIdConnectApplicationSettingsApplication': + case 'SamlApplicationSettingsApplication': + case 'SecurePasswordStoreApplicationSettingsApplication': + case 'SwaApplicationSettingsApplication': + case 'SwaThreeFieldApplicationSettingsApplication': + case 'WsFederationApplicationSettingsApplication': + return '\\Okta\\Applications\\ApplicationSettingsApplication'; case 'SwaApplication': case 'SwaThreeFieldApplication': - return '\\Okta\\Application\\BrowserPluginApplication'; + return '\\Okta\\Applications\\BrowserPluginApplication'; case 'CallFactorProfile': case 'EmailFactorProfile': case 'HardwareFactorProfile': @@ -138,21 +269,6 @@ function getExtends(modelName) { } } -function getInterfaces(modelName) { - switch (modelName) { - case 'CallFactorProfile': - case 'EmailFactorProfile': - case 'HardwareFactorProfile': - case 'PushFactorProfile': - case 'SecurityQuestionFactorProfile': - case 'SmsFactorProfile': - case 'TokenFactorProfile': - case 'TotpFactorProfile': - case 'WebFactorProfile': - return 'implements \\Okta\\Contracts\\FactorProfile'; - } -} - function getAccessMethodType(obj) { switch (obj.commonType) { case 'dateTime': @@ -368,16 +484,6 @@ function buildGetResourceParams(model) { } -function buildPostParams(model) { - - switch(model.operation.operationId) { - case 'getFactor': - return String.raw`"factors/{$factorId}", \Okta\UserFactors\Factor::class, "/users/{$this->id}", []`; - - } - -} - php.process = ({ spec, operations, models, handlebars }) => { const templates = []; @@ -469,7 +575,6 @@ php.process = ({ spec, operations, models, handlebars }) => { getMethodPath, getMethodParams, getExtends, - getInterfaces, getCollectionMethodParams, getMethodRequestParams, getMethodArrayName, diff --git a/openapi/generator/templates/model.php.hbs b/openapi/generator/templates/model.php.hbs index d890f00d72..f0a3d8d41c 100644 --- a/openapi/generator/templates/model.php.hbs +++ b/openapi/generator/templates/model.php.hbs @@ -27,6 +27,12 @@ class {{modelName}} extends {{getExtends modelName}} const {{upperSnakeCase propertyName}} = '{{propertyName}}'; {{/each}} + {{#each properties}} + {{#if this.default}} + private ${{propertyName}} = '{{this.default}}'; + {{/if}} + {{/each}} + {{#each crudOperations}} {{#if (eq alias "read")}} {{#if (eq this.operation.operationId "getFactor")}} @@ -95,6 +101,7 @@ class {{modelName}} extends {{getExtends modelName}} {{/if}} {{/each}} {{#each properties}} + {{#unless this.default}} /** * Get the {{propertyName}}. * @@ -114,10 +121,10 @@ class {{modelName}} extends {{getExtends modelName}} /** * Set the {{propertyName}}. * - * @param {{getType this baseClass}} ${{propertyName}} The {{model}} instance. + * @param {{getTypeHint this}} ${{propertyName}} The {{model}} instance. * @return self */ - public function set{{pascalCase propertyName}}({{getTypeHint model}} ${{propertyName}}) + public function set{{pascalCase propertyName}}({{getTypeHint this}} ${{propertyName}}) { $this->setResourceProperty( self::{{upperSnakeCase propertyName}}, @@ -150,6 +157,7 @@ class {{modelName}} extends {{getExtends modelName}} } {{/unless}} {{/if}} + {{/unless}} {{/each}} {{#each methods}} @@ -173,53 +181,7 @@ class {{modelName}} extends {{getExtends modelName}} ); } {{else}} - {{#if (eq this.operation.method "get")}} - /** - * {{this.operation.description}} - * - {{getMethodParamsComment this}} - * @return mixed|null - */ - public function {{camelCase alias}}({{{getMethodParams this}}}) - { - $uri = "{{{getMethodPath this}}}"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - $response = $this - ->getDataStore() - ->getResource({{{buildGetResourceParams this}}}); - {{#if (eq this.operation.responseModel "Factor")}} - return $response->convertFromGenericFactor(); - {{else}} - return $response; - {{/if}} - } - {{elseif (eq this.operation.method "post")}} - /** - * {{this.operation.description}} - * - {{getMethodParamsComment this}} - * @return mixed|null - */ - public function {{camelCase alias}}({{{getMethodParams this}}}) - { - $uri = "{{{getMethodPath this}}}"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - $response = $this - ->getDataStore() - ->post({{{buildPostParams this}}}); - - {{#if (eq this.operation.responseModel "Factor")}} - return $response->convertFromGenericFactor(); - {{else}} - return $response; - {{/if}} - } - {{else}} /** * {{this.operation.description}} * @@ -232,11 +194,21 @@ class {{modelName}} extends {{getExtends modelName}} $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest({{{getMethodRequestParams this}}}{{path}}); + + {{#if this.operation.responseModel}} + {{#if (eq this.operation.responseModel "Factor")}} + $response = new \Okta\\{{{pluralize this.operation.tags.[0] }}}\\{{this.operation.responseModel}}(null, $body); + return $response->convertFromGenericFactor(); + {{else}} + return new \Okta\\{{{pluralize this.operation.tags.[0] }}}\\{{this.operation.responseModel}}(null, $body); + {{/if}} + {{else}} + return $body; + {{/if}} } {{/if}} - {{/if}} {{/each}} } diff --git a/src/Applications/AppUserPasswordCredential.php b/src/Applications/AppUserPasswordCredential.php new file mode 100644 index 0000000000..af55e07a14 --- /dev/null +++ b/src/Applications/AppUserPasswordCredential.php @@ -0,0 +1,24 @@ +executeRequest('POST', $uri, json_encode($this->toStdClass($body))); - - if(null === $returnType) { - return $result; - } - - return new $returnType(null, $result); - } - /** * Issues a delete request to the API. * diff --git a/src/Generated/Applications/AppUser.php b/src/Generated/Applications/AppUser.php index c6864113fc..1626747955 100644 --- a/src/Generated/Applications/AppUser.php +++ b/src/Generated/Applications/AppUser.php @@ -35,6 +35,27 @@ class AppUser extends \Okta\Resource\AbstractResource const STATUS_CHANGED = 'statusChanged'; const PASSWORD_CHANGED = 'passwordChanged'; + + public function save() + { + return \Okta\Client::getInstance() + ->getDataStore() + ->saveResource( + "/apps", + $this, + \Okta\Applications\AppUser::class + ); + } + + public function delete() + { + return \Okta\Client::getInstance() + ->getDataStore() + ->deleteResource( + "/apps", + $this + ); + } /** * Get the id. * @@ -101,44 +122,14 @@ public function getStatus(): string { return $this->getProperty(self::STATUS); } - /** - * Set the status. - * - * @param mixed $status The value to set. - * @return self - */ - public function setStatus($status) - { - $this->setProperty( - self::STATUS, - $status - ); - - return $this; - } /** * Get the created. * - * @return string + * @return \Carbon\Carbon|null */ - public function getCreated(): string + public function getCreated() { - return $this->getProperty(self::CREATED); - } - /** - * Set the created. - * - * @param mixed $created The value to set. - * @return self - */ - public function setCreated($created) - { - $this->setProperty( - self::CREATED, - $created - ); - - return $this; + return $this->getDateProperty(self::CREATED); } /** * Get the profile. @@ -149,44 +140,14 @@ public function getProfile(): \stdClass { return $this->getProperty(self::PROFILE); } - /** - * Set the profile. - * - * @param mixed $profile The value to set. - * @return self - */ - public function setProfile($profile) - { - $this->setProperty( - self::PROFILE, - $profile - ); - - return $this; - } /** * Get the lastSync. * - * @return string + * @return \Carbon\Carbon|null */ - public function getLastSync(): string + public function getLastSync() { - return $this->getProperty(self::LAST_SYNC); - } - /** - * Set the lastSync. - * - * @param mixed $lastSync The value to set. - * @return self - */ - public function setLastSync($lastSync) - { - $this->setProperty( - self::LAST_SYNC, - $lastSync - ); - - return $this; + return $this->getDateProperty(self::LAST_SYNC); } /** * Get the _embedded. @@ -206,21 +167,6 @@ public function getSyncState(): string { return $this->getProperty(self::SYNC_STATE); } - /** - * Set the syncState. - * - * @param mixed $syncState The value to set. - * @return self - */ - public function setSyncState($syncState) - { - $this->setProperty( - self::SYNC_STATE, - $syncState - ); - - return $this; - } /** * Get the externalId. * @@ -230,21 +176,6 @@ public function getExternalId(): string { return $this->getProperty(self::EXTERNAL_ID); } - /** - * Set the externalId. - * - * @param mixed $externalId The value to set. - * @return self - */ - public function setExternalId($externalId) - { - $this->setProperty( - self::EXTERNAL_ID, - $externalId - ); - - return $this; - } /** * Get the credentials. * @@ -265,7 +196,7 @@ public function getCredentials(array $options = []): \Okta\Applications\AppUserC * @param \Okta\Applications\AppUserCredentials $credentials The AppUserCredentials instance. * @return self */ - public function setCredentials(AppUserCredentials $credentials) + public function setCredentials(\Okta\Applications\AppUserCredentials $credentials) { $this->setResourceProperty( self::CREDENTIALS, @@ -277,73 +208,28 @@ public function setCredentials(AppUserCredentials $credentials) /** * Get the lastUpdated. * - * @return string + * @return \Carbon\Carbon|null */ - public function getLastUpdated(): string - { - return $this->getProperty(self::LAST_UPDATED); - } - /** - * Set the lastUpdated. - * - * @param mixed $lastUpdated The value to set. - * @return self - */ - public function setLastUpdated($lastUpdated) + public function getLastUpdated() { - $this->setProperty( - self::LAST_UPDATED, - $lastUpdated - ); - - return $this; + return $this->getDateProperty(self::LAST_UPDATED); } /** * Get the statusChanged. * - * @return string + * @return \Carbon\Carbon|null */ - public function getStatusChanged(): string + public function getStatusChanged() { - return $this->getProperty(self::STATUS_CHANGED); - } - /** - * Set the statusChanged. - * - * @param mixed $statusChanged The value to set. - * @return self - */ - public function setStatusChanged($statusChanged) - { - $this->setProperty( - self::STATUS_CHANGED, - $statusChanged - ); - - return $this; + return $this->getDateProperty(self::STATUS_CHANGED); } /** * Get the passwordChanged. * - * @return string + * @return \Carbon\Carbon|null */ - public function getPasswordChanged(): string - { - return $this->getProperty(self::PASSWORD_CHANGED); - } - /** - * Set the passwordChanged. - * - * @param mixed $passwordChanged The value to set. - * @return self - */ - public function setPasswordChanged($passwordChanged) + public function getPasswordChanged() { - $this->setProperty( - self::PASSWORD_CHANGED, - $passwordChanged - ); - - return $this; + return $this->getDateProperty(self::PASSWORD_CHANGED); } } diff --git a/src/Generated/Applications/AppUserCredentials.php b/src/Generated/Applications/AppUserCredentials.php index a32ff763cb..1ac50e1d8e 100644 --- a/src/Generated/Applications/AppUserCredentials.php +++ b/src/Generated/Applications/AppUserCredentials.php @@ -23,16 +23,17 @@ class AppUserCredentials extends \Okta\Resource\AbstractResource const PASSWORD = 'password'; const USER_NAME = 'userName'; + /** * Get the password. * - * @return \Okta\Applications\PasswordCredential + * @return \Okta\Applications\AppUserPasswordCredential */ - public function getPassword(array $options = []): \Okta\Applications\PasswordCredential + public function getPassword(array $options = []): \Okta\Applications\AppUserPasswordCredential { return $this->getResourceProperty( self::PASSWORD, - \Okta\Applications\PasswordCredential::class, + \Okta\Applications\AppUserPasswordCredential::class, $options ); } @@ -40,10 +41,10 @@ public function getPassword(array $options = []): \Okta\Applications\PasswordCre /** * Set the password. * - * @param \Okta\Applications\PasswordCredential $password The PasswordCredential instance. + * @param \Okta\Applications\AppUserPasswordCredential $password The AppUserPasswordCredential instance. * @return self */ - public function setPassword(PasswordCredential $password) + public function setPassword(\Okta\Applications\AppUserPasswordCredential $password) { $this->setResourceProperty( self::PASSWORD, diff --git a/src/Generated/Applications/AppUserPasswordCredential.php b/src/Generated/Applications/AppUserPasswordCredential.php new file mode 100644 index 0000000000..2c51e2eb7c --- /dev/null +++ b/src/Generated/Applications/AppUserPasswordCredential.php @@ -0,0 +1,50 @@ +getProperty(self::VALUE); + } + /** + * Set the value. + * + * @param mixed $value The value to set. + * @return self + */ + public function setValue($value) + { + $this->setProperty( + self::VALUE, + $value + ); + + return $this; + } +} diff --git a/src/Generated/Applications/Application.php b/src/Generated/Applications/Application.php index fe127217cf..9ed0ab4eca 100644 --- a/src/Generated/Applications/Application.php +++ b/src/Generated/Applications/Application.php @@ -36,6 +36,7 @@ class Application extends \Okta\Resource\AbstractResource const LAST_UPDATED = 'lastUpdated'; const ACCESSIBILITY = 'accessibility'; + public function get($query) { return \Okta\Client::getInstance() @@ -179,7 +180,7 @@ public function getSettings(array $options = []): \Okta\Applications\Application * @param \Okta\Applications\ApplicationSettings $settings The ApplicationSettings instance. * @return self */ - public function setSettings(ApplicationSettings $settings) + public function setSettings(\Okta\Applications\ApplicationSettings $settings) { $this->setResourceProperty( self::SETTINGS, @@ -217,7 +218,7 @@ public function getLicensing(array $options = []): \Okta\Applications\Applicatio * @param \Okta\Applications\ApplicationLicensing $licensing The ApplicationLicensing instance. * @return self */ - public function setLicensing(ApplicationLicensing $licensing) + public function setLicensing(\Okta\Applications\ApplicationLicensing $licensing) { $this->setResourceProperty( self::LICENSING, @@ -270,7 +271,7 @@ public function getVisibility(array $options = []): \Okta\Applications\Applicati * @param \Okta\Applications\ApplicationVisibility $visibility The ApplicationVisibility instance. * @return self */ - public function setVisibility(ApplicationVisibility $visibility) + public function setVisibility(\Okta\Applications\ApplicationVisibility $visibility) { $this->setResourceProperty( self::VISIBILITY, @@ -299,7 +300,7 @@ public function getCredentials(array $options = []): \Okta\Applications\Applicat * @param \Okta\Applications\ApplicationCredentials $credentials The ApplicationCredentials instance. * @return self */ - public function setCredentials(ApplicationCredentials $credentials) + public function setCredentials(\Okta\Applications\ApplicationCredentials $credentials) { $this->setResourceProperty( self::CREDENTIALS, @@ -337,7 +338,7 @@ public function getAccessibility(array $options = []): \Okta\Applications\Applic * @param \Okta\Applications\ApplicationAccessibility $accessibility The ApplicationAccessibility instance. * @return self */ - public function setAccessibility(ApplicationAccessibility $accessibility) + public function setAccessibility(\Okta\Applications\ApplicationAccessibility $accessibility) { $this->setResourceProperty( self::ACCESSIBILITY, @@ -347,6 +348,7 @@ public function setAccessibility(ApplicationAccessibility $accessibility) return $this; } + /** * Activates an inactive application. * @@ -359,11 +361,14 @@ public function activate() $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri); + + return $body; } + /** * Deactivates an active application. * @@ -376,9 +381,11 @@ public function deactivate() $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri); + + return $body; } /** @@ -400,6 +407,7 @@ public function getApplicationUsers(array $options = []): \Okta\Applications\Col ); } + /** * Assigns an user to an application with [credentials](#application-user-credentials-object) and an app-specific [profile](#application-user-profile-object). Profile mappings defined for the application are first applied before applying any profile properties specified in the request. * @@ -412,11 +420,14 @@ public function assignUserToApplication(AppUser $appUser) $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() - ->post($uri, $appUser, \Okta\Applications\AppUser::class); + ->executeRequest('POST', $uri, $appUser); + + return new \Okta\Applications\AppUser(null, $body); } + /** * Fetches a specific user assignment for application by `id`. * @@ -424,69 +435,39 @@ public function assignUserToApplication(AppUser $appUser) * @return mixed|null */ public function getApplicationUser($userId) - { - $uri = "/api/v1/apps/{$this->getId()}/users/{$userId}"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - $response = $this - ->getDataStore() - ->getResource(); - - return $response; - } - - /** - * Updates a user's profile for an application - * - * - * @return mixed|null - */ - public function updateApplicationUser($userId, AppUser $appUser) { $uri = "/api/v1/apps/{$this->getId()}/users/{$userId}"; $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() - ->executeRequest('POST', $uri, $appUser); - } + ->executeRequest('GET', $uri); - /** - * Removes an assignment for a user from an application. - * - * - * @return mixed|null - */ - public function deleteApplicationUser($userId) - { - $uri = "/api/v1/apps/{$this->getId()}/users/{$userId}"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - return $this - ->getDataStore() - ->executeRequest('DELETE', $uri); + return new \Okta\Applications\AppUser(null, $body); } + /** * Assigns a group to an application * * * @return mixed|null */ - public function updateApplicationGroupAssignment($groupId, ApplicationGroupAssignment $applicationGroupAssignment) + public function createApplicationGroupAssignment($groupId, ApplicationGroupAssignment $applicationGroupAssignment) { $uri = "/api/v1/apps/{$this->getId()}/groups/{$groupId}"; $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('PUT', $uri, $applicationGroupAssignment); + + return new \Okta\Applications\ApplicationGroupAssignment(null, $body); } + /** * Fetches an application group assignment * @@ -494,35 +475,19 @@ public function updateApplicationGroupAssignment($groupId, ApplicationGroupAssig * @return mixed|null */ public function getApplicationGroupAssignment($groupId) - { - $uri = "/api/v1/apps/{$this->getId()}/groups/{$groupId}"; - $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri - ); - $response = $this - ->getDataStore() - ->getResource(); - - return $response; - } - - /** - * Removes a group assignment from an application. - * - * - * @return mixed|null - */ - public function deleteApplicationGroupAssignment($groupId) { $uri = "/api/v1/apps/{$this->getId()}/groups/{$groupId}"; $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() - ->executeRequest('DELETE', $uri); + ->executeRequest('GET', $uri); + + return new \Okta\Applications\ApplicationGroupAssignment(null, $body); } + /** * Generates a new X.509 certificate for an application key credential * @@ -535,11 +500,14 @@ public function generateApplicationKey() $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri); + + return new \Okta\Applications\JsonWebKey(null, $body); } + /** * Clones a X.509 certificate for an application key credential from a source application to target application. * @@ -552,11 +520,14 @@ public function cloneApplicationKey($keyId) $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri); + + return new \Okta\Applications\JsonWebKey(null, $body); } + /** * Gets a specific [application key credential](#application-key-credential-model) by `kid` * @@ -567,13 +538,13 @@ public function getApplicationKey($keyId) { $uri = "/api/v1/apps/{$this->getId()}/credentials/keys/{$keyId}"; $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri + $this->getDataStore()->getOrganizationUrl() . $uri ); - $response = $this - ->getDataStore() - ->getResource(); + $body = $this + ->getDataStore() + ->executeRequest('GET', $uri); - return $response; + return new \Okta\Applications\JsonWebKey(null, $body); } /** @@ -582,7 +553,7 @@ public function getApplicationKey($keyId) * @param array $options The options for the request. * @return \Okta\Applications\Collection */ - public function getApplicationGroupAssignments(array $options = []): \Okta\Applications\Collection + public function getGroupAssignments(array $options = []): \Okta\Applications\Collection { return $this @@ -601,7 +572,7 @@ public function getApplicationGroupAssignments(array $options = []): \Okta\Appli * @param array $options The options for the request. * @return \Okta\Applications\Collection */ - public function getApplicationKeys(array $options = []): \Okta\Applications\Collection + public function getKeys(array $options = []): \Okta\Applications\Collection { return $this diff --git a/src/Generated/Applications/ApplicationAccessibility.php b/src/Generated/Applications/ApplicationAccessibility.php index 6f069f67c1..27469cd3d2 100644 --- a/src/Generated/Applications/ApplicationAccessibility.php +++ b/src/Generated/Applications/ApplicationAccessibility.php @@ -24,6 +24,7 @@ class ApplicationAccessibility extends \Okta\Resource\AbstractResource const ERROR_REDIRECT_URL = 'errorRedirectUrl'; const LOGIN_REDIRECT_URL = 'loginRedirectUrl'; + /** * Get the selfService. * diff --git a/src/Generated/Applications/ApplicationCredentials.php b/src/Generated/Applications/ApplicationCredentials.php index 079a291954..7c3bd1d8f5 100644 --- a/src/Generated/Applications/ApplicationCredentials.php +++ b/src/Generated/Applications/ApplicationCredentials.php @@ -23,6 +23,7 @@ class ApplicationCredentials extends \Okta\Resource\AbstractResource const SIGNING = 'signing'; const USER_NAME_TEMPLATE = 'userNameTemplate'; + /** * Get the signing. * @@ -43,7 +44,7 @@ public function getSigning(array $options = []): \Okta\Applications\ApplicationC * @param \Okta\Applications\ApplicationCredentialsSigning $signing The ApplicationCredentialsSigning instance. * @return self */ - public function setSigning(ApplicationCredentialsSigning $signing) + public function setSigning(\Okta\Applications\ApplicationCredentialsSigning $signing) { $this->setResourceProperty( self::SIGNING, @@ -72,7 +73,7 @@ public function getUserNameTemplate(array $options = []): \Okta\Applications\App * @param \Okta\Applications\ApplicationCredentialsUsernameTemplate $userNameTemplate The ApplicationCredentialsUsernameTemplate instance. * @return self */ - public function setUserNameTemplate(ApplicationCredentialsUsernameTemplate $userNameTemplate) + public function setUserNameTemplate(\Okta\Applications\ApplicationCredentialsUsernameTemplate $userNameTemplate) { $this->setResourceProperty( self::USER_NAME_TEMPLATE, diff --git a/src/Generated/Applications/ApplicationCredentialsOAuthClient.php b/src/Generated/Applications/ApplicationCredentialsOAuthClient.php index 0a959c602e..03e50b7e50 100644 --- a/src/Generated/Applications/ApplicationCredentialsOAuthClient.php +++ b/src/Generated/Applications/ApplicationCredentialsOAuthClient.php @@ -25,6 +25,7 @@ class ApplicationCredentialsOAuthClient extends \Okta\Resource\AbstractResource const AUTO_KEY_ROTATION = 'autoKeyRotation'; const TOKEN_ENDPOINT_AUTH_METHOD = 'token_endpoint_auth_method'; + /** * Get the client_id. * diff --git a/src/Generated/Applications/ApplicationCredentialsSigning.php b/src/Generated/Applications/ApplicationCredentialsSigning.php index d43ea23bc4..a0fcf4587a 100644 --- a/src/Generated/Applications/ApplicationCredentialsSigning.php +++ b/src/Generated/Applications/ApplicationCredentialsSigning.php @@ -25,6 +25,7 @@ class ApplicationCredentialsSigning extends \Okta\Resource\AbstractResource const NEXT_ROTATION = 'nextRotation'; const ROTATION_MODE = 'rotationMode'; + /** * Get the kid. * @@ -52,50 +53,20 @@ public function setKid($kid) /** * Get the lastRotated. * - * @return string + * @return \Carbon\Carbon|null */ - public function getLastRotated(): string - { - return $this->getProperty(self::LAST_ROTATED); - } - /** - * Set the lastRotated. - * - * @param mixed $lastRotated The value to set. - * @return self - */ - public function setLastRotated($lastRotated) + public function getLastRotated() { - $this->setProperty( - self::LAST_ROTATED, - $lastRotated - ); - - return $this; + return $this->getDateProperty(self::LAST_ROTATED); } /** * Get the nextRotation. * - * @return string + * @return \Carbon\Carbon|null */ - public function getNextRotation(): string + public function getNextRotation() { - return $this->getProperty(self::NEXT_ROTATION); - } - /** - * Set the nextRotation. - * - * @param mixed $nextRotation The value to set. - * @return self - */ - public function setNextRotation($nextRotation) - { - $this->setProperty( - self::NEXT_ROTATION, - $nextRotation - ); - - return $this; + return $this->getDateProperty(self::NEXT_ROTATION); } /** * Get the rotationMode. diff --git a/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php b/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php index af1fd53a3b..1e439fed6e 100644 --- a/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php +++ b/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php @@ -24,6 +24,7 @@ class ApplicationCredentialsUsernameTemplate extends \Okta\Resource\AbstractReso const SUFFIX = 'suffix'; const TEMPLATE = 'template'; + /** * Get the type. * diff --git a/src/Generated/Applications/ApplicationGroupAssignment.php b/src/Generated/Applications/ApplicationGroupAssignment.php index 9a2a3dc229..a81708d2c7 100644 --- a/src/Generated/Applications/ApplicationGroupAssignment.php +++ b/src/Generated/Applications/ApplicationGroupAssignment.php @@ -27,6 +27,16 @@ class ApplicationGroupAssignment extends \Okta\Resource\AbstractResource const EMBEDDED = '_embedded'; const LAST_UPDATED = 'lastUpdated'; + + public function delete() + { + return \Okta\Client::getInstance() + ->getDataStore() + ->deleteResource( + "/apps", + $this + ); + } /** * Get the id. * @@ -105,25 +115,10 @@ public function getEmbedded(): \stdClass /** * Get the lastUpdated. * - * @return string + * @return \Carbon\Carbon|null */ - public function getLastUpdated(): string - { - return $this->getProperty(self::LAST_UPDATED); - } - /** - * Set the lastUpdated. - * - * @param mixed $lastUpdated The value to set. - * @return self - */ - public function setLastUpdated($lastUpdated) + public function getLastUpdated() { - $this->setProperty( - self::LAST_UPDATED, - $lastUpdated - ); - - return $this; + return $this->getDateProperty(self::LAST_UPDATED); } } diff --git a/src/Generated/Applications/ApplicationLicensing.php b/src/Generated/Applications/ApplicationLicensing.php index 6fca782ed0..b643e7db90 100644 --- a/src/Generated/Applications/ApplicationLicensing.php +++ b/src/Generated/Applications/ApplicationLicensing.php @@ -22,6 +22,7 @@ class ApplicationLicensing extends \Okta\Resource\AbstractResource { const SEAT_COUNT = 'seatCount'; + /** * Get the seatCount. * diff --git a/src/Generated/Applications/ApplicationSettings.php b/src/Generated/Applications/ApplicationSettings.php index 6e50f6a92e..1463a949c3 100644 --- a/src/Generated/Applications/ApplicationSettings.php +++ b/src/Generated/Applications/ApplicationSettings.php @@ -23,16 +23,17 @@ class ApplicationSettings extends \Okta\Resource\AbstractResource const APP = 'app'; const NOTIFICATIONS = 'notifications'; + /** * Get the app. * - * @return \Okta\Applications\object + * @return \Okta\Applications\ApplicationSettingsApplication */ - public function getApp(array $options = []): \Okta\Applications\object + public function getApp(array $options = []): \Okta\Applications\ApplicationSettingsApplication { return $this->getResourceProperty( self::APP, - \Okta\Applications\object::class, + \Okta\Applications\ApplicationSettingsApplication::class, $options ); } @@ -40,10 +41,10 @@ public function getApp(array $options = []): \Okta\Applications\object /** * Set the app. * - * @param \Okta\Applications\object $app The object instance. + * @param \Okta\Applications\ApplicationSettingsApplication $app The ApplicationSettingsApplication instance. * @return self */ - public function setApp(object $app) + public function setApp(\Okta\Applications\ApplicationSettingsApplication $app) { $this->setResourceProperty( self::APP, @@ -72,7 +73,7 @@ public function getNotifications(array $options = []): \Okta\Applications\Applic * @param \Okta\Applications\ApplicationSettingsNotifications $notifications The ApplicationSettingsNotifications instance. * @return self */ - public function setNotifications(ApplicationSettingsNotifications $notifications) + public function setNotifications(\Okta\Applications\ApplicationSettingsNotifications $notifications) { $this->setResourceProperty( self::NOTIFICATIONS, diff --git a/src/Generated/Applications/ApplicationSettingsApplication.php b/src/Generated/Applications/ApplicationSettingsApplication.php index a7820e281e..0f67ac958c 100644 --- a/src/Generated/Applications/ApplicationSettingsApplication.php +++ b/src/Generated/Applications/ApplicationSettingsApplication.php @@ -21,4 +21,5 @@ class ApplicationSettingsApplication extends \Okta\Resource\AbstractResource { + } diff --git a/src/Generated/Applications/ApplicationSettingsNotifications.php b/src/Generated/Applications/ApplicationSettingsNotifications.php index c87f131dfa..841647e26c 100644 --- a/src/Generated/Applications/ApplicationSettingsNotifications.php +++ b/src/Generated/Applications/ApplicationSettingsNotifications.php @@ -22,6 +22,7 @@ class ApplicationSettingsNotifications extends \Okta\Resource\AbstractResource { const VPN = 'vpn'; + /** * Get the vpn. * @@ -42,7 +43,7 @@ public function getVpn(array $options = []): \Okta\Applications\ApplicationSetti * @param \Okta\Applications\ApplicationSettingsNotificationsVpn $vpn The ApplicationSettingsNotificationsVpn instance. * @return self */ - public function setVpn(ApplicationSettingsNotificationsVpn $vpn) + public function setVpn(\Okta\Applications\ApplicationSettingsNotificationsVpn $vpn) { $this->setResourceProperty( self::VPN, diff --git a/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php b/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php index 26475c943b..e0f7ae850b 100644 --- a/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php +++ b/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php @@ -24,6 +24,7 @@ class ApplicationSettingsNotificationsVpn extends \Okta\Resource\AbstractResourc const MESSAGE = 'message'; const NETWORK = 'network'; + /** * Get the helpUrl. * @@ -92,7 +93,7 @@ public function getNetwork(array $options = []): \Okta\Applications\ApplicationS * @param \Okta\Applications\ApplicationSettingsNotificationsVpnNetwork $network The ApplicationSettingsNotificationsVpnNetwork instance. * @return self */ - public function setNetwork(ApplicationSettingsNotificationsVpnNetwork $network) + public function setNetwork(\Okta\Applications\ApplicationSettingsNotificationsVpnNetwork $network) { $this->setResourceProperty( self::NETWORK, diff --git a/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php b/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php index 5447fb8e71..222e2aa381 100644 --- a/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php +++ b/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php @@ -24,6 +24,7 @@ class ApplicationSettingsNotificationsVpnNetwork extends \Okta\Resource\Abstract const INCLUDE = 'include'; const CONNECTION = 'connection'; + /** * Get the exclude. * diff --git a/src/Generated/Applications/ApplicationVisibility.php b/src/Generated/Applications/ApplicationVisibility.php index fdea13e0a1..9d5fa46032 100644 --- a/src/Generated/Applications/ApplicationVisibility.php +++ b/src/Generated/Applications/ApplicationVisibility.php @@ -24,6 +24,7 @@ class ApplicationVisibility extends \Okta\Resource\AbstractResource const APP_LINKS = 'appLinks'; const AUTO_SUBMIT_TOOLBAR = 'autoSubmitToolbar'; + /** * Get the hide. * @@ -44,7 +45,7 @@ public function getHide(array $options = []): \Okta\Applications\ApplicationVisi * @param \Okta\Applications\ApplicationVisibilityHide $hide The ApplicationVisibilityHide instance. * @return self */ - public function setHide(ApplicationVisibilityHide $hide) + public function setHide(\Okta\Applications\ApplicationVisibilityHide $hide) { $this->setResourceProperty( self::HIDE, diff --git a/src/Generated/Applications/ApplicationVisibilityHide.php b/src/Generated/Applications/ApplicationVisibilityHide.php index ce533144bf..80ba6674ac 100644 --- a/src/Generated/Applications/ApplicationVisibilityHide.php +++ b/src/Generated/Applications/ApplicationVisibilityHide.php @@ -23,6 +23,7 @@ class ApplicationVisibilityHide extends \Okta\Resource\AbstractResource const I_OS = 'iOS'; const WEB = 'web'; + /** * Get the iOS. * diff --git a/src/Generated/Applications/AutoLoginApplication.php b/src/Generated/Applications/AutoLoginApplication.php index 99d7a3ce96..e3e9cb09a5 100644 --- a/src/Generated/Applications/AutoLoginApplication.php +++ b/src/Generated/Applications/AutoLoginApplication.php @@ -23,12 +23,13 @@ class AutoLoginApplication extends \Okta\Applications\Application const SETTINGS = 'settings'; const CREDENTIALS = 'credentials'; + /** * Get the settings. * - * @return \Okta\Applications\AutoLoginApplicationSettings + * @return \Okta\Applications\ApplicationSettings */ - public function getSettings(array $options = []): \Okta\Applications\AutoLoginApplicationSettings + public function getSettings(array $options = []): \Okta\Applications\ApplicationSettings { return $this->getResourceProperty( self::SETTINGS, @@ -40,10 +41,10 @@ public function getSettings(array $options = []): \Okta\Applications\AutoLoginAp /** * Set the settings. * - * @param \Okta\Applications\AutoLoginApplicationSettings $settings The AutoLoginApplicationSettings instance. + * @param \Okta\Applications\ApplicationSettings $settings The AutoLoginApplicationSettings instance. * @return self */ - public function setSettings(AutoLoginApplicationSettings $settings) + public function setSettings(\Okta\Applications\ApplicationSettings $settings) { $this->setResourceProperty( self::SETTINGS, @@ -55,9 +56,9 @@ public function setSettings(AutoLoginApplicationSettings $settings) /** * Get the credentials. * - * @return \Okta\Applications\SchemeApplicationCredentials + * @return \Okta\Applications\ApplicationCredentials */ - public function getCredentials(array $options = []): \Okta\Applications\SchemeApplicationCredentials + public function getCredentials(array $options = []): \Okta\Applications\ApplicationCredentials { return $this->getResourceProperty( self::CREDENTIALS, @@ -69,10 +70,10 @@ public function getCredentials(array $options = []): \Okta\Applications\SchemeAp /** * Set the credentials. * - * @param \Okta\Applications\SchemeApplicationCredentials $credentials The SchemeApplicationCredentials instance. + * @param \Okta\Applications\ApplicationCredentials $credentials The SchemeApplicationCredentials instance. * @return self */ - public function setCredentials(SchemeApplicationCredentials $credentials) + public function setCredentials(\Okta\Applications\ApplicationCredentials $credentials) { $this->setResourceProperty( self::CREDENTIALS, diff --git a/src/Generated/Applications/AutoLoginApplicationSettings.php b/src/Generated/Applications/AutoLoginApplicationSettings.php index 9d15f26baf..9f8bacdc62 100644 --- a/src/Generated/Applications/AutoLoginApplicationSettings.php +++ b/src/Generated/Applications/AutoLoginApplicationSettings.php @@ -22,6 +22,7 @@ class AutoLoginApplicationSettings extends \Okta\Applications\ApplicationSetting { const SIGN_ON = 'signOn'; + /** * Get the signOn. * @@ -42,7 +43,7 @@ public function getSignOn(array $options = []): \Okta\Applications\AutoLoginAppl * @param \Okta\Applications\AutoLoginApplicationSettingsSignOn $signOn The AutoLoginApplicationSettingsSignOn instance. * @return self */ - public function setSignOn(AutoLoginApplicationSettingsSignOn $signOn) + public function setSignOn(\Okta\Applications\AutoLoginApplicationSettingsSignOn $signOn) { $this->setResourceProperty( self::SIGN_ON, diff --git a/src/Generated/Applications/AutoLoginApplicationSettingsSignOn.php b/src/Generated/Applications/AutoLoginApplicationSettingsSignOn.php index c0af74dfb0..57f365435c 100644 --- a/src/Generated/Applications/AutoLoginApplicationSettingsSignOn.php +++ b/src/Generated/Applications/AutoLoginApplicationSettingsSignOn.php @@ -23,6 +23,7 @@ class AutoLoginApplicationSettingsSignOn extends \Okta\Resource\AbstractResource const LOGIN_URL = 'loginUrl'; const REDIRECT_URL = 'redirectUrl'; + /** * Get the loginUrl. * diff --git a/src/Generated/Applications/BasicApplicationSettings.php b/src/Generated/Applications/BasicApplicationSettings.php index e012ef935c..f1cbeb97ef 100644 --- a/src/Generated/Applications/BasicApplicationSettings.php +++ b/src/Generated/Applications/BasicApplicationSettings.php @@ -18,16 +18,17 @@ namespace Okta\Generated\Applications; -class BasicApplicationSettings extends \Okta\Resource\AbstractResource +class BasicApplicationSettings extends \Okta\Applications\ApplicationSettings { const APP = 'app'; + /** * Get the app. * - * @return \Okta\Applications\BasicApplicationSettingsApplication + * @return \Okta\Applications\ApplicationSettingsApplication */ - public function getApp(array $options = []): \Okta\Applications\BasicApplicationSettingsApplication + public function getApp(array $options = []): \Okta\Applications\ApplicationSettingsApplication { return $this->getResourceProperty( self::APP, @@ -39,10 +40,10 @@ public function getApp(array $options = []): \Okta\Applications\BasicApplication /** * Set the app. * - * @param \Okta\Applications\BasicApplicationSettingsApplication $app The BasicApplicationSettingsApplication instance. + * @param \Okta\Applications\ApplicationSettingsApplication $app The BasicApplicationSettingsApplication instance. * @return self */ - public function setApp(BasicApplicationSettingsApplication $app) + public function setApp(\Okta\Applications\ApplicationSettingsApplication $app) { $this->setResourceProperty( self::APP, diff --git a/src/Generated/Applications/BasicApplicationSettingsApplication.php b/src/Generated/Applications/BasicApplicationSettingsApplication.php index f2b3632589..9bd724ceb0 100644 --- a/src/Generated/Applications/BasicApplicationSettingsApplication.php +++ b/src/Generated/Applications/BasicApplicationSettingsApplication.php @@ -18,11 +18,12 @@ namespace Okta\Generated\Applications; -class BasicApplicationSettingsApplication extends \Okta\Resource\AbstractResource +class BasicApplicationSettingsApplication extends \Okta\Applications\ApplicationSettingsApplication { const URL = 'url'; const AUTH_URL = 'authURL'; + /** * Get the url. * diff --git a/src/Generated/Applications/BasicAuthApplication.php b/src/Generated/Applications/BasicAuthApplication.php index 8494193f3c..f34ea49620 100644 --- a/src/Generated/Applications/BasicAuthApplication.php +++ b/src/Generated/Applications/BasicAuthApplication.php @@ -20,15 +20,18 @@ class BasicAuthApplication extends \Okta\Applications\Application { + const NAME = 'name'; const SETTINGS = 'settings'; const CREDENTIALS = 'credentials'; + private $name = 'template_basic_auth'; + /** * Get the settings. * - * @return \Okta\Applications\BasicApplicationSettings + * @return \Okta\Applications\ApplicationSettings */ - public function getSettings(array $options = []): \Okta\Applications\BasicApplicationSettings + public function getSettings(array $options = []): \Okta\Applications\ApplicationSettings { return $this->getResourceProperty( self::SETTINGS, @@ -40,10 +43,10 @@ public function getSettings(array $options = []): \Okta\Applications\BasicApplic /** * Set the settings. * - * @param \Okta\Applications\BasicApplicationSettings $settings The BasicApplicationSettings instance. + * @param \Okta\Applications\ApplicationSettings $settings The BasicApplicationSettings instance. * @return self */ - public function setSettings(BasicApplicationSettings $settings) + public function setSettings(\Okta\Applications\ApplicationSettings $settings) { $this->setResourceProperty( self::SETTINGS, @@ -55,9 +58,9 @@ public function setSettings(BasicApplicationSettings $settings) /** * Get the credentials. * - * @return \Okta\Applications\SchemeApplicationCredentials + * @return \Okta\Applications\ApplicationCredentials */ - public function getCredentials(array $options = []): \Okta\Applications\SchemeApplicationCredentials + public function getCredentials(array $options = []): \Okta\Applications\ApplicationCredentials { return $this->getResourceProperty( self::CREDENTIALS, @@ -69,10 +72,10 @@ public function getCredentials(array $options = []): \Okta\Applications\SchemeAp /** * Set the credentials. * - * @param \Okta\Applications\SchemeApplicationCredentials $credentials The SchemeApplicationCredentials instance. + * @param \Okta\Applications\ApplicationCredentials $credentials The SchemeApplicationCredentials instance. * @return self */ - public function setCredentials(SchemeApplicationCredentials $credentials) + public function setCredentials(\Okta\Applications\ApplicationCredentials $credentials) { $this->setResourceProperty( self::CREDENTIALS, diff --git a/src/Generated/Applications/BookmarkApplication.php b/src/Generated/Applications/BookmarkApplication.php index 031dac5802..3115b279af 100644 --- a/src/Generated/Applications/BookmarkApplication.php +++ b/src/Generated/Applications/BookmarkApplication.php @@ -20,8 +20,11 @@ class BookmarkApplication extends \Okta\Resource\AbstractResource { + const NAME = 'name'; const SETTINGS = 'settings'; + private $name = 'bookmark'; + /** * Get the settings. * @@ -42,7 +45,7 @@ public function getSettings(array $options = []): \Okta\Applications\BookmarkApp * @param \Okta\Applications\BookmarkApplicationSettings $settings The BookmarkApplicationSettings instance. * @return self */ - public function setSettings(BookmarkApplicationSettings $settings) + public function setSettings(\Okta\Applications\BookmarkApplicationSettings $settings) { $this->setResourceProperty( self::SETTINGS, diff --git a/src/Generated/Applications/BookmarkApplicationSettings.php b/src/Generated/Applications/BookmarkApplicationSettings.php index 0b49e3a761..79f8ab9710 100644 --- a/src/Generated/Applications/BookmarkApplicationSettings.php +++ b/src/Generated/Applications/BookmarkApplicationSettings.php @@ -22,6 +22,7 @@ class BookmarkApplicationSettings extends \Okta\Resource\AbstractResource { const APP = 'app'; + /** * Get the app. * @@ -42,7 +43,7 @@ public function getApp(array $options = []): \Okta\Applications\BookmarkApplicat * @param \Okta\Applications\BookmarkApplicationSettingsApplication $app The BookmarkApplicationSettingsApplication instance. * @return self */ - public function setApp(BookmarkApplicationSettingsApplication $app) + public function setApp(\Okta\Applications\BookmarkApplicationSettingsApplication $app) { $this->setResourceProperty( self::APP, diff --git a/src/Generated/Applications/BookmarkApplicationSettingsApplication.php b/src/Generated/Applications/BookmarkApplicationSettingsApplication.php index 557bfaec8a..fb351d9f2c 100644 --- a/src/Generated/Applications/BookmarkApplicationSettingsApplication.php +++ b/src/Generated/Applications/BookmarkApplicationSettingsApplication.php @@ -23,6 +23,7 @@ class BookmarkApplicationSettingsApplication extends \Okta\Resource\AbstractReso const URL = 'url'; const REQUEST_INTEGRATION = 'requestIntegration'; + /** * Get the url. * diff --git a/src/Generated/Applications/BrowserPluginApplication.php b/src/Generated/Applications/BrowserPluginApplication.php index bd13a9a00c..242bb7fd5c 100644 --- a/src/Generated/Applications/BrowserPluginApplication.php +++ b/src/Generated/Applications/BrowserPluginApplication.php @@ -22,12 +22,13 @@ class BrowserPluginApplication extends \Okta\Applications\Application { const CREDENTIALS = 'credentials'; + /** * Get the credentials. * - * @return \Okta\Applications\SchemeApplicationCredentials + * @return \Okta\Applications\ApplicationCredentials */ - public function getCredentials(array $options = []): \Okta\Applications\SchemeApplicationCredentials + public function getCredentials(array $options = []): \Okta\Applications\ApplicationCredentials { return $this->getResourceProperty( self::CREDENTIALS, @@ -39,10 +40,10 @@ public function getCredentials(array $options = []): \Okta\Applications\SchemeAp /** * Set the credentials. * - * @param \Okta\Applications\SchemeApplicationCredentials $credentials The SchemeApplicationCredentials instance. + * @param \Okta\Applications\ApplicationCredentials $credentials The SchemeApplicationCredentials instance. * @return self */ - public function setCredentials(SchemeApplicationCredentials $credentials) + public function setCredentials(\Okta\Applications\ApplicationCredentials $credentials) { $this->setResourceProperty( self::CREDENTIALS, diff --git a/src/Generated/Applications/JsonWebKey.php b/src/Generated/Applications/JsonWebKey.php index 12f04629cb..636c88d234 100644 --- a/src/Generated/Applications/JsonWebKey.php +++ b/src/Generated/Applications/JsonWebKey.php @@ -36,6 +36,7 @@ class JsonWebKey extends \Okta\Resource\AbstractResource const EXPIRES_AT = 'expiresAt'; const LAST_UPDATED = 'lastUpdated'; + /** * Get the e. * @@ -129,11 +130,11 @@ public function getStatus(): string /** * Get the created. * - * @return string + * @return \Carbon\Carbon|null */ - public function getCreated(): string + public function getCreated() { - return $this->getProperty(self::CREATED); + return $this->getDateProperty(self::CREATED); } /** * Get the key_ops. @@ -156,19 +157,19 @@ public function getX5TS256(): string /** * Get the expiresAt. * - * @return string + * @return \Carbon\Carbon|null */ - public function getExpiresAt(): string + public function getExpiresAt() { - return $this->getProperty(self::EXPIRES_AT); + return $this->getDateProperty(self::EXPIRES_AT); } /** * Get the lastUpdated. * - * @return string + * @return \Carbon\Carbon|null */ - public function getLastUpdated(): string + public function getLastUpdated() { - return $this->getProperty(self::LAST_UPDATED); + return $this->getDateProperty(self::LAST_UPDATED); } } diff --git a/src/Generated/Applications/OAuthApplicationCredentials.php b/src/Generated/Applications/OAuthApplicationCredentials.php index 9389bc15f2..a2c0c7d4fd 100644 --- a/src/Generated/Applications/OAuthApplicationCredentials.php +++ b/src/Generated/Applications/OAuthApplicationCredentials.php @@ -18,10 +18,11 @@ namespace Okta\Generated\Applications; -class OAuthApplicationCredentials extends \Okta\Resource\AbstractResource +class OAuthApplicationCredentials extends \Okta\Applications\ApplicationCredentials { const OAUTH_CLIENT = 'oauthClient'; + /** * Get the oauthClient. * @@ -42,7 +43,7 @@ public function getOauthClient(array $options = []): \Okta\Applications\Applicat * @param \Okta\Applications\ApplicationCredentialsOAuthClient $oauthClient The ApplicationCredentialsOAuthClient instance. * @return self */ - public function setOauthClient(ApplicationCredentialsOAuthClient $oauthClient) + public function setOauthClient(\Okta\Applications\ApplicationCredentialsOAuthClient $oauthClient) { $this->setResourceProperty( self::OAUTH_CLIENT, diff --git a/src/Generated/Applications/OpenIdConnectApplication.php b/src/Generated/Applications/OpenIdConnectApplication.php index 6bc6abf097..52d3926c36 100644 --- a/src/Generated/Applications/OpenIdConnectApplication.php +++ b/src/Generated/Applications/OpenIdConnectApplication.php @@ -20,15 +20,18 @@ class OpenIdConnectApplication extends \Okta\Applications\Application { + const NAME = 'name'; const SETTINGS = 'settings'; const CREDENTIALS = 'credentials'; + private $name = 'oidc_client'; + /** * Get the settings. * - * @return \Okta\Applications\OpenIdConnectApplicationSettings + * @return \Okta\Applications\ApplicationSettings */ - public function getSettings(array $options = []): \Okta\Applications\OpenIdConnectApplicationSettings + public function getSettings(array $options = []): \Okta\Applications\ApplicationSettings { return $this->getResourceProperty( self::SETTINGS, @@ -40,10 +43,10 @@ public function getSettings(array $options = []): \Okta\Applications\OpenIdConne /** * Set the settings. * - * @param \Okta\Applications\OpenIdConnectApplicationSettings $settings The OpenIdConnectApplicationSettings instance. + * @param \Okta\Applications\ApplicationSettings $settings The OpenIdConnectApplicationSettings instance. * @return self */ - public function setSettings(OpenIdConnectApplicationSettings $settings) + public function setSettings(\Okta\Applications\ApplicationSettings $settings) { $this->setResourceProperty( self::SETTINGS, @@ -55,9 +58,9 @@ public function setSettings(OpenIdConnectApplicationSettings $settings) /** * Get the credentials. * - * @return \Okta\Applications\OAuthApplicationCredentials + * @return \Okta\Applications\ApplicationCredentials */ - public function getCredentials(array $options = []): \Okta\Applications\OAuthApplicationCredentials + public function getCredentials(array $options = []): \Okta\Applications\ApplicationCredentials { return $this->getResourceProperty( self::CREDENTIALS, @@ -69,10 +72,10 @@ public function getCredentials(array $options = []): \Okta\Applications\OAuthApp /** * Set the credentials. * - * @param \Okta\Applications\OAuthApplicationCredentials $credentials The OAuthApplicationCredentials instance. + * @param \Okta\Applications\ApplicationCredentials $credentials The OAuthApplicationCredentials instance. * @return self */ - public function setCredentials(OAuthApplicationCredentials $credentials) + public function setCredentials(\Okta\Applications\ApplicationCredentials $credentials) { $this->setResourceProperty( self::CREDENTIALS, diff --git a/src/Generated/Applications/OpenIdConnectApplicationSettings.php b/src/Generated/Applications/OpenIdConnectApplicationSettings.php index 46db0140b2..f5c0578af2 100644 --- a/src/Generated/Applications/OpenIdConnectApplicationSettings.php +++ b/src/Generated/Applications/OpenIdConnectApplicationSettings.php @@ -22,6 +22,7 @@ class OpenIdConnectApplicationSettings extends \Okta\Applications\ApplicationSet { const OAUTH_CLIENT = 'oauthClient'; + /** * Get the oauthClient. * @@ -42,7 +43,7 @@ public function getOauthClient(array $options = []): \Okta\Applications\OpenIdCo * @param \Okta\Applications\OpenIdConnectApplicationSettingsClient $oauthClient The OpenIdConnectApplicationSettingsClient instance. * @return self */ - public function setOauthClient(OpenIdConnectApplicationSettingsClient $oauthClient) + public function setOauthClient(\Okta\Applications\OpenIdConnectApplicationSettingsClient $oauthClient) { $this->setResourceProperty( self::OAUTH_CLIENT, diff --git a/src/Generated/Applications/OpenIdConnectApplicationSettingsClient.php b/src/Generated/Applications/OpenIdConnectApplicationSettingsClient.php index 22fab0abfb..f037b0e11b 100644 --- a/src/Generated/Applications/OpenIdConnectApplicationSettingsClient.php +++ b/src/Generated/Applications/OpenIdConnectApplicationSettingsClient.php @@ -30,6 +30,7 @@ class OpenIdConnectApplicationSettingsClient extends \Okta\Resource\AbstractReso const RESPONSE_TYPES = 'response_types'; const APPLICATION_TYPE = 'application_type'; + /** * Get the tos_uri. * diff --git a/src/Generated/Applications/SamlApplication.php b/src/Generated/Applications/SamlApplication.php index 4a987e6c41..0858825dac 100644 --- a/src/Generated/Applications/SamlApplication.php +++ b/src/Generated/Applications/SamlApplication.php @@ -22,12 +22,13 @@ class SamlApplication extends \Okta\Applications\Application { const SETTINGS = 'settings'; + /** * Get the settings. * - * @return \Okta\Applications\SamlApplicationSettings + * @return \Okta\Applications\ApplicationSettings */ - public function getSettings(array $options = []): \Okta\Applications\SamlApplicationSettings + public function getSettings(array $options = []): \Okta\Applications\ApplicationSettings { return $this->getResourceProperty( self::SETTINGS, @@ -39,10 +40,10 @@ public function getSettings(array $options = []): \Okta\Applications\SamlApplica /** * Set the settings. * - * @param \Okta\Applications\SamlApplicationSettings $settings The SamlApplicationSettings instance. + * @param \Okta\Applications\ApplicationSettings $settings The SamlApplicationSettings instance. * @return self */ - public function setSettings(SamlApplicationSettings $settings) + public function setSettings(\Okta\Applications\ApplicationSettings $settings) { $this->setResourceProperty( self::SETTINGS, diff --git a/src/Generated/Applications/SamlApplicationSettings.php b/src/Generated/Applications/SamlApplicationSettings.php index 3bbec68312..a175171dee 100644 --- a/src/Generated/Applications/SamlApplicationSettings.php +++ b/src/Generated/Applications/SamlApplicationSettings.php @@ -22,6 +22,7 @@ class SamlApplicationSettings extends \Okta\Applications\ApplicationSettings { const SIGN_ON = 'signOn'; + /** * Get the signOn. * @@ -42,7 +43,7 @@ public function getSignOn(array $options = []): \Okta\Applications\SamlApplicati * @param \Okta\Applications\SamlApplicationSettingsSignOn $signOn The SamlApplicationSettingsSignOn instance. * @return self */ - public function setSignOn(SamlApplicationSettingsSignOn $signOn) + public function setSignOn(\Okta\Applications\SamlApplicationSettingsSignOn $signOn) { $this->setResourceProperty( self::SIGN_ON, diff --git a/src/Generated/Applications/SamlApplicationSettingsSignOn.php b/src/Generated/Applications/SamlApplicationSettingsSignOn.php index a0d202b4e8..d14a560db0 100644 --- a/src/Generated/Applications/SamlApplicationSettingsSignOn.php +++ b/src/Generated/Applications/SamlApplicationSettingsSignOn.php @@ -42,6 +42,7 @@ class SamlApplicationSettingsSignOn extends \Okta\Resource\AbstractResource const AUTHN_CONTEXT_CLASS_REF = 'authnContextClassRef'; const SUBJECT_NAME_ID_TEMPLATE = 'subjectNameIdTemplate'; + /** * Get the audience. * diff --git a/src/Generated/Applications/SamlAttributeStatement.php b/src/Generated/Applications/SamlAttributeStatement.php index 98db33a7fa..4a56bd9019 100644 --- a/src/Generated/Applications/SamlAttributeStatement.php +++ b/src/Generated/Applications/SamlAttributeStatement.php @@ -21,14 +21,17 @@ class SamlAttributeStatement extends \Okta\Resource\AbstractResource { const NAME = 'name'; + const TYPE = 'type'; + const VALUES = 'values'; const NAMESPACE = 'namespace'; + /** * Get the name. * - * @return array + * @return string */ - public function getName(): array + public function getName(): string { return $this->getProperty(self::NAME); } @@ -47,6 +50,54 @@ public function setName($name) return $this; } + /** + * Get the type. + * + * @return string + */ + public function getType(): string + { + return $this->getProperty(self::TYPE); + } + /** + * Set the type. + * + * @param mixed $type The value to set. + * @return self + */ + public function setType($type) + { + $this->setProperty( + self::TYPE, + $type + ); + + return $this; + } + /** + * Get the values. + * + * @return array + */ + public function getValues(): array + { + return $this->getProperty(self::VALUES); + } + /** + * Set the values. + * + * @param mixed $values The value to set. + * @return self + */ + public function setValues($values) + { + $this->setProperty( + self::VALUES, + $values + ); + + return $this; + } /** * Get the namespace. * diff --git a/src/Generated/Applications/SchemeApplicationCredentials.php b/src/Generated/Applications/SchemeApplicationCredentials.php index 6548a71252..6696301677 100644 --- a/src/Generated/Applications/SchemeApplicationCredentials.php +++ b/src/Generated/Applications/SchemeApplicationCredentials.php @@ -18,7 +18,7 @@ namespace Okta\Generated\Applications; -class SchemeApplicationCredentials extends \Okta\Resource\AbstractResource +class SchemeApplicationCredentials extends \Okta\Applications\ApplicationCredentials { const SCHEME = 'scheme'; const SIGNING = 'signing'; @@ -26,6 +26,7 @@ class SchemeApplicationCredentials extends \Okta\Resource\AbstractResource const USER_NAME = 'userName'; const REVEAL_PASSWORD = 'revealPassword'; + /** * Get the scheme. * @@ -70,7 +71,7 @@ public function getSigning(array $options = []): \Okta\Applications\ApplicationC * @param \Okta\Applications\ApplicationCredentialsSigning $signing The ApplicationCredentialsSigning instance. * @return self */ - public function setSigning(ApplicationCredentialsSigning $signing) + public function setSigning(\Okta\Applications\ApplicationCredentialsSigning $signing) { $this->setResourceProperty( self::SIGNING, @@ -99,7 +100,7 @@ public function getPassword(array $options = []): \Okta\Applications\PasswordCre * @param \Okta\Applications\PasswordCredential $password The PasswordCredential instance. * @return self */ - public function setPassword(PasswordCredential $password) + public function setPassword(\Okta\Applications\PasswordCredential $password) { $this->setResourceProperty( self::PASSWORD, diff --git a/src/Generated/Applications/SecurePasswordStoreApplication.php b/src/Generated/Applications/SecurePasswordStoreApplication.php index deda02a229..9336f85171 100644 --- a/src/Generated/Applications/SecurePasswordStoreApplication.php +++ b/src/Generated/Applications/SecurePasswordStoreApplication.php @@ -20,15 +20,18 @@ class SecurePasswordStoreApplication extends \Okta\Applications\Application { + const NAME = 'name'; const SETTINGS = 'settings'; const CREDENTIALS = 'credentials'; + private $name = 'template_sps'; + /** * Get the settings. * - * @return \Okta\Applications\SecurePasswordStoreApplicationSettings + * @return \Okta\Applications\ApplicationSettings */ - public function getSettings(array $options = []): \Okta\Applications\SecurePasswordStoreApplicationSettings + public function getSettings(array $options = []): \Okta\Applications\ApplicationSettings { return $this->getResourceProperty( self::SETTINGS, @@ -40,10 +43,10 @@ public function getSettings(array $options = []): \Okta\Applications\SecurePassw /** * Set the settings. * - * @param \Okta\Applications\SecurePasswordStoreApplicationSettings $settings The SecurePasswordStoreApplicationSettings instance. + * @param \Okta\Applications\ApplicationSettings $settings The SecurePasswordStoreApplicationSettings instance. * @return self */ - public function setSettings(SecurePasswordStoreApplicationSettings $settings) + public function setSettings(\Okta\Applications\ApplicationSettings $settings) { $this->setResourceProperty( self::SETTINGS, @@ -55,9 +58,9 @@ public function setSettings(SecurePasswordStoreApplicationSettings $settings) /** * Get the credentials. * - * @return \Okta\Applications\SchemeApplicationCredentials + * @return \Okta\Applications\ApplicationCredentials */ - public function getCredentials(array $options = []): \Okta\Applications\SchemeApplicationCredentials + public function getCredentials(array $options = []): \Okta\Applications\ApplicationCredentials { return $this->getResourceProperty( self::CREDENTIALS, @@ -69,10 +72,10 @@ public function getCredentials(array $options = []): \Okta\Applications\SchemeAp /** * Set the credentials. * - * @param \Okta\Applications\SchemeApplicationCredentials $credentials The SchemeApplicationCredentials instance. + * @param \Okta\Applications\ApplicationCredentials $credentials The SchemeApplicationCredentials instance. * @return self */ - public function setCredentials(SchemeApplicationCredentials $credentials) + public function setCredentials(\Okta\Applications\ApplicationCredentials $credentials) { $this->setResourceProperty( self::CREDENTIALS, diff --git a/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php b/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php index e1223cdfbd..aca7aa51b8 100644 --- a/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php +++ b/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php @@ -22,12 +22,13 @@ class SecurePasswordStoreApplicationSettings extends \Okta\Applications\Applicat { const APP = 'app'; + /** * Get the app. * - * @return \Okta\Applications\SecurePasswordStoreApplicationSettingsApplication + * @return \Okta\Applications\ApplicationSettingsApplication */ - public function getApp(array $options = []): \Okta\Applications\SecurePasswordStoreApplicationSettingsApplication + public function getApp(array $options = []): \Okta\Applications\ApplicationSettingsApplication { return $this->getResourceProperty( self::APP, @@ -39,10 +40,10 @@ public function getApp(array $options = []): \Okta\Applications\SecurePasswordSt /** * Set the app. * - * @param \Okta\Applications\SecurePasswordStoreApplicationSettingsApplication $app The SecurePasswordStoreApplicationSettingsApplication instance. + * @param \Okta\Applications\ApplicationSettingsApplication $app The SecurePasswordStoreApplicationSettingsApplication instance. * @return self */ - public function setApp(SecurePasswordStoreApplicationSettingsApplication $app) + public function setApp(\Okta\Applications\ApplicationSettingsApplication $app) { $this->setResourceProperty( self::APP, diff --git a/src/Generated/Applications/SecurePasswordStoreApplicationSettingsApplication.php b/src/Generated/Applications/SecurePasswordStoreApplicationSettingsApplication.php index dee277fc6c..bb4eaa7b41 100644 --- a/src/Generated/Applications/SecurePasswordStoreApplicationSettingsApplication.php +++ b/src/Generated/Applications/SecurePasswordStoreApplicationSettingsApplication.php @@ -18,7 +18,7 @@ namespace Okta\Generated\Applications; -class SecurePasswordStoreApplicationSettingsApplication extends \Okta\Resource\AbstractResource +class SecurePasswordStoreApplicationSettingsApplication extends \Okta\Applications\ApplicationSettingsApplication { const URL = 'url'; const PASSWORD_FIELD = 'passwordField'; @@ -30,6 +30,7 @@ class SecurePasswordStoreApplicationSettingsApplication extends \Okta\Resource\A const OPTIONAL_FIELD_2_VALUE = 'optionalField2Value'; const OPTIONAL_FIELD_3_VALUE = 'optionalField3Value'; + /** * Get the url. * diff --git a/src/Generated/Applications/SwaApplication.php b/src/Generated/Applications/SwaApplication.php index 7a43ad2eda..8779000cbd 100644 --- a/src/Generated/Applications/SwaApplication.php +++ b/src/Generated/Applications/SwaApplication.php @@ -18,16 +18,19 @@ namespace Okta\Generated\Applications; -class SwaApplication extends \Okta\Application\BrowserPluginApplication +class SwaApplication extends \Okta\Applications\BrowserPluginApplication { + const NAME = 'name'; const SETTINGS = 'settings'; + private $name = 'template_swa'; + /** * Get the settings. * - * @return \Okta\Applications\SwaApplicationSettings + * @return \Okta\Applications\ApplicationSettings */ - public function getSettings(array $options = []): \Okta\Applications\SwaApplicationSettings + public function getSettings(array $options = []): \Okta\Applications\ApplicationSettings { return $this->getResourceProperty( self::SETTINGS, @@ -39,10 +42,10 @@ public function getSettings(array $options = []): \Okta\Applications\SwaApplicat /** * Set the settings. * - * @param \Okta\Applications\SwaApplicationSettings $settings The SwaApplicationSettings instance. + * @param \Okta\Applications\ApplicationSettings $settings The SwaApplicationSettings instance. * @return self */ - public function setSettings(SwaApplicationSettings $settings) + public function setSettings(\Okta\Applications\ApplicationSettings $settings) { $this->setResourceProperty( self::SETTINGS, diff --git a/src/Generated/Applications/SwaApplicationSettings.php b/src/Generated/Applications/SwaApplicationSettings.php index 83c92d773a..01aa0b52fe 100644 --- a/src/Generated/Applications/SwaApplicationSettings.php +++ b/src/Generated/Applications/SwaApplicationSettings.php @@ -18,16 +18,17 @@ namespace Okta\Generated\Applications; -class SwaApplicationSettings extends \Okta\Resource\AbstractResource +class SwaApplicationSettings extends \Okta\Applications\ApplicationSettings { const APP = 'app'; + /** * Get the app. * - * @return \Okta\Applications\SwaApplicationSettingsApplication + * @return \Okta\Applications\ApplicationSettingsApplication */ - public function getApp(array $options = []): \Okta\Applications\SwaApplicationSettingsApplication + public function getApp(array $options = []): \Okta\Applications\ApplicationSettingsApplication { return $this->getResourceProperty( self::APP, @@ -39,10 +40,10 @@ public function getApp(array $options = []): \Okta\Applications\SwaApplicationSe /** * Set the app. * - * @param \Okta\Applications\SwaApplicationSettingsApplication $app The SwaApplicationSettingsApplication instance. + * @param \Okta\Applications\ApplicationSettingsApplication $app The SwaApplicationSettingsApplication instance. * @return self */ - public function setApp(SwaApplicationSettingsApplication $app) + public function setApp(\Okta\Applications\ApplicationSettingsApplication $app) { $this->setResourceProperty( self::APP, diff --git a/src/Generated/Applications/SwaApplicationSettingsApplication.php b/src/Generated/Applications/SwaApplicationSettingsApplication.php index c31eb10846..b7802c15e6 100644 --- a/src/Generated/Applications/SwaApplicationSettingsApplication.php +++ b/src/Generated/Applications/SwaApplicationSettingsApplication.php @@ -18,13 +18,15 @@ namespace Okta\Generated\Applications; -class SwaApplicationSettingsApplication extends \Okta\Resource\AbstractResource +class SwaApplicationSettingsApplication extends \Okta\Applications\ApplicationSettingsApplication { const URL = 'url'; const BUTTON_FIELD = 'buttonField'; + const LOGIN_URL_REGEX = 'loginUrlRegex'; const PASSWORD_FIELD = 'passwordField'; const USERNAME_FIELD = 'usernameField'; + /** * Get the url. * @@ -73,6 +75,30 @@ public function setButtonField($buttonField) return $this; } + /** + * Get the loginUrlRegex. + * + * @return string + */ + public function getLoginUrlRegex(): string + { + return $this->getProperty(self::LOGIN_URL_REGEX); + } + /** + * Set the loginUrlRegex. + * + * @param mixed $loginUrlRegex The value to set. + * @return self + */ + public function setLoginUrlRegex($loginUrlRegex) + { + $this->setProperty( + self::LOGIN_URL_REGEX, + $loginUrlRegex + ); + + return $this; + } /** * Get the passwordField. * diff --git a/src/Generated/Applications/SwaThreeFieldApplication.php b/src/Generated/Applications/SwaThreeFieldApplication.php index 02c93a690c..86da626b57 100644 --- a/src/Generated/Applications/SwaThreeFieldApplication.php +++ b/src/Generated/Applications/SwaThreeFieldApplication.php @@ -18,16 +18,19 @@ namespace Okta\Generated\Applications; -class SwaThreeFieldApplication extends \Okta\Application\BrowserPluginApplication +class SwaThreeFieldApplication extends \Okta\Applications\BrowserPluginApplication { + const NAME = 'name'; const SETTINGS = 'settings'; + private $name = 'template_swa3field'; + /** * Get the settings. * - * @return \Okta\Applications\SwaThreeFieldApplicationSettings + * @return \Okta\Applications\ApplicationSettings */ - public function getSettings(array $options = []): \Okta\Applications\SwaThreeFieldApplicationSettings + public function getSettings(array $options = []): \Okta\Applications\ApplicationSettings { return $this->getResourceProperty( self::SETTINGS, @@ -39,10 +42,10 @@ public function getSettings(array $options = []): \Okta\Applications\SwaThreeFie /** * Set the settings. * - * @param \Okta\Applications\SwaThreeFieldApplicationSettings $settings The SwaThreeFieldApplicationSettings instance. + * @param \Okta\Applications\ApplicationSettings $settings The SwaThreeFieldApplicationSettings instance. * @return self */ - public function setSettings(SwaThreeFieldApplicationSettings $settings) + public function setSettings(\Okta\Applications\ApplicationSettings $settings) { $this->setResourceProperty( self::SETTINGS, diff --git a/src/Generated/Applications/SwaThreeFieldApplicationSettings.php b/src/Generated/Applications/SwaThreeFieldApplicationSettings.php index e391721925..267c2ae5ce 100644 --- a/src/Generated/Applications/SwaThreeFieldApplicationSettings.php +++ b/src/Generated/Applications/SwaThreeFieldApplicationSettings.php @@ -18,16 +18,17 @@ namespace Okta\Generated\Applications; -class SwaThreeFieldApplicationSettings extends \Okta\Resource\AbstractResource +class SwaThreeFieldApplicationSettings extends \Okta\Applications\ApplicationSettings { const APP = 'app'; + /** * Get the app. * - * @return \Okta\Applications\SwaThreeFieldApplicationSettingsApplication + * @return \Okta\Applications\ApplicationSettingsApplication */ - public function getApp(array $options = []): \Okta\Applications\SwaThreeFieldApplicationSettingsApplication + public function getApp(array $options = []): \Okta\Applications\ApplicationSettingsApplication { return $this->getResourceProperty( self::APP, @@ -39,10 +40,10 @@ public function getApp(array $options = []): \Okta\Applications\SwaThreeFieldApp /** * Set the app. * - * @param \Okta\Applications\SwaThreeFieldApplicationSettingsApplication $app The SwaThreeFieldApplicationSettingsApplication instance. + * @param \Okta\Applications\ApplicationSettingsApplication $app The SwaThreeFieldApplicationSettingsApplication instance. * @return self */ - public function setApp(SwaThreeFieldApplicationSettingsApplication $app) + public function setApp(\Okta\Applications\ApplicationSettingsApplication $app) { $this->setResourceProperty( self::APP, diff --git a/src/Generated/Applications/SwaThreeFieldApplicationSettingsApplication.php b/src/Generated/Applications/SwaThreeFieldApplicationSettingsApplication.php index ef3996ac70..96fe073508 100644 --- a/src/Generated/Applications/SwaThreeFieldApplicationSettingsApplication.php +++ b/src/Generated/Applications/SwaThreeFieldApplicationSettingsApplication.php @@ -18,35 +18,61 @@ namespace Okta\Generated\Applications; -class SwaThreeFieldApplicationSettingsApplication extends \Okta\Resource\AbstractResource +class SwaThreeFieldApplicationSettingsApplication extends \Okta\Applications\ApplicationSettingsApplication { - const URL = 'url'; + const TARGET_URL = 'targetUrl'; + const LOGIN_URL_REGEX = 'loginUrlRegex'; const BUTTON_SELECTOR = 'buttonSelector'; const EXTRA_FIELD_VALUE = 'extraFieldValue'; const PASSWORD_SELECTOR = 'passwordSelector'; const USER_NAME_SELECTOR = 'userNameSelector'; const EXTRA_FIELD_SELECTOR = 'extraFieldSelector'; + + /** + * Get the targetUrl. + * + * @return string + */ + public function getTargetUrl(): string + { + return $this->getProperty(self::TARGET_URL); + } + /** + * Set the targetUrl. + * + * @param mixed $targetUrl The value to set. + * @return self + */ + public function setTargetUrl($targetUrl) + { + $this->setProperty( + self::TARGET_URL, + $targetUrl + ); + + return $this; + } /** - * Get the url. + * Get the loginUrlRegex. * * @return string */ - public function getUrl(): string + public function getLoginUrlRegex(): string { - return $this->getProperty(self::URL); + return $this->getProperty(self::LOGIN_URL_REGEX); } /** - * Set the url. + * Set the loginUrlRegex. * - * @param mixed $url The value to set. + * @param mixed $loginUrlRegex The value to set. * @return self */ - public function setUrl($url) + public function setLoginUrlRegex($loginUrlRegex) { $this->setProperty( - self::URL, - $url + self::LOGIN_URL_REGEX, + $loginUrlRegex ); return $this; diff --git a/src/Generated/Applications/WsFederationApplication.php b/src/Generated/Applications/WsFederationApplication.php index 7c4f98408b..d3aaad5ee2 100644 --- a/src/Generated/Applications/WsFederationApplication.php +++ b/src/Generated/Applications/WsFederationApplication.php @@ -20,14 +20,17 @@ class WsFederationApplication extends \Okta\Applications\Application { + const NAME = 'name'; const SETTINGS = 'settings'; + private $name = 'template_wsfed'; + /** * Get the settings. * - * @return \Okta\Applications\WsFederationApplicationSettings + * @return \Okta\Applications\ApplicationSettings */ - public function getSettings(array $options = []): \Okta\Applications\WsFederationApplicationSettings + public function getSettings(array $options = []): \Okta\Applications\ApplicationSettings { return $this->getResourceProperty( self::SETTINGS, @@ -39,10 +42,10 @@ public function getSettings(array $options = []): \Okta\Applications\WsFederatio /** * Set the settings. * - * @param \Okta\Applications\WsFederationApplicationSettings $settings The WsFederationApplicationSettings instance. + * @param \Okta\Applications\ApplicationSettings $settings The WsFederationApplicationSettings instance. * @return self */ - public function setSettings(WsFederationApplicationSettings $settings) + public function setSettings(\Okta\Applications\ApplicationSettings $settings) { $this->setResourceProperty( self::SETTINGS, diff --git a/src/Generated/Applications/WsFederationApplicationSettings.php b/src/Generated/Applications/WsFederationApplicationSettings.php index 492665803a..3f3719a505 100644 --- a/src/Generated/Applications/WsFederationApplicationSettings.php +++ b/src/Generated/Applications/WsFederationApplicationSettings.php @@ -22,12 +22,13 @@ class WsFederationApplicationSettings extends \Okta\Applications\ApplicationSett { const APP = 'app'; + /** * Get the app. * - * @return \Okta\Applications\WsFederationApplicationSettingsApplication + * @return \Okta\Applications\ApplicationSettingsApplication */ - public function getApp(array $options = []): \Okta\Applications\WsFederationApplicationSettingsApplication + public function getApp(array $options = []): \Okta\Applications\ApplicationSettingsApplication { return $this->getResourceProperty( self::APP, @@ -39,10 +40,10 @@ public function getApp(array $options = []): \Okta\Applications\WsFederationAppl /** * Set the app. * - * @param \Okta\Applications\WsFederationApplicationSettingsApplication $app The WsFederationApplicationSettingsApplication instance. + * @param \Okta\Applications\ApplicationSettingsApplication $app The WsFederationApplicationSettingsApplication instance. * @return self */ - public function setApp(WsFederationApplicationSettingsApplication $app) + public function setApp(\Okta\Applications\ApplicationSettingsApplication $app) { $this->setResourceProperty( self::APP, diff --git a/src/Generated/Applications/WsFederationApplicationSettingsApplication.php b/src/Generated/Applications/WsFederationApplicationSettingsApplication.php index 2ac854dfe5..d1d01ae64c 100644 --- a/src/Generated/Applications/WsFederationApplicationSettingsApplication.php +++ b/src/Generated/Applications/WsFederationApplicationSettingsApplication.php @@ -18,7 +18,7 @@ namespace Okta\Generated\Applications; -class WsFederationApplicationSettingsApplication extends \Okta\Resource\AbstractResource +class WsFederationApplicationSettingsApplication extends \Okta\Applications\ApplicationSettingsApplication { const REALM = 'realm'; const SITE_URL = 'siteURL'; @@ -33,6 +33,7 @@ class WsFederationApplicationSettingsApplication extends \Okta\Resource\Abstract const AUDIENCE_RESTRICTION = 'audienceRestriction'; const AUTHN_CONTEXT_CLASS_REF = 'authnContextClassRef'; + /** * Get the realm. * @@ -180,9 +181,9 @@ public function setNameIdFormat($nameIDFormat) /** * Get the wReplyOverride. * - * @return string + * @return bool */ - public function getWReplyOverride(): string + public function getWReplyOverride(): bool { return $this->getProperty(self::W_REPLY_OVERRIDE); } diff --git a/src/Generated/GroupRules/GroupRule.php b/src/Generated/GroupRules/GroupRule.php index b0d5984c50..63dce077fa 100644 --- a/src/Generated/GroupRules/GroupRule.php +++ b/src/Generated/GroupRules/GroupRule.php @@ -29,6 +29,7 @@ class GroupRule extends \Okta\Resource\AbstractResource const CONDITIONS = 'conditions'; const LAST_UPDATED = 'lastUpdated'; + public function save() { return \Okta\Client::getInstance() @@ -135,7 +136,7 @@ public function getActions(array $options = []): \Okta\GroupRules\GroupRuleActio * @param \Okta\GroupRules\GroupRuleAction $actions The GroupRuleAction instance. * @return self */ - public function setActions(GroupRuleAction $actions) + public function setActions(\Okta\GroupRules\GroupRuleAction $actions) { $this->setResourceProperty( self::ACTIONS, @@ -173,7 +174,7 @@ public function getConditions(array $options = []): \Okta\GroupRules\GroupRuleCo * @param \Okta\GroupRules\GroupRuleConditions $conditions The GroupRuleConditions instance. * @return self */ - public function setConditions(GroupRuleConditions $conditions) + public function setConditions(\Okta\GroupRules\GroupRuleConditions $conditions) { $this->setResourceProperty( self::CONDITIONS, @@ -192,6 +193,7 @@ public function getLastUpdated() return $this->getDateProperty(self::LAST_UPDATED); } + /** * Activates a specific group rule by id from your organization * @@ -204,11 +206,14 @@ public function activate() $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri); + + return $body; } + /** * Deactivates a specific group rule by id from your organization * @@ -221,8 +226,10 @@ public function deactivate() $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri); + + return $body; } } diff --git a/src/Generated/GroupRules/GroupRuleAction.php b/src/Generated/GroupRules/GroupRuleAction.php index 845a573adc..6823aae0d6 100644 --- a/src/Generated/GroupRules/GroupRuleAction.php +++ b/src/Generated/GroupRules/GroupRuleAction.php @@ -22,6 +22,7 @@ class GroupRuleAction extends \Okta\Resource\AbstractResource { const ASSIGN_USER_TO_GROUPS = 'assignUserToGroups'; + /** * Get the assignUserToGroups. * @@ -42,7 +43,7 @@ public function getAssignUserToGroups(array $options = []): \Okta\GroupRules\Gro * @param \Okta\GroupRules\GroupRuleGroupAssignment $assignUserToGroups The GroupRuleGroupAssignment instance. * @return self */ - public function setAssignUserToGroups(GroupRuleGroupAssignment $assignUserToGroups) + public function setAssignUserToGroups(\Okta\GroupRules\GroupRuleGroupAssignment $assignUserToGroups) { $this->setResourceProperty( self::ASSIGN_USER_TO_GROUPS, diff --git a/src/Generated/GroupRules/GroupRuleConditions.php b/src/Generated/GroupRules/GroupRuleConditions.php index 3e8de5748a..2f10d9cfdd 100644 --- a/src/Generated/GroupRules/GroupRuleConditions.php +++ b/src/Generated/GroupRules/GroupRuleConditions.php @@ -23,6 +23,7 @@ class GroupRuleConditions extends \Okta\Resource\AbstractResource const PEOPLE = 'people'; const EXPRESSION = 'expression'; + /** * Get the people. * @@ -43,7 +44,7 @@ public function getPeople(array $options = []): \Okta\GroupRules\GroupRulePeople * @param \Okta\GroupRules\GroupRulePeopleCondition $people The GroupRulePeopleCondition instance. * @return self */ - public function setPeople(GroupRulePeopleCondition $people) + public function setPeople(\Okta\GroupRules\GroupRulePeopleCondition $people) { $this->setResourceProperty( self::PEOPLE, @@ -72,7 +73,7 @@ public function getExpression(array $options = []): \Okta\GroupRules\GroupRuleEx * @param \Okta\GroupRules\GroupRuleExpression $expression The GroupRuleExpression instance. * @return self */ - public function setExpression(GroupRuleExpression $expression) + public function setExpression(\Okta\GroupRules\GroupRuleExpression $expression) { $this->setResourceProperty( self::EXPRESSION, diff --git a/src/Generated/GroupRules/GroupRuleExpression.php b/src/Generated/GroupRules/GroupRuleExpression.php index 6b9d6a4cc8..84f753285c 100644 --- a/src/Generated/GroupRules/GroupRuleExpression.php +++ b/src/Generated/GroupRules/GroupRuleExpression.php @@ -23,6 +23,7 @@ class GroupRuleExpression extends \Okta\Resource\AbstractResource const TYPE = 'type'; const VALUE = 'value'; + /** * Get the type. * diff --git a/src/Generated/GroupRules/GroupRuleGroupAssignment.php b/src/Generated/GroupRules/GroupRuleGroupAssignment.php index f07721e3ea..7bc1bf1cc2 100644 --- a/src/Generated/GroupRules/GroupRuleGroupAssignment.php +++ b/src/Generated/GroupRules/GroupRuleGroupAssignment.php @@ -22,6 +22,7 @@ class GroupRuleGroupAssignment extends \Okta\Resource\AbstractResource { const GROUP_IDS = 'groupIds'; + /** * Get the groupIds. * diff --git a/src/Generated/GroupRules/GroupRuleGroupCondition.php b/src/Generated/GroupRules/GroupRuleGroupCondition.php index 66b9b6a126..f2505fc769 100644 --- a/src/Generated/GroupRules/GroupRuleGroupCondition.php +++ b/src/Generated/GroupRules/GroupRuleGroupCondition.php @@ -23,6 +23,7 @@ class GroupRuleGroupCondition extends \Okta\Resource\AbstractResource const EXCLUDE = 'exclude'; const INCLUDE = 'include'; + /** * Get the exclude. * diff --git a/src/Generated/GroupRules/GroupRulePeopleCondition.php b/src/Generated/GroupRules/GroupRulePeopleCondition.php index bb2fe5fc7d..b9dc84b763 100644 --- a/src/Generated/GroupRules/GroupRulePeopleCondition.php +++ b/src/Generated/GroupRules/GroupRulePeopleCondition.php @@ -23,6 +23,7 @@ class GroupRulePeopleCondition extends \Okta\Resource\AbstractResource const USERS = 'users'; const GROUPS = 'groups'; + /** * Get the users. * @@ -43,7 +44,7 @@ public function getUsers(array $options = []): \Okta\GroupRules\GroupRuleUserCon * @param \Okta\GroupRules\GroupRuleUserCondition $users The GroupRuleUserCondition instance. * @return self */ - public function setUsers(GroupRuleUserCondition $users) + public function setUsers(\Okta\GroupRules\GroupRuleUserCondition $users) { $this->setResourceProperty( self::USERS, @@ -72,7 +73,7 @@ public function getGroups(array $options = []): \Okta\GroupRules\GroupRuleGroupC * @param \Okta\GroupRules\GroupRuleGroupCondition $groups The GroupRuleGroupCondition instance. * @return self */ - public function setGroups(GroupRuleGroupCondition $groups) + public function setGroups(\Okta\GroupRules\GroupRuleGroupCondition $groups) { $this->setResourceProperty( self::GROUPS, diff --git a/src/Generated/GroupRules/GroupRuleUserCondition.php b/src/Generated/GroupRules/GroupRuleUserCondition.php index d1ec29760a..e2609334d4 100644 --- a/src/Generated/GroupRules/GroupRuleUserCondition.php +++ b/src/Generated/GroupRules/GroupRuleUserCondition.php @@ -23,6 +23,7 @@ class GroupRuleUserCondition extends \Okta\Resource\AbstractResource const EXCLUDE = 'exclude'; const INCLUDE = 'include'; + /** * Get the exclude. * diff --git a/src/Generated/Groups/Group.php b/src/Generated/Groups/Group.php index a50477708c..5b1a25dafc 100644 --- a/src/Generated/Groups/Group.php +++ b/src/Generated/Groups/Group.php @@ -31,6 +31,7 @@ class Group extends \Okta\Resource\AbstractResource const OBJECT_CLASS = 'objectClass'; const LAST_MEMBERSHIP_UPDATED = 'lastMembershipUpdated'; + public function save() { return \Okta\Client::getInstance() @@ -107,7 +108,7 @@ public function getProfile(array $options = []): \Okta\Groups\GroupProfile * @param \Okta\Groups\GroupProfile $profile The GroupProfile instance. * @return self */ - public function setProfile(GroupProfile $profile) + public function setProfile(\Okta\Groups\GroupProfile $profile) { $this->setResourceProperty( self::PROFILE, @@ -153,6 +154,7 @@ public function getLastMembershipUpdated() return $this->getDateProperty(self::LAST_MEMBERSHIP_UPDATED); } + /** * Removes a [user](users.html#user-model) from a group with `OKTA_GROUP` type. * @@ -165,9 +167,11 @@ public function removeUser($userId) $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('DELETE', $uri); + + return $body; } /** diff --git a/src/Generated/Groups/GroupProfile.php b/src/Generated/Groups/GroupProfile.php index 8d624301eb..0643ed7625 100644 --- a/src/Generated/Groups/GroupProfile.php +++ b/src/Generated/Groups/GroupProfile.php @@ -23,6 +23,7 @@ class GroupProfile extends \Okta\Resource\AbstractResource const NAME = 'name'; const DESCRIPTION = 'description'; + /** * Get the name. * diff --git a/src/Generated/UserFactors/CallFactor.php b/src/Generated/UserFactors/CallFactor.php index d07ad4dcee..2474ea8e13 100644 --- a/src/Generated/UserFactors/CallFactor.php +++ b/src/Generated/UserFactors/CallFactor.php @@ -22,6 +22,7 @@ class CallFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; + /** * Get the profile. * diff --git a/src/Generated/UserFactors/CallFactorProfile.php b/src/Generated/UserFactors/CallFactorProfile.php index 26d4731201..cd07352f67 100644 --- a/src/Generated/UserFactors/CallFactorProfile.php +++ b/src/Generated/UserFactors/CallFactorProfile.php @@ -23,6 +23,7 @@ class CallFactorProfile extends \Okta\UserFactors\FactorProfile const PHONE_NUMBER = 'phoneNumber'; const PHONE_EXTENSION = 'phoneExtension'; + /** * Get the phoneNumber. * diff --git a/src/Generated/UserFactors/EmailFactor.php b/src/Generated/UserFactors/EmailFactor.php index 6af1845df8..d6b131e1df 100644 --- a/src/Generated/UserFactors/EmailFactor.php +++ b/src/Generated/UserFactors/EmailFactor.php @@ -22,6 +22,7 @@ class EmailFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; + /** * Get the profile. * diff --git a/src/Generated/UserFactors/EmailFactorProfile.php b/src/Generated/UserFactors/EmailFactorProfile.php index 589c8670d8..554ecbf539 100644 --- a/src/Generated/UserFactors/EmailFactorProfile.php +++ b/src/Generated/UserFactors/EmailFactorProfile.php @@ -22,6 +22,7 @@ class EmailFactorProfile extends \Okta\UserFactors\FactorProfile { const EMAIL = 'email'; + /** * Get the email. * diff --git a/src/Generated/UserFactors/Factor.php b/src/Generated/UserFactors/Factor.php index 0806ff63c4..e936ff6cc7 100644 --- a/src/Generated/UserFactors/Factor.php +++ b/src/Generated/UserFactors/Factor.php @@ -35,6 +35,7 @@ class Factor extends \Okta\Resource\AbstractResource const MFA_STATE_TOKEN_ID = 'mfaStateTokenId'; const RECHALLENGE_EXISTING_FACTOR = 'rechallengeExistingFactor'; + /** * Get the id. * @@ -130,7 +131,7 @@ public function getVerify(array $options = []): \Okta\UserFactors\VerifyFactorRe * @param \Okta\UserFactors\VerifyFactorRequest $verify The VerifyFactorRequest instance. * @return self */ - public function setVerify(VerifyFactorRequest $verify) + public function setVerify(\Okta\UserFactors\VerifyFactorRequest $verify) { $this->setResourceProperty( self::VERIFY, @@ -307,6 +308,7 @@ public function setRechallengeExistingFactor($rechallengeExistingFactor) return $this; } + /** * The `sms` and `token:software:totp` [factor types](#factor-type) require activation to complete the enrollment process. * @@ -319,11 +321,15 @@ public function activate(VerifyFactorRequest $verifyFactorRequest) $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri, $verifyFactorRequest); + + $response = new \Okta\UserFactors\Factor(null, $body); + return $response->convertFromGenericFactor(); } + /** * Verifies an OTP for a `token` or `token:hardware` factor * @@ -336,8 +342,10 @@ public function verify(VerifyFactorRequest $verifyFactorRequest) $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri, $verifyFactorRequest); + + return new \Okta\UserFactors\VerifyFactorResponse(null, $body); } } diff --git a/src/Generated/UserFactors/FactorProfile.php b/src/Generated/UserFactors/FactorProfile.php index 921947e5a9..ce25c87e84 100644 --- a/src/Generated/UserFactors/FactorProfile.php +++ b/src/Generated/UserFactors/FactorProfile.php @@ -21,4 +21,5 @@ class FactorProfile extends \Okta\Resource\AbstractResource { + } diff --git a/src/Generated/UserFactors/HardwareFactor.php b/src/Generated/UserFactors/HardwareFactor.php index 0c425a88ce..099971d173 100644 --- a/src/Generated/UserFactors/HardwareFactor.php +++ b/src/Generated/UserFactors/HardwareFactor.php @@ -22,6 +22,7 @@ class HardwareFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; + /** * Get the profile. * diff --git a/src/Generated/UserFactors/HardwareFactorProfile.php b/src/Generated/UserFactors/HardwareFactorProfile.php index df0da5c460..e2bf7cecd2 100644 --- a/src/Generated/UserFactors/HardwareFactorProfile.php +++ b/src/Generated/UserFactors/HardwareFactorProfile.php @@ -22,6 +22,7 @@ class HardwareFactorProfile extends \Okta\UserFactors\FactorProfile { const CREDENTIAL_ID = 'credentialId'; + /** * Get the credentialId. * diff --git a/src/Generated/UserFactors/PushFactor.php b/src/Generated/UserFactors/PushFactor.php index 65e52a8877..b0d6500620 100644 --- a/src/Generated/UserFactors/PushFactor.php +++ b/src/Generated/UserFactors/PushFactor.php @@ -22,6 +22,7 @@ class PushFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; + /** * Get the profile. * diff --git a/src/Generated/UserFactors/PushFactorProfile.php b/src/Generated/UserFactors/PushFactorProfile.php index 01998cd3d4..67b38b4b8e 100644 --- a/src/Generated/UserFactors/PushFactorProfile.php +++ b/src/Generated/UserFactors/PushFactorProfile.php @@ -26,6 +26,7 @@ class PushFactorProfile extends \Okta\UserFactors\FactorProfile const DEVICE_TYPE = 'deviceType'; const CREDENTIAL_ID = 'credentialId'; + /** * Get the name. * diff --git a/src/Generated/UserFactors/SecurityQuestion.php b/src/Generated/UserFactors/SecurityQuestion.php index a7dc5cdde3..2f07415d76 100644 --- a/src/Generated/UserFactors/SecurityQuestion.php +++ b/src/Generated/UserFactors/SecurityQuestion.php @@ -24,6 +24,7 @@ class SecurityQuestion extends \Okta\Resource\AbstractResource const QUESTION = 'question'; const QUESTION_TEXT = 'questionText'; + /** * Get the answer. * diff --git a/src/Generated/UserFactors/SecurityQuestionFactor.php b/src/Generated/UserFactors/SecurityQuestionFactor.php index 53acad6e46..7c9018feeb 100644 --- a/src/Generated/UserFactors/SecurityQuestionFactor.php +++ b/src/Generated/UserFactors/SecurityQuestionFactor.php @@ -22,6 +22,7 @@ class SecurityQuestionFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; + /** * Get the profile. * diff --git a/src/Generated/UserFactors/SecurityQuestionFactorProfile.php b/src/Generated/UserFactors/SecurityQuestionFactorProfile.php index 67f7e64a1f..dc8a65f3a7 100644 --- a/src/Generated/UserFactors/SecurityQuestionFactorProfile.php +++ b/src/Generated/UserFactors/SecurityQuestionFactorProfile.php @@ -24,6 +24,7 @@ class SecurityQuestionFactorProfile extends \Okta\UserFactors\FactorProfile const QUESTION = 'question'; const QUESTION_TEXT = 'questionText'; + /** * Get the answer. * diff --git a/src/Generated/UserFactors/SmsFactor.php b/src/Generated/UserFactors/SmsFactor.php index 3524bd0a63..f707de20ff 100644 --- a/src/Generated/UserFactors/SmsFactor.php +++ b/src/Generated/UserFactors/SmsFactor.php @@ -22,6 +22,7 @@ class SmsFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; + /** * Get the profile. * diff --git a/src/Generated/UserFactors/SmsFactorProfile.php b/src/Generated/UserFactors/SmsFactorProfile.php index 8a8125c388..a1ec28d4cb 100644 --- a/src/Generated/UserFactors/SmsFactorProfile.php +++ b/src/Generated/UserFactors/SmsFactorProfile.php @@ -22,6 +22,7 @@ class SmsFactorProfile extends \Okta\UserFactors\FactorProfile { const PHONE_NUMBER = 'phoneNumber'; + /** * Get the phoneNumber. * diff --git a/src/Generated/UserFactors/TokenFactor.php b/src/Generated/UserFactors/TokenFactor.php index fd14c2940a..362fcac64b 100644 --- a/src/Generated/UserFactors/TokenFactor.php +++ b/src/Generated/UserFactors/TokenFactor.php @@ -22,6 +22,7 @@ class TokenFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; + /** * Get the profile. * diff --git a/src/Generated/UserFactors/TokenFactorProfile.php b/src/Generated/UserFactors/TokenFactorProfile.php index 3d9e8df78e..20105d2f0f 100644 --- a/src/Generated/UserFactors/TokenFactorProfile.php +++ b/src/Generated/UserFactors/TokenFactorProfile.php @@ -22,6 +22,7 @@ class TokenFactorProfile extends \Okta\UserFactors\FactorProfile { const CREDENTIAL_ID = 'credentialId'; + /** * Get the credentialId. * diff --git a/src/Generated/UserFactors/TotpFactor.php b/src/Generated/UserFactors/TotpFactor.php index 40c2644b0b..8899ab648f 100644 --- a/src/Generated/UserFactors/TotpFactor.php +++ b/src/Generated/UserFactors/TotpFactor.php @@ -22,6 +22,7 @@ class TotpFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; + /** * Get the profile. * diff --git a/src/Generated/UserFactors/TotpFactorProfile.php b/src/Generated/UserFactors/TotpFactorProfile.php index cb59223fb9..2f1966536c 100644 --- a/src/Generated/UserFactors/TotpFactorProfile.php +++ b/src/Generated/UserFactors/TotpFactorProfile.php @@ -22,6 +22,7 @@ class TotpFactorProfile extends \Okta\UserFactors\FactorProfile { const CREDENTIAL_ID = 'credentialId'; + /** * Get the credentialId. * diff --git a/src/Generated/UserFactors/VerifyFactorRequest.php b/src/Generated/UserFactors/VerifyFactorRequest.php index 7ee432d9f0..e1f434ce7b 100644 --- a/src/Generated/UserFactors/VerifyFactorRequest.php +++ b/src/Generated/UserFactors/VerifyFactorRequest.php @@ -25,6 +25,7 @@ class VerifyFactorRequest extends \Okta\Resource\AbstractResource const NEXT_PASS_CODE = 'nextPassCode'; const ACTIVATION_TOKEN = 'activationToken'; + /** * Get the answer. * diff --git a/src/Generated/UserFactors/VerifyFactorResponse.php b/src/Generated/UserFactors/VerifyFactorResponse.php index 6339308749..bc2464bc0f 100644 --- a/src/Generated/UserFactors/VerifyFactorResponse.php +++ b/src/Generated/UserFactors/VerifyFactorResponse.php @@ -26,6 +26,7 @@ class VerifyFactorResponse extends \Okta\Resource\AbstractResource const FACTOR_RESULT = 'factorResult'; const FACTOR_RESULT_MESSAGE = 'factorResultMessage'; + /** * Get the _links. * diff --git a/src/Generated/UserFactors/WebFactor.php b/src/Generated/UserFactors/WebFactor.php index 0d84986fc8..9e67513059 100644 --- a/src/Generated/UserFactors/WebFactor.php +++ b/src/Generated/UserFactors/WebFactor.php @@ -22,6 +22,7 @@ class WebFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; + /** * Get the profile. * diff --git a/src/Generated/UserFactors/WebFactorProfile.php b/src/Generated/UserFactors/WebFactorProfile.php index d8392c30cb..6461aa30a2 100644 --- a/src/Generated/UserFactors/WebFactorProfile.php +++ b/src/Generated/UserFactors/WebFactorProfile.php @@ -22,6 +22,7 @@ class WebFactorProfile extends \Okta\UserFactors\FactorProfile { const CREDENTIAL_ID = 'credentialId'; + /** * Get the credentialId. * diff --git a/src/Generated/Users/AppLink.php b/src/Generated/Users/AppLink.php index d7f7199724..d2dfbbf32f 100644 --- a/src/Generated/Users/AppLink.php +++ b/src/Generated/Users/AppLink.php @@ -31,6 +31,7 @@ class AppLink extends \Okta\Resource\AbstractResource const APP_ASSIGNMENT_ID = 'appAssignmentId'; const CREDENTIALS_SETUP = 'credentialsSetup'; + /** * Get the id. * diff --git a/src/Generated/Users/AuthenticationProvider.php b/src/Generated/Users/AuthenticationProvider.php index efc05ebdc4..25bcc30c83 100644 --- a/src/Generated/Users/AuthenticationProvider.php +++ b/src/Generated/Users/AuthenticationProvider.php @@ -23,6 +23,7 @@ class AuthenticationProvider extends \Okta\Resource\AbstractResource const NAME = 'name'; const TYPE = 'type'; + /** * Get the name. * diff --git a/src/Generated/Users/ChangePasswordRequest.php b/src/Generated/Users/ChangePasswordRequest.php index 1e03371d8d..f50b36211b 100644 --- a/src/Generated/Users/ChangePasswordRequest.php +++ b/src/Generated/Users/ChangePasswordRequest.php @@ -23,6 +23,7 @@ class ChangePasswordRequest extends \Okta\Resource\AbstractResource const NEW_PASSWORD = 'newPassword'; const OLD_PASSWORD = 'oldPassword'; + /** * Get the newPassword. * @@ -43,7 +44,7 @@ public function getNewPassword(array $options = []): \Okta\Users\PasswordCredent * @param \Okta\Users\PasswordCredential $newPassword The PasswordCredential instance. * @return self */ - public function setNewPassword(PasswordCredential $newPassword) + public function setNewPassword(\Okta\Users\PasswordCredential $newPassword) { $this->setResourceProperty( self::NEW_PASSWORD, @@ -72,7 +73,7 @@ public function getOldPassword(array $options = []): \Okta\Users\PasswordCredent * @param \Okta\Users\PasswordCredential $oldPassword The PasswordCredential instance. * @return self */ - public function setOldPassword(PasswordCredential $oldPassword) + public function setOldPassword(\Okta\Users\PasswordCredential $oldPassword) { $this->setResourceProperty( self::OLD_PASSWORD, diff --git a/src/Generated/Users/ForgotPasswordResponse.php b/src/Generated/Users/ForgotPasswordResponse.php index ba6113e34f..7e14a41172 100644 --- a/src/Generated/Users/ForgotPasswordResponse.php +++ b/src/Generated/Users/ForgotPasswordResponse.php @@ -22,6 +22,7 @@ class ForgotPasswordResponse extends \Okta\Resource\AbstractResource { const RESET_PASSWORD_URL = 'resetPasswordUrl'; + /** * Get the resetPasswordUrl. * diff --git a/src/Generated/Users/PasswordCredential.php b/src/Generated/Users/PasswordCredential.php index e35f394190..c878990bc9 100644 --- a/src/Generated/Users/PasswordCredential.php +++ b/src/Generated/Users/PasswordCredential.php @@ -22,6 +22,7 @@ class PasswordCredential extends \Okta\Resource\AbstractResource { const VALUE = 'value'; + /** * Get the value. * diff --git a/src/Generated/Users/RecoveryQuestionCredential.php b/src/Generated/Users/RecoveryQuestionCredential.php index ab39be1d54..dcbb584cf9 100644 --- a/src/Generated/Users/RecoveryQuestionCredential.php +++ b/src/Generated/Users/RecoveryQuestionCredential.php @@ -23,6 +23,7 @@ class RecoveryQuestionCredential extends \Okta\Resource\AbstractResource const ANSWER = 'answer'; const QUESTION = 'question'; + /** * Get the answer. * diff --git a/src/Generated/Users/ResetPasswordToken.php b/src/Generated/Users/ResetPasswordToken.php index de45d83af5..95217e7be4 100644 --- a/src/Generated/Users/ResetPasswordToken.php +++ b/src/Generated/Users/ResetPasswordToken.php @@ -22,6 +22,7 @@ class ResetPasswordToken extends \Okta\Resource\AbstractResource { const RESET_PASSWORD_URL = 'resetPasswordUrl'; + /** * Get the resetPasswordUrl. * diff --git a/src/Generated/Users/Role.php b/src/Generated/Users/Role.php index f9ca26a142..9dc6151cef 100644 --- a/src/Generated/Users/Role.php +++ b/src/Generated/Users/Role.php @@ -29,6 +29,7 @@ class Role extends \Okta\Resource\AbstractResource const DESCRIPTION = 'description'; const LAST_UPDATED = 'lastUpdated'; + /** * Get the id. * diff --git a/src/Generated/Users/TempPassword.php b/src/Generated/Users/TempPassword.php index 7718669a93..663641acf8 100644 --- a/src/Generated/Users/TempPassword.php +++ b/src/Generated/Users/TempPassword.php @@ -22,6 +22,7 @@ class TempPassword extends \Okta\Resource\AbstractResource { const TEMP_PASSWORD = 'tempPassword'; + /** * Get the tempPassword. * diff --git a/src/Generated/Users/User.php b/src/Generated/Users/User.php index 15f1dadbf6..a0c298fe5e 100644 --- a/src/Generated/Users/User.php +++ b/src/Generated/Users/User.php @@ -37,6 +37,7 @@ class User extends \Okta\Resource\AbstractResource const PASSWORD_CHANGED = 'passwordChanged'; const TRANSITIONING_TO_STATUS = 'transitioningToStatus'; + public function create() { return \Okta\Client::getInstance() @@ -134,7 +135,7 @@ public function getProfile(array $options = []): \Okta\Users\UserProfile * @param \Okta\Users\UserProfile $profile The UserProfile instance. * @return self */ - public function setProfile(UserProfile $profile) + public function setProfile(\Okta\Users\UserProfile $profile) { $this->setResourceProperty( self::PROFILE, @@ -190,7 +191,7 @@ public function getCredentials(array $options = []): \Okta\Users\UserCredentials * @param \Okta\Users\UserCredentials $credentials The UserCredentials instance. * @return self */ - public function setCredentials(UserCredentials $credentials) + public function setCredentials(\Okta\Users\UserCredentials $credentials) { $this->setResourceProperty( self::CREDENTIALS, @@ -255,6 +256,7 @@ public function getAppLinks(array $options = []): \Okta\Users\Collection ); } + /** * Changes a user's password by validating the user's current password. This operation can only be performed on users in `STAGED`, `ACTIVE`, `PASSWORD_EXPIRED`, or `RECOVERY` status that have a valid [password credential](#password-object) * @@ -267,11 +269,14 @@ public function changePassword(ChangePasswordRequest $changePasswordRequest) $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri, $changePasswordRequest); + + return new \Okta\Users\UserCredentials(null, $body); } + /** * Changes a user's recovery question & answer credential by validating the user's current password. This operation can only be performed on users in **STAGED**, **ACTIVE** or **RECOVERY** `status` that have a valid [password credential](#password-object) * @@ -284,11 +289,14 @@ public function changeRecoveryQuestion(UserCredentials $userCredentials) $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri, $userCredentials); + + return new \Okta\Users\UserCredentials(null, $body); } + /** * Generates a one-time token (OTT) that can be used to reset a user's password. The user will be required to validate their security question's answer when visiting the reset link. This operation can only be performed on users with a valid [recovery question credential](#recovery-question-object) and have an `ACTIVE` status. * @@ -301,9 +309,11 @@ public function forgotPassword(UserCredentials $userCredentials, $sendEmail = tr $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri, $userCredentials, ['query' => ['sendEmail' => $sendEmail]]); + + return new \Okta\Users\ForgotPasswordResponse(null, $body); } /** @@ -325,6 +335,7 @@ public function getRoles(array $options = []): \Okta\Users\Collection ); } + /** * Assigns a role to a user. * @@ -337,11 +348,14 @@ public function addRole(Role $role) $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri, $role); + + return new \Okta\Users\Role(null, $body); } + /** * Unassigns a role from a user. * @@ -354,9 +368,11 @@ public function removeRole($roleId) $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('DELETE', $uri); + + return $body; } /** @@ -378,6 +394,7 @@ public function getGroupTargetsForRole($roleId, array $options = []): \Okta\Grou ); } + /** * * @@ -390,11 +407,14 @@ public function removeGroupTargetFromRole($roleId, $groupId) $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('DELETE', $uri); + + return $body; } + /** * * @@ -407,9 +427,11 @@ public function addGroupTargetToRole($roleId, $groupId) $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('PUT', $uri); + + return $body; } /** @@ -431,6 +453,7 @@ public function getGroups(array $options = []): \Okta\Groups\Collection ); } + /** * Activates a user. This operation can only be performed on users with a `STAGED` status. Activation of a user is an asynchronous operation. The user will have the `transitioningToStatus` property with a value of `ACTIVE` during activation to indicate that the user hasn't completed the asynchronous operation. The user will have a status of `ACTIVE` when the activation process is complete. * @@ -443,11 +466,14 @@ public function activate($sendEmail = true) $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri, '', ['query' => ['sendEmail' => $sendEmail]]); + + return new \Okta\Users\UserActivationToken(null, $body); } + /** * Deactivates a user. This operation can only be performed on users that do not have a `DEPROVISIONED` status. Deactivation of a user is an asynchronous operation. The user will have the `transitioningToStatus` property with a value of `DEPROVISIONED` during deactivation to indicate that the user hasn't completed the asynchronous operation. The user will have a status of `DEPROVISIONED` when the deactivation process is complete. * @@ -460,11 +486,14 @@ public function deactivate() $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri); + + return $body; } + /** * Suspends a user. This operation can only be performed on users with an `ACTIVE` status. The user will have a status of `SUSPENDED` when the process is complete. * @@ -477,11 +506,14 @@ public function suspend() $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri); + + return $body; } + /** * Unsuspends a user and returns them to the `ACTIVE` state. This operation can only be performed on users that have a `SUSPENDED` status. * @@ -494,11 +526,14 @@ public function unsuspend() $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri); + + return $body; } + /** * Generates a one-time token (OTT) that can be used to reset a user's password. The OTT link can be automatically emailed to the user or returned to the API caller and distributed using a custom flow. * @@ -511,11 +546,14 @@ public function resetPassword() $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri); + + return new \Okta\Users\ResetPasswordToken(null, $body); } + /** * This operation transitions the user to the status of `PASSWORD_EXPIRED` so that the user is required to change their password at their next login. * @@ -528,11 +566,14 @@ public function expirePassword($tempPassword = false) $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri, '', ['query' => ['tempPassword' => $tempPassword]]); + + return new \Okta\Users\TempPassword(null, $body); } + /** * Unlocks a user with a `LOCKED_OUT` status and returns them to `ACTIVE` status. Users will be able to login with their current password. * @@ -545,11 +586,14 @@ public function unlock() $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri); + + return $body; } + /** * This operation resets all factors for the specified user. All MFA factor enrollments returned to the unenrolled state. The user's status remains ACTIVE. This link is present only if the user is currently enrolled in one or more MFA factors. * @@ -562,11 +606,14 @@ public function resetFactors() $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri); + + return $body; } + /** * Adds a [user](users.html#user-model) to a group with `OKTA_GROUP` type. * @@ -579,11 +626,14 @@ public function addToGroup($groupId) $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('PUT', $uri); + + return $body; } + /** * Enrolls a user with a supported [factor](#list-factors-to-enroll) * @@ -596,9 +646,12 @@ public function addFactor(Factor $factor, $updatePhone = false) $uri = $this->getDataStore()->buildUri( $this->getDataStore()->getOrganizationUrl() . $uri ); - return $this + $body = $this ->getDataStore() ->executeRequest('POST', $uri, $factor, ['query' => ['updatePhone' => $updatePhone]]); + + $response = new \Okta\UserFactors\Factor(null, $body); + return $response->convertFromGenericFactor(); } /** @@ -658,6 +711,7 @@ public function getSupportedSecurityQuestions(array $options = []): \Okta\UserFa ); } + /** * Fetches a factor for the specified user * @@ -668,12 +722,13 @@ public function getFactor($factorId) { $uri = "/api/v1/users/{$this->getId()}/factors/{$factorId}"; $uri = $this->getDataStore()->buildUri( - $this->getDataStore()->getOrganizationUrl() . $uri + $this->getDataStore()->getOrganizationUrl() . $uri ); - $response = $this - ->getDataStore() - ->getResource("factors/{$factorId}", \Okta\UserFactors\Factor::class, "/users/{$this->id}", []); + $body = $this + ->getDataStore() + ->executeRequest('GET', $uri); + $response = new \Okta\UserFactors\Factor(null, $body); return $response->convertFromGenericFactor(); } } diff --git a/src/Generated/Users/UserActivationToken.php b/src/Generated/Users/UserActivationToken.php index 08d8a7bcd5..098b7a1c52 100644 --- a/src/Generated/Users/UserActivationToken.php +++ b/src/Generated/Users/UserActivationToken.php @@ -23,6 +23,7 @@ class UserActivationToken extends \Okta\Resource\AbstractResource const ACTIVATION_URL = 'activationUrl'; const ACTIVATION_TOKEN = 'activationToken'; + /** * Get the activationUrl. * diff --git a/src/Generated/Users/UserCredentials.php b/src/Generated/Users/UserCredentials.php index 929b33feac..bb7af020d8 100644 --- a/src/Generated/Users/UserCredentials.php +++ b/src/Generated/Users/UserCredentials.php @@ -24,6 +24,7 @@ class UserCredentials extends \Okta\Resource\AbstractResource const PROVIDER = 'provider'; const RECOVERY_QUESTION = 'recovery_question'; + /** * Get the password. * @@ -44,7 +45,7 @@ public function getPassword(array $options = []): \Okta\Users\PasswordCredential * @param \Okta\Users\PasswordCredential $password The PasswordCredential instance. * @return self */ - public function setPassword(PasswordCredential $password) + public function setPassword(\Okta\Users\PasswordCredential $password) { $this->setResourceProperty( self::PASSWORD, @@ -73,7 +74,7 @@ public function getProvider(array $options = []): \Okta\Users\AuthenticationProv * @param \Okta\Users\AuthenticationProvider $provider The AuthenticationProvider instance. * @return self */ - public function setProvider(AuthenticationProvider $provider) + public function setProvider(\Okta\Users\AuthenticationProvider $provider) { $this->setResourceProperty( self::PROVIDER, @@ -102,7 +103,7 @@ public function getRecoveryQuestion(array $options = []): \Okta\Users\RecoveryQu * @param \Okta\Users\RecoveryQuestionCredential $recovery_question The RecoveryQuestionCredential instance. * @return self */ - public function setRecoveryQuestion(RecoveryQuestionCredential $recovery_question) + public function setRecoveryQuestion(\Okta\Users\RecoveryQuestionCredential $recovery_question) { $this->setResourceProperty( self::RECOVERY_QUESTION, diff --git a/src/Generated/Users/UserProfile.php b/src/Generated/Users/UserProfile.php index e3ec041c91..7eb577d104 100644 --- a/src/Generated/Users/UserProfile.php +++ b/src/Generated/Users/UserProfile.php @@ -27,6 +27,7 @@ class UserProfile extends \Okta\Resource\AbstractResource const MOBILE_PHONE = 'mobilePhone'; const SECOND_EMAIL = 'secondEmail'; + /** * Get the email. * diff --git a/tests/BaseUnitTestCase.php b/tests/BaseUnitTestCase.php index 6a481edbe6..8abba307fa 100644 --- a/tests/BaseUnitTestCase.php +++ b/tests/BaseUnitTestCase.php @@ -59,7 +59,6 @@ protected function getModelJson($model) if(is_readable($fileName = __DIR__ . "/models/{$model}")) { return (string) file_get_contents($fileName); } - return (string)$model; } } \ No newline at end of file diff --git a/tests/Unit/Applications/AppUserCredentialsTest.php b/tests/Unit/Applications/AppUserCredentialsTest.php new file mode 100644 index 0000000000..acee06d418 --- /dev/null +++ b/tests/Unit/Applications/AppUserCredentialsTest.php @@ -0,0 +1,69 @@ +assertInstanceOf(\Okta\Applications\AppUserPasswordCredential::class, $this->testable->getPassword()); + $this->assertInstanceOf(\Okta\Applications\AppUserPasswordCredential::class, $this->testable->password); + } + + /** @test */ + public function password_is_settable() + { + $password = $this->testable->getPassword(); + $password->value = '123abc'; + $this->testable->setPassword($password); + $this->assertEquals('123abc', $this->testable->getPassword()->value); + + $password->value = '789xyz'; + $this->testable->password = $password; + $this->assertEquals('789xyz', $this->testable->getPassword()->value); + } + + /** @test */ + public function user_name_is_accessible() + { + $this->assertEquals($this->properties->userName, $this->testable->getUserName()); + $this->assertEquals($this->properties->userName, $this->testable->userName); + } + + /** @test */ + public function user_name_is_settable() + { + $this->testable->setUserName('abc'); + $this->assertEquals('abc', $this->testable->getUserName()); + + $this->testable->userName = 'xyz'; + $this->assertEquals('xyz', $this->testable->getUserName()); + } + + +} diff --git a/tests/Unit/Applications/AppUserPasswordCredentialTest.php b/tests/Unit/Applications/AppUserPasswordCredentialTest.php new file mode 100644 index 0000000000..3928b816e7 --- /dev/null +++ b/tests/Unit/Applications/AppUserPasswordCredentialTest.php @@ -0,0 +1,48 @@ +assertEquals($this->properties->value, $this->testable->getValue()); + $this->assertEquals($this->properties->value, $this->testable->value); + } + + /** @test */ + public function value_is_settable() + { + $this->testable->setValue('xyz'); + $this->assertEquals('xyz', $this->testable->getValue()); + + $this->testable->value = '123'; + $this->assertEquals('123', $this->testable->getValue()); + } + +} diff --git a/tests/Unit/Applications/AppUserTest.php b/tests/Unit/Applications/AppUserTest.php new file mode 100644 index 0000000000..d0406c6bff --- /dev/null +++ b/tests/Unit/Applications/AppUserTest.php @@ -0,0 +1,176 @@ +assertEquals($this->properties->id, $this->testable->getId()); + $this->assertEquals($this->properties->id, $this->testable->id); + } + + /** @test */ + public function id_is_settable() + { + $this->testable->setId('abc'); + $this->assertEquals('abc', $this->testable->getId()); + + $this->testable->id = '123'; + $this->assertEquals('123', $this->testable->getId()); + } + + /** @test */ + public function scope_is_accessible() + { + $this->assertEquals($this->properties->scope, $this->testable->getScope()); + $this->assertEquals($this->properties->scope, $this->testable->scope); + } + + /** @test */ + public function scope_is_settable() + { + $this->testable->setScope('USER'); + $this->assertEquals('USER', $this->testable->getScope()); + + $this->testable->scope = 'GROUP'; + $this->assertEquals('GROUP', $this->testable->getScope()); + } + + /** @test */ + public function links_is_accessible() + { + $this->assertEquals($this->properties->_links, $this->testable->getLinks()); + $this->assertEquals($this->properties->_links, $this->testable->links); + } + + /** @test */ + public function status_is_accessible() + { + $this->assertEquals($this->properties->status, $this->testable->getStatus()); + $this->assertEquals($this->properties->status, $this->testable->status); + } + + /** @test */ + public function created_is_accessible() + { + $ts = Carbon::parse($this->properties->created)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->created); + $this->assertEquals($ts, $this->testable->getCreated()->timestamp); + $this->assertEquals($ts, $this->testable->created->timestamp); + } + + /** @test */ + public function profile_is_accessible() + { + $this->assertEquals($this->properties->profile, $this->testable->getProfile()); + $this->assertEquals($this->properties->profile, $this->testable->profile); + } + + /** @test */ + public function last_sync_is_accessible() + { + $ts = Carbon::parse($this->properties->lastSync)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->lastSync); + $this->assertEquals($ts, $this->testable->getLastSync()->timestamp); + $this->assertEquals($ts, $this->testable->lastSync->timestamp); + } + + /** @test */ + public function embedded_is_accessible() + { + $this->assertEquals($this->properties->_embedded, $this->testable->getEmbedded()); + $this->assertEquals($this->properties->_embedded, $this->testable->embedded); + } + + /** @test */ + public function sync_state_is_accessible() + { + $this->assertEquals($this->properties->syncState, $this->testable->getSyncState()); + $this->assertEquals($this->properties->syncState, $this->testable->syncState); + } + + /** @test */ + public function external_id_is_accessible() + { + $this->assertEquals($this->properties->externalId, $this->testable->getExternalId()); + $this->assertEquals($this->properties->externalId, $this->testable->externalId); + } + + /** @test */ + public function credentials_is_accessible() + { + $this->assertInstanceOf(\Okta\Applications\AppUserCredentials::class, $this->testable->getCredentials()); + $this->assertInstanceOf(\Okta\Applications\AppUserCredentials::class, $this->testable->credentials); + } + + /** @test */ + public function credentials_is_settable() + { + $credentials = $this->testable->getCredentials(); + $credentials->username = "username"; + $this->testable->setCredentials($credentials); + $this->assertEquals('username', $this->testable->getCredentials()->username); + + $credentials->username = "login"; + $this->testable->credentials = $credentials; + $this->assertEquals('login', $this->testable->getCredentials()->username); + } + + /** @test */ + public function last_updated_is_accessible() + { + $ts = Carbon::parse($this->properties->lastUpdated)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->lastUpdated); + $this->assertEquals($ts, $this->testable->getLastUpdated()->timestamp); + $this->assertEquals($ts, $this->testable->lastUpdated->timestamp); + } + + /** @test */ + public function status_changed_is_accessible() + { + $ts = Carbon::parse($this->properties->statusChanged)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->statusChanged); + $this->assertEquals($ts, $this->testable->getStatusChanged()->timestamp); + $this->assertEquals($ts, $this->testable->statusChanged->timestamp); + } + + /** @test */ + public function password_changed_is_accessible() + { + $ts = Carbon::parse($this->properties->passwordChanged)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->passwordChanged); + $this->assertEquals($ts, $this->testable->getPasswordChanged()->timestamp); + $this->assertEquals($ts, $this->testable->passwordChanged->timestamp); + } + + + + +} diff --git a/tests/Unit/Applications/ApplicationAccessibilityTest.php b/tests/Unit/Applications/ApplicationAccessibilityTest.php new file mode 100644 index 0000000000..d19797a3da --- /dev/null +++ b/tests/Unit/Applications/ApplicationAccessibilityTest.php @@ -0,0 +1,89 @@ +assertEquals($this->properties->selfService, $this->testable->getSelfService()); + $this->assertEquals($this->properties->selfService, $this->testable->selfService); + } + + /** @test */ + public function self_service_is_settable() + { + $this->testable->setSelfService(true); + $this->assertEquals(true, $this->testable->getSelfService()); + + $this->testable->selfService = false; + $this->assertEquals(false, $this->testable->getSelfService()); + } + + /** @test */ + public function error_redirect_url_is_accessible() + { + $this->assertEquals($this->properties->errorRedirectUrl, $this->testable->getErrorRedirectUrl()); + $this->assertEquals($this->properties->errorRedirectUrl, $this->testable->errorRedirectUrl); + } + + /** @test */ + public function error_redirect_url_is_settable() + { + $this->testable->setErrorRedirectUrl('http://example.com'); + $this->assertEquals('http://example.com', $this->testable->getErrorRedirectUrl()); + + $this->testable->errorRedirectUrl = 'http://example.net'; + $this->assertEquals('http://example.net', $this->testable->getErrorRedirectUrl()); + } + + /** @test */ + public function login_redirect_url_is_accessible() + { + $this->assertEquals($this->properties->loginRedirectUrl, $this->testable->getLoginRedirectUrl()); + $this->assertEquals($this->properties->loginRedirectUrl, $this->testable->loginRedirectUrl); + } + + /** @test */ + public function login_redirect_url_is_settable() + { + $this->testable->setLoginRedirectUrl('http://test.com'); + $this->assertEquals('http://test.com', $this->testable->getLoginRedirectUrl()); + + $this->testable->loginRedirectUrl = 'http://example.com'; + $this->assertEquals('http://example.com', $this->testable->getLoginRedirectUrl()); + } + +} \ No newline at end of file diff --git a/tests/Unit/Applications/ApplicationCredentialsOAuthClientTest.php b/tests/Unit/Applications/ApplicationCredentialsOAuthClientTest.php new file mode 100644 index 0000000000..dd724421f5 --- /dev/null +++ b/tests/Unit/Applications/ApplicationCredentialsOAuthClientTest.php @@ -0,0 +1,105 @@ +assertEquals($this->properties->client_id, $this->testable->getClientId()); + $this->assertEquals($this->properties->client_id, $this->testable->clientId); + } + + /** @test */ + public function client_id_is_settable() + { + $this->testable->setClientId('abc'); + $this->assertEquals('abc', $this->testable->getClientId()); + + $this->testable->clientId = '123'; + $this->assertEquals('123', $this->testable->getClientId()); + } + + /** @test */ + public function client_secret_is_accessible() + { + $this->assertEquals($this->properties->client_secret, $this->testable->getClientSecret()); + $this->assertEquals($this->properties->client_secret, $this->testable->clientSecret); + } + + /** @test */ + public function client_secret_is_settable() + { + $this->testable->setClientSecret('abc'); + $this->assertEquals('abc', $this->testable->getClientSecret()); + + $this->testable->clientSecret = '123'; + $this->assertEquals('123', $this->testable->getClientSecret()); + } + + /** @test */ + public function auto_key_rotation_is_accessible() + { + $this->assertEquals($this->properties->autoKeyRotation, $this->testable->getAutoKeyRotation()); + $this->assertEquals($this->properties->autoKeyRotation, $this->testable->autoKeyRotation); + } + + /** @test */ + public function auto_key_rotation_is_settable() + { + $this->testable->setAutoKeyRotation(true); + $this->assertEquals(true, $this->testable->getAutoKeyRotation()); + + $this->testable->autoKeyRotation = false; + $this->assertEquals(false, $this->testable->getAutoKeyRotation()); + } + + /** @test */ + public function token_endpoint_auth_method_is_accessible() + { + $this->assertEquals($this->properties->token_endpoint_auth_method, $this->testable->getTokenEndpointAuthMethod()); + $this->assertEquals($this->properties->token_endpoint_auth_method, $this->testable->tokenEndpointAuthMethod); + } + + /** @test */ + public function token_endpoint_auth_method_is_settable() + { + $this->testable->setTokenEndpointAuthMethod('client_credentials'); + $this->assertEquals('client_credentials', $this->testable->getTokenEndpointAuthMethod()); + + $this->testable->tokenEndpointAuthMethod = 'another_method'; + $this->assertEquals('another_method', $this->testable->getTokenEndpointAuthMethod()); + } + + +} diff --git a/tests/Unit/Applications/ApplicationCredentialsSigningTest.php b/tests/Unit/Applications/ApplicationCredentialsSigningTest.php new file mode 100644 index 0000000000..e65d46dd81 --- /dev/null +++ b/tests/Unit/Applications/ApplicationCredentialsSigningTest.php @@ -0,0 +1,89 @@ +assertEquals($this->properties->kid, $this->testable->getKid()); + $this->assertEquals($this->properties->kid, $this->testable->kid); + } + + /** @test */ + public function kid_is_settable() + { + $this->testable->setKid('abc'); + $this->assertEquals('abc', $this->testable->getKid()); + + $this->testable->kid = '123'; + $this->assertEquals('123', $this->testable->getKid()); + } + + /** @test */ + public function last_rotated_is_accessible() + { + $ts = Carbon::parse($this->properties->lastRotated)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->lastRotated); + $this->assertEquals($ts, $this->testable->getLastRotated()->timestamp); + $this->assertEquals($ts, $this->testable->lastRotated->timestamp); + } + + /** @test */ + public function next_Rotation_is_accessible() + { + $ts = Carbon::parse($this->properties->nextRotation)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->nextRotation); + $this->assertEquals($ts, $this->testable->getNextRotation()->timestamp); + $this->assertEquals($ts, $this->testable->nextRotation->timestamp); + } + + /** @test */ + public function rotation_mode_is_accessible() + { + $this->assertEquals($this->properties->rotationMode, $this->testable->getRotationMode()); + $this->assertEquals($this->properties->rotationMode, $this->testable->rotationMode); + } + + /** @test */ + public function rotation_mode_is_settable() + { + $this->testable->setRotationMode('example'); + $this->assertEquals('example', $this->testable->getRotationMode()); + + $this->testable->rotationMode = 'something'; + $this->assertEquals('something', $this->testable->getRotationMode()); + } + +} diff --git a/tests/Unit/Applications/ApplicationCredentialsTest.php b/tests/Unit/Applications/ApplicationCredentialsTest.php new file mode 100644 index 0000000000..96fa684072 --- /dev/null +++ b/tests/Unit/Applications/ApplicationCredentialsTest.php @@ -0,0 +1,93 @@ +assertInstanceOf(\Okta\Applications\ApplicationCredentialsSigning::class, $this->testable->getSigning()); + $this->assertInstanceOf(\Okta\Applications\ApplicationCredentialsSigning::class, $this->testable->signing); + } + + /** @test */ + public function signing_is_settable() + { + $signing1 = $this->testable->getSigning(); + $signing2 = $this->testable->getSigning(); + + $signing1->setKid('abc'); + $signing2->setKid('123'); + + $this->testable->setSigning($signing1); + $this->assertEquals('abc', $this->testable->getSigning()->kid); + + $this->testable->signing = $signing2; + $this->assertEquals('123', $this->testable->getSigning()->kid); + } + + /** @test */ + public function user_name_template_is_accessible() + { + $this->assertInstanceOf(\Okta\Applications\ApplicationCredentialsUsernameTemplate::class, + $this->testable->getUserNameTemplate()); + $this->assertInstanceOf(\Okta\Applications\ApplicationCredentialsUsernameTemplate::class, + $this->testable->userNameTemplate); + } + + /** @test */ + public function user_name_template_is_settable() + { + $userNameTemplate1 = $this->testable->getUserNameTemplate(); + $userNameTemplate2 = $this->testable->getUserNameTemplate(); + + $userNameTemplate1->setTemplate('${source.email}'); + $userNameTemplate2->setTemplate('${source.username}'); + + $this->testable->setUserNameTemplate($userNameTemplate1); + $this->assertEquals('${source.email}', $this->testable->getUserNameTemplate()->template); + + $this->testable->userNameTemplate = $userNameTemplate2; + $this->assertEquals('${source.username}', $this->testable->getUserNameTemplate()->template); + } + + +} \ No newline at end of file diff --git a/tests/Unit/Applications/ApplicationCredentialsUsernameTemplateTest.php b/tests/Unit/Applications/ApplicationCredentialsUsernameTemplateTest.php new file mode 100644 index 0000000000..5ab7bfd66c --- /dev/null +++ b/tests/Unit/Applications/ApplicationCredentialsUsernameTemplateTest.php @@ -0,0 +1,89 @@ +assertEquals($this->properties->type, $this->testable->getType()); + $this->assertEquals($this->properties->type, $this->testable->type); + } + + /** @test */ + public function type_is_settable() + { + $this->testable->setType("NONE"); + $this->assertEquals("NONE", $this->testable->getType()); + + $this->testable->type = "CUSTOM"; + $this->assertEquals("CUSTOM", $this->testable->getType()); + } + + /** @test */ + public function suffix_is_accessible() + { + $this->assertEquals($this->properties->suffix, $this->testable->getSuffix()); + $this->assertEquals($this->properties->suffix, $this->testable->suffix); + } + + /** @test */ + public function suffix_is_settable() + { + $this->testable->setSuffix('sample'); + $this->assertEquals('sample', $this->testable->getSuffix()); + + $this->testable->suffix = 'demo'; + $this->assertEquals('demo', $this->testable->getSuffix()); + } + + /** @test */ + public function template_is_accessible() + { + $this->assertEquals($this->properties->template, $this->testable->getTemplate()); + $this->assertEquals($this->properties->template, $this->testable->template); + } + + /** @test */ + public function template_is_settable() + { + $this->testable->setTemplate('${source.username}'); + $this->assertEquals('${source.username}', $this->testable->getTemplate()); + + $this->testable->template = '${source.email}'; + $this->assertEquals('${source.email}', $this->testable->getTemplate()); + } + + + + +} diff --git a/tests/Unit/Applications/ApplicationGroupAssignmentTest.php b/tests/Unit/Applications/ApplicationGroupAssignmentTest.php new file mode 100644 index 0000000000..9b1266a2f1 --- /dev/null +++ b/tests/Unit/Applications/ApplicationGroupAssignmentTest.php @@ -0,0 +1,104 @@ +assertEquals($this->properties->id, $this->testable->getId()); + $this->assertEquals($this->properties->id, $this->testable->id); + } + + /** @test */ + public function links_is_accessible() + { + $this->assertEquals($this->properties->_links, $this->testable->getLinks()); + $this->assertEquals($this->properties->_links, $this->testable->links); + } + + /** @test */ + public function profile_is_accessible() + { + $this->assertEquals($this->properties->profile, $this->testable->getProfile()); + $this->assertEquals($this->properties->profile, $this->testable->profile); + } + + /** @test */ + public function profile_is_settable() + { + $profile = $this->testable->getProfile(); + + $profile->email = 'email1@mailinator.com'; + + $this->testable->setProfile($profile); + $this->assertEquals('email1@mailinator.com', $this->testable->getProfile()->email); + + $this->testable->profile = $profile; + + $profile->email = 'email2@mailinator.com'; + + $this->assertEquals('email2@mailinator.com', $this->testable->getProfile()->email); + } + + /** @test */ + public function priority_is_accessible() + { + $this->assertEquals($this->properties->priority, $this->testable->getPriority()); + $this->assertEquals($this->properties->priority, $this->testable->priority); + } + + /** @test */ + public function priority_is_settable() + { + $this->testable->setPriority(1); + $this->assertEquals(1, $this->testable->getPriority()); + + $this->testable->priority = 2; + $this->assertEquals(2, $this->testable->getPriority()); + } + + /** @test */ + public function embedded_is_accessible() + { + $this->assertEquals($this->properties->_embedded, $this->testable->getEmbedded()); + $this->assertEquals($this->properties->_embedded, $this->testable->embedded); + } + + /** @test */ + public function last_updated_is_accessible() + { + $ts = Carbon::parse($this->properties->lastUpdated)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->lastUpdated); + $this->assertEquals($ts, $this->testable->getLastUpdated()->timestamp); + $this->assertEquals($ts, $this->testable->lastUpdated->timestamp); + } + + +} diff --git a/tests/Unit/Applications/ApplicationLicensingTest.php b/tests/Unit/Applications/ApplicationLicensingTest.php new file mode 100644 index 0000000000..cbe4154d97 --- /dev/null +++ b/tests/Unit/Applications/ApplicationLicensingTest.php @@ -0,0 +1,48 @@ +assertEquals($this->properties->seatCount, $this->testable->getSeatCount()); + $this->assertEquals($this->properties->seatCount, $this->testable->seatCount); + } + + /** @test */ + public function seat_count_is_settable() + { + $this->testable->setSeatCount(5); + $this->assertEquals(5, $this->testable->getSeatCount()); + + $this->testable->seatCount = 10; + $this->assertEquals(10, $this->testable->getSeatCount()); + } + +} diff --git a/tests/Unit/Applications/ApplicationSettingsNotificationsTest.php b/tests/Unit/Applications/ApplicationSettingsNotificationsTest.php new file mode 100644 index 0000000000..8840fe47bd --- /dev/null +++ b/tests/Unit/Applications/ApplicationSettingsNotificationsTest.php @@ -0,0 +1,52 @@ +assertInstanceOf(\Okta\Applications\ApplicationSettingsNotificationsVpn::class, $this->testable->getVpn()); + $this->assertInstanceOf(\Okta\Applications\ApplicationSettingsNotificationsVpn::class, $this->testable->vpn); + } + + /** @test */ + public function vpn_is_settable() + { + $vpn = $this->testable->getVpn(); + $vpn->message = "test"; + $this->testable->setVpn($vpn); + $this->assertEquals("test", $this->testable->getVpn()->message); + + $vpn->message = "this"; + $this->testable->vpn = $vpn; + $this->assertEquals("this", $this->testable->getVpn()->message); + } + + +} diff --git a/tests/Unit/Applications/ApplicationSettingsNotificationsVpnNetworkTest.php b/tests/Unit/Applications/ApplicationSettingsNotificationsVpnNetworkTest.php new file mode 100644 index 0000000000..3702da9e3e --- /dev/null +++ b/tests/Unit/Applications/ApplicationSettingsNotificationsVpnNetworkTest.php @@ -0,0 +1,86 @@ +assertEquals($this->properties->exclude, $this->testable->getExclude()); + $this->assertEquals($this->properties->exclude, $this->testable->exclude); + } + + /** @test */ + public function exclude_is_settable() + { + $this->testable->setExclude(["test"=>"this"]); + $this->assertEquals(["test"=>"this"], $this->testable->getExclude()); + + $this->testable->exclude = ["test"=>"that"]; + $this->assertEquals(["test"=>"that"], $this->testable->getExclude()); + } + + /** @test */ + public function include_is_accessible() + { + $this->assertEquals($this->properties->include, $this->testable->getInclude()); + $this->assertEquals($this->properties->include, $this->testable->include); + } + + /** @test */ + public function include_is_settable() + { + $this->testable->setInclude(['test'=>'this']); + $this->assertEquals(['test'=>'this'], $this->testable->getInclude()); + + $this->testable->include = ['test'=>'that']; + $this->assertEquals(['test'=>'that'], $this->testable->getInclude()); + } + + /** @test */ + public function connection_is_accessible() + { + $this->assertEquals($this->properties->connection, $this->testable->getConnection()); + $this->assertEquals($this->properties->connection, $this->testable->connection); + } + + /** @test */ + public function connection_is_settable() + { + $this->testable->setConnection('ANYWHERE'); + $this->assertEquals('ANYWHERE', $this->testable->getConnection()); + + $this->testable->connection = 'ON_NETWORK'; + $this->assertEquals('ON_NETWORK', $this->testable->getConnection()); + } + +} diff --git a/tests/Unit/Applications/ApplicationSettingsNotificationsVpnTest.php b/tests/Unit/Applications/ApplicationSettingsNotificationsVpnTest.php new file mode 100644 index 0000000000..97055bf502 --- /dev/null +++ b/tests/Unit/Applications/ApplicationSettingsNotificationsVpnTest.php @@ -0,0 +1,90 @@ +assertEquals($this->properties->helpUrl, $this->testable->getHelpUrl()); + $this->assertEquals($this->properties->helpUrl, $this->testable->helpUrl); + } + + /** @test */ + public function help_url_is_settable() + { + $this->testable->setHelpUrl('http://example.com'); + $this->assertEquals('http://example.com', $this->testable->getHelpUrl()); + + $this->testable->helpUrl = 'http://example.org'; + $this->assertEquals('http://example.org', $this->testable->getHelpUrl()); + } + + /** @test */ + public function message_is_accessible() + { + $this->assertEquals($this->properties->message, $this->testable->getMessage()); + $this->assertEquals($this->properties->message, $this->testable->message); + } + + /** @test */ + public function message_is_settable() + { + $this->testable->setMessage('message1'); + $this->assertEquals('message1', $this->testable->getMessage()); + + $this->testable->message = 'message2'; + $this->assertEquals('message2', $this->testable->getMessage()); + } + + /** @test */ + public function network_is_accessible() + { + $this->assertInstanceOf(ApplicationSettingsNotificationsVpnNetwork::class, $this->testable->getNetwork()); + $this->assertInstanceOf(ApplicationSettingsNotificationsVpnNetwork::class, $this->testable->network); + } + + /** @test */ + public function network_is_settable() + { + $network = $this->testable->getNetwork(); + $network->setConnection('ENABLED'); + $this->testable->setNetwork($network); + $this->assertEquals('ENABLED', $this->testable->getNetwork()->getConnection()); + + $network->setConnection('PENDING'); + $this->testable->network = $network; + $this->assertEquals('PENDING', $this->testable->getNetwork()->getConnection()); + } + + +} diff --git a/tests/Unit/Applications/ApplicationSettingsTest.php b/tests/Unit/Applications/ApplicationSettingsTest.php new file mode 100644 index 0000000000..47d9159f7e --- /dev/null +++ b/tests/Unit/Applications/ApplicationSettingsTest.php @@ -0,0 +1,78 @@ +assertInstanceOf(\Okta\Applications\ApplicationSettingsApplication::class, $this->testable->getApp()); + $this->assertInstanceOf(\Okta\Applications\ApplicationSettingsApplication::class, $this->testable->app); + } + + /** @test */ + public function app_is_settable() + { + $app = $this->testable->getApp(); + $app->test = 'this'; + $this->testable->setApp($app); + $this->assertEquals('this', $this->testable->getApp()->test); + + $app = $this->testable->getApp(); + $app->test = 'that'; + $this->testable->app = $app; + $this->assertEquals('that', $this->testable->getApp()->test); + } + + /** @test */ + public function notifications_is_accessible() + { + $this->assertInstanceOf(\Okta\Applications\ApplicationSettingsNotifications::class, + $this->testable->getNotifications()); + $this->assertInstanceOf(\Okta\Applications\ApplicationSettingsNotifications::class, $this->testable->notifications); + } + + /** @test */ + public function notifications_is_settable() + { + $notifications = $this->testable->getNotifications(); + $notifications->test = 'this'; + $this->testable->setNotifications($notifications); + $this->assertEquals('this', $this->testable->getNotifications()->test); + + $notifications = $this->testable->getNotifications(); + $notifications->test = 'that'; + $this->testable->notifications = $notifications; + $this->assertEquals('that', $this->testable->getNotifications()->test); + } + + +} diff --git a/tests/Unit/Applications/ApplicationTest.php b/tests/Unit/Applications/ApplicationTest.php index b7c029c081..44037638cd 100644 --- a/tests/Unit/Applications/ApplicationTest.php +++ b/tests/Unit/Applications/ApplicationTest.php @@ -406,6 +406,189 @@ public function assign_user_to_application_makes_request_to_correct_endpoint() $this->assertInstanceOf(\Okta\Applications\AppUser::class, $appUser); } + /** @test */ + public function get_application_user_makes_request_to_correct_endpoint() + { + + $httpClient = $this->createNewHttpClient([ + "getBody" => '{"id":"abc123"}' + ]); + + $app = $this->createModel($this->model, $this->modelType); + + $appUser = $app->getApplicationUser('abc123'); + + $request = $httpClient->getRequests(); + + $this->assertEquals('GET', $request[0]->getMethod()); + $this->assertEquals( + "/api/v1/apps/{$this->testable->getId()}/users/abc123", + $request[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\AppUser::class, $appUser); + } + + /** @test */ + public function get_application_group_assignment_makes_request_to_correct_endpoint() + { + $httpClient = $this->createNewHttpClient([ + "getBody" => '{"id":"abc123"}' + ]); + + $app = $this->createModel($this->model, $this->modelType); + + $groupAssignment = $app->getApplicationGroupAssignment('abc123'); + + $request = $httpClient->getRequests(); + + $this->assertEquals('GET', $request[0]->getMethod()); + $this->assertEquals( + "/api/v1/apps/{$this->testable->getId()}/groups/abc123", + $request[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\ApplicationGroupAssignment::class, $groupAssignment); + } + + /** @test */ + public function generate_application_key_makes_request_to_correct_endpoint() + { + + $httpClient = $this->createNewHttpClient([ + "getBody" => '{"created":"2015-12-10T18:56:23.000Z","expiresAt":"2017-12-10T18:56:22.000Z","x5c":["MIIDqDCCApCg"],"e":"AQAB","n":"mkC6yAJVvFwUlm","kid":"SIMcCQNY3uw","kty":"RSA","use":"sig","x5t#S256":"5GOpy9CQVt"}' + ]); + + $app = $this->createModel($this->model, $this->modelType); + + $key = $app->generateApplicationKey(); + + $request = $httpClient->getRequests(); + + $this->assertEquals('POST', $request[0]->getMethod()); + $this->assertEquals( + "/api/v1/apps/{$this->testable->getId()}/credentials/keys/generate", + $request[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\JsonWebKey::class, $key); + + } + + /** @test */ + public function clone_application_key_makes_request_to_correct_endpoint() + { + + $httpClient = $this->createNewHttpClient([ + "getBody" => '{"created":"2015-12-10T18:56:23.000Z","expiresAt":"2017-12-10T18:56:22.000Z","x5c":["MIIDqDCCApCg"],"e":"AQAB","n":"mkC6yAJVvFwUlm","kid":"SIMcCQNY3uw","kty":"RSA","use":"sig","x5t#S256":"5GOpy9CQVt"}' + ]); + + $app = $this->createModel($this->model, $this->modelType); + + $key = $app->cloneApplicationKey('abc123'); + + $request = $httpClient->getRequests(); + + $this->assertEquals('POST', $request[0]->getMethod()); + $this->assertEquals( + "/api/v1/apps/{$this->testable->getId()}/credentials/keys/abc123/clone", + $request[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\JsonWebKey::class, $key); + } + + /** @test */ + public function get_application_key_makes_request_to_correct_endpoint() + { + $httpClient = $this->createNewHttpClient([ + "getBody" => '{"created":"2015-12-10T18:56:23.000Z","expiresAt":"2017-12-10T18:56:22.000Z","x5c":["MIIDqDCCApCg"],"e":"AQAB","n":"mkC6yAJVvFwUlm","kid":"SIMcCQNY3uw","kty":"RSA","use":"sig","x5t#S256":"5GOpy9CQVt"}' + ]); + + $app = $this->createModel($this->model, $this->modelType); + + $key = $app->getApplicationKey('abc123'); + + $request = $httpClient->getRequests(); + + $this->assertEquals('GET', $request[0]->getMethod()); + $this->assertEquals( + "/api/v1/apps/{$this->testable->getId()}/credentials/keys/abc123", + $request[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\JsonWebKey::class, $key); + } + + /** @test */ + public function create_application_group_assignment_makes_request_to_correct_endpoint() + { + $httpClient = $this->createNewHttpClient([ + "getBody" => '{"id": "abc123"}' + ]); + + $app = $this->createModel($this->model, $this->modelType); + $appGroupAssignment = new \Okta\Applications\ApplicationGroupAssignment(); + + $applicationGroupAssignment = $app->createApplicationGroupAssignment('xyz789', $appGroupAssignment); + + $request = $httpClient->getRequests(); + + $this->assertEquals('PUT', $request[0]->getMethod()); + $this->assertEquals( + "/api/v1/apps/{$this->testable->getId()}/groups/xyz789", + $request[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\ApplicationGroupAssignment::class, $applicationGroupAssignment); + + } + + /** @test */ + public function get_group_assignments_makes_request_to_correct_endpoint() + { + $httpClient = $this->createNewHttpClient([ + "getBody" => '[{"id": "abc123"}]' + ]); + + $app = $this->createModel($this->model, $this->modelType); + + $groupAssignments = $app->getGroupAssignments(); + + $request = $httpClient->getRequests(); + + $this->assertEquals('GET', $request[0]->getMethod()); + $this->assertEquals( + "/api/v1/apps/{$this->testable->getId()}/groups", + $request[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\Collection::class, $groupAssignments); + $this->assertInstanceOf(\Okta\Applications\ApplicationGroupAssignment::class, $groupAssignments->first()); + } + + /** @test */ + public function get_keys_makes_request_to_correct_endpoint() + { + $httpClient = $this->createNewHttpClient([ + "getBody" => '[{"id": "abc123"}]' + ]); + + $app = $this->createModel($this->model, $this->modelType); + + $keys = $app->getKeys(); + + $request = $httpClient->getRequests(); + + $this->assertEquals('GET', $request[0]->getMethod()); + $this->assertEquals( + "/api/v1/apps/{$this->testable->getId()}/credentials/keys", + $request[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\Collection::class, $keys); + $this->assertInstanceOf(\Okta\Applications\JsonWebKey::class, $keys->first()); + } } diff --git a/tests/Unit/Applications/ApplicationVisibilityHideTest.php b/tests/Unit/Applications/ApplicationVisibilityHideTest.php new file mode 100644 index 0000000000..fc414d8265 --- /dev/null +++ b/tests/Unit/Applications/ApplicationVisibilityHideTest.php @@ -0,0 +1,63 @@ +assertEquals($this->properties->iOS, $this->testable->getIOs()); + } + + /** @test */ + public function ios_is_settable() + { + $this->testable->setIOs(true); + $this->assertEquals(true, $this->testable->getIOs()); + } + + /** @test */ + public function web_is_accessible() + { + $this->assertEquals($this->properties->web, $this->testable->getWeb()); + $this->assertEquals($this->properties->web, $this->testable->web); + } + + /** @test */ + public function web_is_settable() + { + $this->testable->setWeb(true); + $this->assertEquals(true, $this->testable->getWeb()); + + $this->testable->web = false; + $this->assertEquals(false, $this->testable->getWeb()); + } + +} diff --git a/tests/Unit/Applications/ApplicationVisibilityTest.php b/tests/Unit/Applications/ApplicationVisibilityTest.php new file mode 100644 index 0000000000..90a27d198b --- /dev/null +++ b/tests/Unit/Applications/ApplicationVisibilityTest.php @@ -0,0 +1,89 @@ +assertInstanceOf(\Okta\Applications\ApplicationVisibilityHide::class, $this->testable->getHide()); + $this->assertInstanceOf(\Okta\Applications\ApplicationVisibilityHide::class, $this->testable->hide); + } + + /** @test */ + public function hide_is_settable() + { + $hide = $this->testable->getHide(); + $hide->web = true; + $this->testable->setHide($hide); + $this->assertTrue($this->testable->getHide()->web); + + $hide->web = false; + $this->testable->hide = $hide; + $this->assertFalse($this->testable->getHide()->web); + } + + /** @test */ + public function app_links_is_accessible() + { + $this->assertEquals($this->properties->appLinks, $this->testable->getAppLinks()); + $this->assertEquals($this->properties->appLinks, $this->testable->appLinks); + } + + /** @test */ + public function app_links_is_settable() + { + $links = $this->testable->getAppLinks(); + $links->login = false; + $this->testable->setAppLinks($links); + $this->assertFalse($this->testable->getAppLinks()->login); + + $links->login = true; + $this->testable->appLinks = $links; + $this->assertTrue($this->testable->getAppLinks()->login); + } + + /** @test */ + public function auto_submit_toolbar_is_accessible() + { + $this->assertEquals($this->properties->autoSubmitToolbar, $this->testable->getAutoSubmitToolbar()); + $this->assertEquals($this->properties->autoSubmitToolbar, $this->testable->autoSubmitToolbar); + } + + /** @test */ + public function auto_submit_toolbar_is_settable() + { + $this->testable->setAutoSubmitToolbar(true); + $this->assertEquals(true, $this->testable->getAutoSubmitToolbar()); + + $this->testable->autoSubmitToolbar = false; + $this->assertEquals(false, $this->testable->getAutoSubmitToolbar()); + } + + +} diff --git a/tests/Unit/Applications/AutoLoginApplicationSettingsSignOnTest.php b/tests/Unit/Applications/AutoLoginApplicationSettingsSignOnTest.php new file mode 100644 index 0000000000..4fc2cae6c1 --- /dev/null +++ b/tests/Unit/Applications/AutoLoginApplicationSettingsSignOnTest.php @@ -0,0 +1,69 @@ +assertEquals($this->properties->loginUrl, $this->testable->getLoginUrl()); + $this->assertEquals($this->properties->loginUrl, $this->testable->loginUrl); + } + + /** @test */ + public function login_url_is_settable() + { + $this->testable->setLoginUrl('http://example.com'); + $this->assertEquals('http://example.com', $this->testable->getLoginUrl()); + + $this->testable->loginUrl = 'http://example.org'; + $this->assertEquals('http://example.org', $this->testable->getLoginUrl()); + } + + /** @test */ + public function redirect_url_is_accessible() + { + $this->assertEquals($this->properties->redirectUrl, $this->testable->getRedirectUrl()); + $this->assertEquals($this->properties->redirectUrl, $this->testable->redirectUrl); + } + + /** @test */ + public function redirect_url_is_settable() + { + $this->testable->setRedirectUrl('http://example.com'); + $this->assertEquals('http://example.com', $this->testable->getRedirectUrl()); + + $this->testable->redirectUrl = 'http://example.org'; + $this->assertEquals('http://example.org', $this->testable->getRedirectUrl()); + } + + +} diff --git a/tests/Unit/Applications/AutoLoginApplicationSettingsTest.php b/tests/Unit/Applications/AutoLoginApplicationSettingsTest.php new file mode 100644 index 0000000000..85514fb4c0 --- /dev/null +++ b/tests/Unit/Applications/AutoLoginApplicationSettingsTest.php @@ -0,0 +1,58 @@ +assertInstanceOf(\Okta\Applications\AutoLoginApplicationSettingsSignOn::class, $this->testable->getSignOn()); + $this->assertInstanceOf(\Okta\Applications\AutoLoginApplicationSettingsSignOn::class, $this->testable->signOn); + } + + /** @test */ + public function sign_on_is_settable() + { + $signOn = $this->testable->getSignOn(); + $signOn->redirectUrl = 'http://example.com'; + $this->testable->setSignOn($signOn); + $this->assertEquals('http://example.com', $this->testable->getSignOn()->redirectUrl); + + + $signOn->redirectUrl = 'http://example.org'; + $this->testable->signOn = $signOn; + $this->assertEquals('http://example.org', $this->testable->getSignOn()->redirectUrl); + } + + +} diff --git a/tests/Unit/Applications/AutoLoginApplicationTest.php b/tests/Unit/Applications/AutoLoginApplicationTest.php new file mode 100644 index 0000000000..407349e5f6 --- /dev/null +++ b/tests/Unit/Applications/AutoLoginApplicationTest.php @@ -0,0 +1,73 @@ +assertInstanceOf(\Okta\Applications\AutoLoginApplicationSettings::class, $this->testable->getSettings()); + $this->assertInstanceOf(\Okta\Applications\AutoLoginApplicationSettings::class, $this->testable->settings); + } + + /** @test */ + public function settings_is_settable() + { + $settings = $this->testable->getSettings(); + + $settings->abc = '123'; + $this->testable->setSettings($settings); + $this->assertEquals('123', $this->testable->getSettings()->abc); + + $settings->abc = '456'; + $this->testable->settings = $settings; + $this->assertEquals('456', $this->testable->getSettings()->abc); + } + + /** @test */ + public function credentials_is_accessible() + { + $this->assertInstanceOf(\Okta\Applications\SchemeApplicationCredentials::class,$this->testable->getCredentials()); + $this->assertInstanceOf(\Okta\Applications\SchemeApplicationCredentials::class,$this->testable->credentials); + } + + /** @test */ + public function credentials_is_settable() + { + $credentials = $this->testable->getCredentials(); + + $credentials->abc = '123'; + $this->testable->setCredentials($credentials); + $this->assertEquals('123', $this->testable->getCredentials()->abc); + + $credentials->abc = '456'; + $this->testable->credentials = $credentials; + $this->assertEquals('456', $this->testable->getCredentials()->abc); + } + +} diff --git a/tests/Unit/Applications/BasicApplicationSettingsApplicationTest.php b/tests/Unit/Applications/BasicApplicationSettingsApplicationTest.php new file mode 100644 index 0000000000..831d5239c2 --- /dev/null +++ b/tests/Unit/Applications/BasicApplicationSettingsApplicationTest.php @@ -0,0 +1,68 @@ +assertEquals($this->properties->url, $this->testable->getUrl()); + $this->assertEquals($this->properties->url, $this->testable->url); + } + + /** @test */ + public function url_is_settable() + { + $this->testable->setUrl("http://example.com"); + $this->assertEquals("http://example.com", $this->testable->getUrl()); + + $this->testable->url = "http://example.org"; + $this->assertEquals("http://example.org", $this->testable->getUrl()); + } + + /** @test */ + public function auth_url_is_accessible() + { + $this->assertEquals($this->properties->authURL, $this->testable->getAuthUrl()); + $this->assertEquals($this->properties->authURL, $this->testable->authUrl); + } + + /** @test */ + public function auth_url_is_settable() + { + $this->testable->setAuthUrl("http://example.com"); + $this->assertEquals("http://example.com", $this->testable->getAuthUrl()); + + $this->testable->authUrl = "http://example.org"; + $this->assertEquals("http://example.org", $this->testable->getAuthUrl()); + } + +} diff --git a/tests/Unit/Applications/BasicApplicationSettingsTest.php b/tests/Unit/Applications/BasicApplicationSettingsTest.php new file mode 100644 index 0000000000..4c629a11d2 --- /dev/null +++ b/tests/Unit/Applications/BasicApplicationSettingsTest.php @@ -0,0 +1,54 @@ +assertInstanceOf(\Okta\Applications\BasicApplicationSettingsApplication::class, $this->testable->getApp()); + $this->assertInstanceOf(\Okta\Applications\BasicApplicationSettingsApplication::class, $this->testable->app); + } + + /** @test */ + public function app_is_settable() + { + $app = $this->testable->getApp(); + $app->url = "http://example.com"; + $this->testable->setApp($app); + $this->assertEquals("http://example.com", $this->testable->getApp()->url); + + $app->url = "http://example.org"; + $this->testable->app = $app; + $this->assertEquals("http://example.org", $this->testable->getApp()->url); + } + +} diff --git a/tests/Unit/Applications/BasicAuthApplicationTest.php b/tests/Unit/Applications/BasicAuthApplicationTest.php new file mode 100644 index 0000000000..403701de4a --- /dev/null +++ b/tests/Unit/Applications/BasicAuthApplicationTest.php @@ -0,0 +1,72 @@ +assertInstanceOf(\Okta\Applications\BasicApplicationSettings::class, $this->testable->getSettings()); + $this->assertInstanceOf(\Okta\Applications\BasicApplicationSettings::class, $this->testable->settings); + } + + /** @test */ + public function settings_is_settable() + { + $settings = $this->testable->getSettings(); + + $settings->abc = '123'; + $this->testable->setSettings($settings); + $this->assertEquals('123', $this->testable->getSettings()->abc); + + $settings->abc = '456'; + $this->testable->settings = $settings; + $this->assertEquals('456', $this->testable->getSettings()->abc); + } + + /** @test */ + public function credentials_is_accessible() + { + $this->assertInstanceOf(\Okta\Applications\SchemeApplicationCredentials::class,$this->testable->getCredentials()); + $this->assertInstanceOf(\Okta\Applications\SchemeApplicationCredentials::class,$this->testable->credentials); + } + + /** @test */ + public function credentials_is_settable() + { + $credentials = $this->testable->getCredentials(); + + $credentials->abc = '123'; + $this->testable->setCredentials($credentials); + $this->assertEquals('123', $this->testable->getCredentials()->abc); + + $credentials->abc = '456'; + $this->testable->credentials = $credentials; + $this->assertEquals('456', $this->testable->getCredentials()->abc); + } +} diff --git a/tests/Unit/Applications/BookmarkApplicationSettingsApplicationTest.php b/tests/Unit/Applications/BookmarkApplicationSettingsApplicationTest.php new file mode 100644 index 0000000000..68636e5274 --- /dev/null +++ b/tests/Unit/Applications/BookmarkApplicationSettingsApplicationTest.php @@ -0,0 +1,69 @@ +assertEquals($this->properties->url, $this->testable->getUrl()); + $this->assertEquals($this->properties->url, $this->testable->url); + } + + /** @test */ + public function url_is_settable() + { + $this->testable->setUrl("http://example.com"); + $this->assertEquals("http://example.com", $this->testable->getUrl()); + + $this->testable->url = "http://example.org"; + $this->assertEquals("http://example.org", $this->testable->getUrl()); + } + + /** @test */ + public function request_integration_is_accessible() + { + $this->assertEquals($this->properties->requestIntegration, $this->testable->getRequestIntegration()); + $this->assertEquals($this->properties->requestIntegration, $this->testable->requestIntegration); + } + + /** @test */ + public function request_integration_is_settable() + { + $this->testable->setRequestIntegration(false); + $this->assertEquals(false, $this->testable->getRequestIntegration()); + + $this->testable->requestIntegration = true; + $this->assertEquals(true, $this->testable->getRequestIntegration()); + } + + +} diff --git a/tests/Unit/Applications/BookmarkApplicationSettingsTest.php b/tests/Unit/Applications/BookmarkApplicationSettingsTest.php new file mode 100644 index 0000000000..cc6744d96e --- /dev/null +++ b/tests/Unit/Applications/BookmarkApplicationSettingsTest.php @@ -0,0 +1,60 @@ +assertInstanceOf(\Okta\Applications\BookmarkApplicationSettingsApplication::class, + $this->testable->getApp()); + $this->assertInstanceOf(\Okta\Applications\BookmarkApplicationSettingsApplication::class, + $this->testable->app); + } + + /** @test */ + public function app_is_settable() + { + $app = $this->testable->getApp(); + $app->url = 'http://example.com'; + $this->testable->setApp($app); + $this->assertEquals('http://example.com', $this->testable->getApp()->url); + + + $app->url = 'http://example.org'; + $this->testable->signOn = $app; + $this->assertEquals('http://example.org', $this->testable->getApp()->url); + } + + +} diff --git a/tests/Unit/Applications/BookmarkApplicationTest.php b/tests/Unit/Applications/BookmarkApplicationTest.php new file mode 100644 index 0000000000..f49c5d81dc --- /dev/null +++ b/tests/Unit/Applications/BookmarkApplicationTest.php @@ -0,0 +1,52 @@ +assertInstanceOf(\Okta\Applications\BookmarkApplicationSettings::class, $this->testable->getSettings()); + $this->assertInstanceOf(\Okta\Applications\BookmarkApplicationSettings::class, $this->testable->settings); + } + + /** @test */ + public function settings_is_settable() + { + $settings = $this->testable->getSettings(); + + $settings->abc = '123'; + $this->testable->setSettings($settings); + $this->assertEquals('123', $this->testable->getSettings()->abc); + + $settings->abc = '456'; + $this->testable->settings = $settings; + $this->assertEquals('456', $this->testable->getSettings()->abc); + } + +} diff --git a/tests/Unit/Applications/BrowserPluginApplicationTest.php b/tests/Unit/Applications/BrowserPluginApplicationTest.php new file mode 100644 index 0000000000..cfc29f7b25 --- /dev/null +++ b/tests/Unit/Applications/BrowserPluginApplicationTest.php @@ -0,0 +1,51 @@ +assertInstanceOf(\Okta\Applications\SchemeApplicationCredentials::class,$this->testable->getCredentials()); + $this->assertInstanceOf(\Okta\Applications\SchemeApplicationCredentials::class,$this->testable->credentials); + } + + /** @test */ + public function credentials_is_settable() + { + $credentials = $this->testable->getCredentials(); + + $credentials->abc = '123'; + $this->testable->setCredentials($credentials); + $this->assertEquals('123', $this->testable->getCredentials()->abc); + + $credentials->abc = '456'; + $this->testable->credentials = $credentials; + $this->assertEquals('456', $this->testable->getCredentials()->abc); + } +} diff --git a/tests/Unit/Applications/JsonWebKeyTest.php b/tests/Unit/Applications/JsonWebKeyTest.php new file mode 100644 index 0000000000..f864cdacbc --- /dev/null +++ b/tests/Unit/Applications/JsonWebKeyTest.php @@ -0,0 +1,137 @@ +assertEquals($this->properties->e, $this->testable->getE()); + $this->assertEquals($this->properties->e, $this->testable->e); + } + + /** @test */ + public function n_is_accessible() + { + $this->assertEquals($this->properties->n, $this->testable->getN()); + $this->assertEquals($this->properties->n, $this->testable->n); + } + + /** @test */ + public function alg_is_accessible() + { + $this->assertEquals($this->properties->alg, $this->testable->getAlg()); + $this->assertEquals($this->properties->alg, $this->testable->alg); + } + + /** @test */ + public function kid_is_accessible() + { + $this->assertEquals($this->properties->kid, $this->testable->getKid()); + $this->assertEquals($this->properties->kid, $this->testable->kid); + } + + /** @test */ + public function kty_is_accessible() + { + $this->assertEquals($this->properties->kty, $this->testable->getKty()); + $this->assertEquals($this->properties->kty, $this->testable->kty); + } + + /** @test */ + public function x5c_is_accessible() + { + $this->assertEquals($this->properties->x5c, $this->testable->getX5C()); + $this->assertEquals($this->properties->x5c, $this->testable->x5C); + } + + /** @test */ + public function x5t_is_accessible() + { + $this->assertEquals($this->properties->x5t, $this->testable->getX5T()); + $this->assertEquals($this->properties->x5t, $this->testable->x5T); + } + + /** @test */ + public function x5u_is_accessible() + { + $this->assertEquals($this->properties->x5u, $this->testable->getX5U()); + $this->assertEquals($this->properties->x5u, $this->testable->x5U); + } + + /** @test */ + public function status_is_accessible() + { + $this->assertEquals($this->properties->status, $this->testable->getStatus()); + $this->assertEquals($this->properties->status, $this->testable->status); + } + + /** @test */ + public function created_is_accessible() + { + $ts = Carbon::parse($this->properties->created)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->created); + $this->assertEquals($ts, $this->testable->getCreated()->timestamp); + $this->assertEquals($ts, $this->testable->created->timestamp); + } + + /** @test */ + public function key_ops_is_accessible() + { + $this->assertEquals($this->properties->key_ops, $this->testable->getKeyOps()); + $this->assertEquals($this->properties->key_ops, $this->testable->keyOps); + } + + /** @test */ + public function x_5_t_s_256_is_accessible() + { + $this->assertEquals($this->properties->{'x5t#S256'}, $this->testable->getX5TS256()); + $this->assertEquals($this->properties->{'x5t#S256'}, $this->testable->x5TS256); + } + + /** @test */ + public function expires_at_is_accessible() + { + $ts = Carbon::parse($this->properties->expiresAt)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->expiresAt); + $this->assertEquals($ts, $this->testable->getExpiresAt()->timestamp); + $this->assertEquals($ts, $this->testable->expiresAt->timestamp); + } + + + /** @test */ + public function last_updated_is_accessible() + { + $ts = Carbon::parse($this->properties->lastUpdated)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->lastUpdated); + $this->assertEquals($ts, $this->testable->getLastUpdated()->timestamp); + $this->assertEquals($ts, $this->testable->lastUpdated->timestamp); + } + +} diff --git a/tests/Unit/Applications/OAuthApplicationCredentialsTest.php b/tests/Unit/Applications/OAuthApplicationCredentialsTest.php new file mode 100644 index 0000000000..6b35d579ac --- /dev/null +++ b/tests/Unit/Applications/OAuthApplicationCredentialsTest.php @@ -0,0 +1,61 @@ +assertInstanceOf(\Okta\Applications\ApplicationCredentialsOAuthClient::class, + $this->testable->getOauthClient()); + $this->assertInstanceOf(\Okta\Applications\ApplicationCredentialsOAuthClient::class, + $this->testable->oauthClient); + } + + /** @test */ + public function oauth_client_is_settable() + { + $client = $this->testable->getOauthClient(); + + $client->clientId = 'abc'; + $this->testable->setOauthClient($client); + $this->assertEquals('abc', $this->testable->getOauthClient()->clientId); + + $client->clientId = '123'; + $this->testable->oauthClient = $client; + $this->assertEquals('123', $this->testable->getOauthClient()->clientId); + } + + +} diff --git a/tests/Unit/Applications/OpenIdConnectApplicationSettingsTest.php b/tests/Unit/Applications/OpenIdConnectApplicationSettingsTest.php new file mode 100644 index 0000000000..17c811f5d3 --- /dev/null +++ b/tests/Unit/Applications/OpenIdConnectApplicationSettingsTest.php @@ -0,0 +1,73 @@ +assertInstanceOf(\Okta\Applications\OpenIdConnectApplicationSettingsClient::class, $this->testable->getOauthClient()); + $this->assertInstanceOf(\Okta\Applications\OpenIdConnectApplicationSettingsClient::class, $this->testable->oauthClient); + } + + /** @test */ + public function oauth_client_is_settable() + { + $oauthClient = $this->testable->getOauthClient(); + + $oauthClient->tos_uri = 'http://example.com'; + $this->testable->setOauthClient($oauthClient); + $this->assertEquals('http://example.com', $this->testable->getOauthClient()->tos_uri); + + $oauthClient->tos_uri = 'http://example.org'; + $this->testable->oauthClient = $oauthClient; + $this->assertEquals('http://example.org', $this->testable->getOauthClient()->tos_uri); + } + +} diff --git a/tests/Unit/Applications/OpenIdConnectApplicationTest.php b/tests/Unit/Applications/OpenIdConnectApplicationTest.php new file mode 100644 index 0000000000..49e8054314 --- /dev/null +++ b/tests/Unit/Applications/OpenIdConnectApplicationTest.php @@ -0,0 +1,73 @@ +assertInstanceOf(\Okta\Applications\OpenIdConnectApplicationSettings::class, $this->testable->getSettings()); + $this->assertInstanceOf(\Okta\Applications\OpenIdConnectApplicationSettings::class, $this->testable->settings); + } + + /** @test */ + public function settings_is_settable() + { + $settings = $this->testable->getSettings(); + + $settings->abc = '123'; + $this->testable->setSettings($settings); + $this->assertEquals('123', $this->testable->getSettings()->abc); + + $settings->abc = '456'; + $this->testable->settings = $settings; + $this->assertEquals('456', $this->testable->getSettings()->abc); + } + + /** @test */ + public function credentials_is_accessible() + { + $this->assertInstanceOf(\Okta\Applications\OAuthApplicationCredentials::class,$this->testable->getCredentials()); + $this->assertInstanceOf(\Okta\Applications\OAuthApplicationCredentials::class,$this->testable->credentials); + } + + /** @test */ + public function credentials_is_settable() + { + $credentials = $this->testable->getCredentials(); + + $credentials->abc = '123'; + $this->testable->setCredentials($credentials); + $this->assertEquals('123', $this->testable->getCredentials()->abc); + + $credentials->abc = '456'; + $this->testable->credentials = $credentials; + $this->assertEquals('456', $this->testable->getCredentials()->abc); + } + +} diff --git a/tests/Unit/Applications/SamlApplicationSettingsSignOnTest.php b/tests/Unit/Applications/SamlApplicationSettingsSignOnTest.php new file mode 100644 index 0000000000..3590734d38 --- /dev/null +++ b/tests/Unit/Applications/SamlApplicationSettingsSignOnTest.php @@ -0,0 +1,387 @@ +assertEquals($this->properties->audience, $this->testable->getAudience()); + $this->assertEquals($this->properties->audience, $this->testable->audience); + } + + /** @test */ + public function audience_is_settable() + { + $this->testable->setAudience('aud1'); + $this->assertEquals('aud1', $this->testable->getAudience()); + + $this->testable->audience = 'aud2'; + $this->assertEquals('aud2', $this->testable->getAudience()); + } + + /** @test */ + public function sp_issuer_is_accessible() + { + $this->assertEquals($this->properties->spIssuer, $this->testable->getSpIssuer()); + $this->assertEquals($this->properties->spIssuer, $this->testable->spIssuer); + } + + /** @test */ + public function sp_issuer_is_settable() + { + $this->testable->setSpIssuer('issuer1'); + $this->assertEquals('issuer1', $this->testable->getSpIssuer()); + + $this->testable->spIssuer = 'issuer2'; + $this->assertEquals('issuer2', $this->testable->getSpIssuer()); + } + + /** @test */ + public function idp_issuer_is_accessible() + { + $this->assertEquals($this->properties->idpIssuer, $this->testable->getIdpIssuer()); + $this->assertEquals($this->properties->idpIssuer, $this->testable->idpIssuer); + } + + /** @test */ + public function idp_issuer_is_settable() + { + $this->testable->setIdpIssuer('issuer1'); + $this->assertEquals('issuer1', $this->testable->getIdpIssuer()); + + $this->testable->idpIssuer = 'issuer2'; + $this->assertEquals('issuer2', $this->testable->getIdpIssuer()); + } + + /** @test */ + public function recipient_is_accessible() + { + $this->assertEquals($this->properties->recipient, $this->testable->getRecipient()); + $this->assertEquals($this->properties->recipient, $this->testable->recipient); + } + + /** @test */ + public function recipient_is_settable() + { + $this->testable->setRecipient('rec1'); + $this->assertEquals('rec1', $this->testable->getRecipient()); + + $this->testable->recipient = 'rec2'; + $this->assertEquals('rec2', $this->testable->getRecipient()); + } + + /** @test */ + public function sso_acs_url_is_accessible() + { + $this->assertEquals($this->properties->ssoAcsUrl, $this->testable->getSsoAcsUrl()); + $this->assertEquals($this->properties->ssoAcsUrl, $this->testable->ssoAcsUrl); + } + + /** @test */ + public function sso_acs_url_is_settable() + { + $this->testable->setSsoAcsUrl('http://example.com'); + $this->assertEquals('http://example.com', $this->testable->getSsoAcsUrl()); + + $this->testable->ssoAcsUrl = 'http://example.org'; + $this->assertEquals('http://example.org', $this->testable->getSsoAcsUrl()); + } + + /** @test */ + public function destination_is_accessible() + { + $this->assertEquals($this->properties->destination, $this->testable->getDestination()); + $this->assertEquals($this->properties->destination, $this->testable->destination); + } + + /** @test */ + public function destination_is_settable() + { + $this->testable->setDestination('dest1'); + $this->assertEquals('dest1', $this->testable->getDestination()); + + $this->testable->destination = 'dest2'; + $this->assertEquals('dest2', $this->testable->getDestination()); + } + + /** @test */ + public function response_signed_is_accessible() + { + $this->assertEquals($this->properties->responseSigned, $this->testable->getResponseSigned()); + $this->assertEquals($this->properties->responseSigned, $this->testable->responseSigned); + } + + /** @test */ + public function response_signed_is_settable() + { + $this->testable->setResponseSigned(true); + $this->assertEquals(true, $this->testable->getResponseSigned()); + + $this->testable->responseSigned = false; + $this->assertEquals(false, $this->testable->getResponseSigned()); + } + + /** @test */ + public function assertion_signed_is_accessible() + { + $this->assertEquals($this->properties->assertionSigned, $this->testable->getAssertionSigned()); + $this->assertEquals($this->properties->assertionSigned, $this->testable->assertionSigned); + } + + /** @test */ + public function assertion_signed_is_settable() + { + $this->testable->setAssertionSigned(true); + $this->assertEquals(true, $this->testable->getAssertionSigned()); + + $this->testable->assertionSigned = false; + $this->assertEquals(false, $this->testable->getAssertionSigned()); + } + + /** @test */ + public function digest_algorithm_is_accessible() + { + $this->assertEquals($this->properties->digestAlgorithm, $this->testable->getDigestAlgorithm()); + $this->assertEquals($this->properties->digestAlgorithm, $this->testable->digestAlgorithm); + } + + /** @test */ + public function digest_algorithm_is_settable() + { + $this->testable->setDigestAlgorithm('da1'); + $this->assertEquals('da1', $this->testable->getDigestAlgorithm()); + + $this->testable->digestAlgorithm = 'da2'; + $this->assertEquals('da2', $this->testable->getDigestAlgorithm()); + } + + /** @test */ + public function honor_force_authn_is_accessible() + { + $this->assertEquals($this->properties->honorForceAuthn, $this->testable->getHonorForceAuthn()); + $this->assertEquals($this->properties->honorForceAuthn, $this->testable->honorForceAuthn); + } + + /** @test */ + public function honor_force_authn_is_settable() + { + $this->testable->setHonorForceAuthn(true); + $this->assertEquals(true, $this->testable->getHonorForceAuthn()); + + $this->testable->honorForceAuthn = false; + $this->assertEquals(false, $this->testable->getHonorForceAuthn()); + } + + /** @test */ + public function audience_override_is_accessible() + { + $this->assertEquals($this->properties->audienceOverride, $this->testable->getAudienceOverride()); + $this->assertEquals($this->properties->audienceOverride, $this->testable->audienceOverride); + } + + /** @test */ + public function audience_override_is_settable() + { + $this->testable->setAudienceOverride('override1'); + $this->assertEquals('override1', $this->testable->getAudienceOverride()); + + $this->testable->audienceOverride = 'override2'; + $this->assertEquals('override2', $this->testable->getAudienceOverride()); + } + + /** @test */ + public function default_relay_state_is_accessible() + { + $this->assertEquals($this->properties->defaultRelayState, $this->testable->getDefaultRelayState()); + $this->assertEquals($this->properties->defaultRelayState, $this->testable->defaultRelayState); + } + + /** @test */ + public function default_relay_state_is_settable() + { + $this->testable->setDefaultRelayState('drs1'); + $this->assertEquals('drs1', $this->testable->getDefaultRelayState()); + + $this->testable->defaultRelayState = 'drs2'; + $this->assertEquals('drs2', $this->testable->getDefaultRelayState()); + } + + /** @test */ + public function recipient_override_is_accessible() + { + $this->assertEquals($this->properties->recipientOverride, $this->testable->getRecipientOverride()); + $this->assertEquals($this->properties->recipientOverride, $this->testable->recipientOverride); + } + + /** @test */ + public function recipient_override_is_settable() + { + $this->testable->setRecipientOverride('override1'); + $this->assertEquals('override1', $this->testable->getRecipientOverride()); + + $this->testable->recipientOverride = 'override2'; + $this->assertEquals('override2', $this->testable->getRecipientOverride()); + } + + /** @test */ + public function request_compressed_is_accessible() + { + $this->assertEquals($this->properties->requestCompressed, $this->testable->getRequestCompressed()); + $this->assertEquals($this->properties->requestCompressed, $this->testable->requestCompressed); + } + + /** @test */ + public function request_compressed_is_settable() + { + $this->testable->setRequestCompressed(true); + $this->assertEquals(true, $this->testable->getRequestCompressed()); + + $this->testable->requestCompressed = false; + $this->assertEquals(false, $this->testable->getRequestCompressed()); + } + + /** @test */ + public function sso_acs_url_override_is_accessible() + { + $this->assertEquals($this->properties->ssoAcsUrlOverride, $this->testable->getSsoAcsUrlOverride()); + $this->assertEquals($this->properties->ssoAcsUrlOverride, $this->testable->ssoAcsUrlOverride); + } + + /** @test */ + public function sso_acs_url_override_is_settable() + { + $this->testable->setSsoAcsUrlOverride('acs1'); + $this->assertEquals('acs1', $this->testable->getSsoAcsUrlOverride()); + + $this->testable->ssoAcsUrlOverride = 'acs2'; + $this->assertEquals('acs2', $this->testable->getSsoAcsUrlOverride()); + } + + /** @test */ + public function signature_algorithm_is_accessible() + { + $this->assertEquals($this->properties->signatureAlgorithm, $this->testable->getSignatureAlgorithm()); + $this->assertEquals($this->properties->signatureAlgorithm, $this->testable->signatureAlgorithm); + } + + /** @test */ + public function signature_algorithm_is_settable() + { + $this->testable->setSignatureAlgorithm('alg1'); + $this->assertEquals('alg1', $this->testable->getSignatureAlgorithm()); + + $this->testable->signatureAlgorithm = 'alg2'; + $this->assertEquals('alg2', $this->testable->getSignatureAlgorithm()); + } + /** @test */ + public function attribute_statements_is_accessible() + { + $this->assertEquals($this->properties->attributeStatements, $this->testable->getAttributeStatements()); + $this->assertEquals($this->properties->attributeStatements, $this->testable->attributeStatements); + } + + /** @test */ + public function attribute_statements_is_settable() + { + $this->testable->setAttributeStatements(['test'=>'this']); + $this->assertEquals(['test'=>'this'], $this->testable->getAttributeStatements()); + + $this->testable->attributeStatements = ['test'=>'that']; + $this->assertEquals(['test'=>'that'], $this->testable->getAttributeStatements()); + } + + /** @test */ + public function destination_override_is_accessible() + { + $this->assertEquals($this->properties->destinationOverride, $this->testable->getDestinationOverride()); + $this->assertEquals($this->properties->destinationOverride, $this->testable->destinationOverride); + } + + /** @test */ + public function destination_override_is_settable() + { + $this->testable->setDestinationOverride('dest1'); + $this->assertEquals('dest1', $this->testable->getDestinationOverride()); + + $this->testable->destinationOverride = 'dest2'; + $this->assertEquals('dest2', $this->testable->getDestinationOverride()); + } + + /** @test */ + public function subject_name_id_format_is_accessible() + { + $this->assertEquals($this->properties->subjectNameIdFormat, $this->testable->getSubjectNameIdFormat()); + $this->assertEquals($this->properties->subjectNameIdFormat, $this->testable->subjectNameIdFormat); + } + + /** @test */ + public function subject_name_id_format_is_settable() + { + $this->testable->setSubjectNameIdFormat('format1'); + $this->assertEquals('format1', $this->testable->getSubjectNameIdFormat()); + + $this->testable->subjectNameIdFormat = 'format2'; + $this->assertEquals('format2', $this->testable->getSubjectNameIdFormat()); + } + + /** @test */ + public function authn_context_class_ref_is_accessible() + { + $this->assertEquals($this->properties->authnContextClassRef, $this->testable->getAuthnContextClassRef()); + $this->assertEquals($this->properties->authnContextClassRef, $this->testable->authnContextClassRef); + } + + /** @test */ + public function authn_context_class_ref_is_settable() + { + $this->testable->setAuthnContextClassRef('ref1'); + $this->assertEquals('ref1', $this->testable->getAuthnContextClassRef()); + + $this->testable->authnContextClassRef = 'ref2'; + $this->assertEquals('ref2', $this->testable->getAuthnContextClassRef()); + } + + /** @test */ + public function subject_name_id_template_is_accessible() + { + $this->assertEquals($this->properties->subjectNameIdTemplate, $this->testable->getSubjectNameIdTemplate()); + $this->assertEquals($this->properties->subjectNameIdTemplate, $this->testable->subjectNameIdTemplate); + } + + /** @test */ + public function subject_name_id_template_is_settable() + { + $this->testable->setSubjectNameIdTemplate('temp1'); + $this->assertEquals('temp1', $this->testable->getSubjectNameIdTemplate()); + + $this->testable->subjectNameIdTemplate = 'temp2'; + $this->assertEquals('temp2', $this->testable->getSubjectNameIdTemplate()); + } + +} diff --git a/tests/Unit/Applications/SamlAttributeStatementTest.php b/tests/Unit/Applications/SamlAttributeStatementTest.php new file mode 100644 index 0000000000..02e6651e87 --- /dev/null +++ b/tests/Unit/Applications/SamlAttributeStatementTest.php @@ -0,0 +1,106 @@ +assertEquals($this->properties->name, $this->testable->getName()); + $this->assertEquals($this->properties->name, $this->testable->name); + } + + /** @test */ + public function name_is_settable() + { + $this->testable->setName('name1'); + $this->assertEquals('name1', $this->testable->getName()); + + $this->testable->name = 'name2'; + $this->assertEquals('name2', $this->testable->getName()); + } + + /** @test */ + public function type_is_accessible() + { + $this->assertEquals($this->properties->type, $this->testable->getType()); + $this->assertEquals($this->properties->type, $this->testable->type); + } + + /** @test */ + public function type_is_settable() + { + $this->testable->setType('type1'); + $this->assertEquals('type1', $this->testable->getType()); + + $this->testable->type = 'type2'; + $this->assertEquals('type2', $this->testable->getType()); + } + + /** @test */ + public function values_is_accessible() + { + $this->assertEquals($this->properties->values, $this->testable->getValues()); + $this->assertEquals($this->properties->values, $this->testable->values); + } + + /** @test */ + public function values_is_settable() + { + $this->testable->setValues(['test']); + $this->assertEquals(['test'], $this->testable->getValues()); + + $this->testable->values = ['this']; + $this->assertEquals(['this'], $this->testable->getValues()); + } + + /** @test */ + public function namespace_is_accessible() + { + $this->assertEquals($this->properties->namespace, $this->testable->getNamespace()); + $this->assertEquals($this->properties->namespace, $this->testable->namespace); + } + + /** @test */ + public function namespace_is_settable() + { + $this->testable->setNamespace('ns1'); + $this->assertEquals('ns1', $this->testable->getNamespace()); + + $this->testable->namespace = 'ns2'; + $this->assertEquals('ns2', $this->testable->getNamespace()); + } + +} diff --git a/tests/Unit/Applications/SchemeApplicationCredentialsTest.php b/tests/Unit/Applications/SchemeApplicationCredentialsTest.php new file mode 100644 index 0000000000..e565377c01 --- /dev/null +++ b/tests/Unit/Applications/SchemeApplicationCredentialsTest.php @@ -0,0 +1,115 @@ +assertEquals($this->properties->scheme, $this->testable->getScheme()); + $this->assertEquals($this->properties->scheme, $this->testable->scheme); + } + + /** @test */ + public function scheme_is_settable() + { + $this->testable->setScheme('scheme1'); + $this->assertEquals('scheme1', $this->testable->getScheme()); + + $this->testable->scheme = 'scheme2'; + $this->assertEquals('scheme2', $this->testable->getScheme()); + } + + /** @test */ + public function signing_is_accessible() + { + $this->assertInstanceOf(\Okta\Applications\ApplicationCredentialsSigning::class, $this->testable->getSigning()); + $this->assertInstanceOf(\Okta\Applications\ApplicationCredentialsSigning::class, $this->testable->signing); + } + + /** @test */ + public function signing_is_settable() + { + $signing = $this->testable->getSigning(); + + $signing->signature = 'sign1'; + $this->testable->setSigning($signing); + $this->assertEquals('sign1', $this->testable->getSigning()->signature); + + $signing->signature = 'sign2'; + $this->testable->signing = $signing; + $this->assertEquals('sign2', $this->testable->getSigning()->signature); + } + + /** @test */ + public function user_name_is_accessible() + { + $this->assertEquals($this->properties->userName, $this->testable->getUserName()); + $this->assertEquals($this->properties->userName, $this->testable->userName); + } + + /** @test */ + public function user_name_is_settable() + { + $this->testable->setUserName('user'); + $this->assertEquals('user', $this->testable->getUserName()); + + $this->testable->userName = 'name'; + $this->assertEquals('name', $this->testable->getUserName()); + } + + /** @test */ + public function reveal_password_is_accessible() + { + $this->assertEquals($this->properties->revealPassword, $this->testable->getRevealPassword()); + $this->assertEquals($this->properties->revealPassword, $this->testable->revealPassword); + } + + /** @test */ + public function reveal_password_is_settable() + { + $this->testable->setRevealPassword(true); + $this->assertEquals(true, $this->testable->getRevealPassword()); + + $this->testable->revealPassword = false; + $this->assertEquals(false, $this->testable->getRevealPassword()); + } + + + +} diff --git a/tests/Unit/Applications/SecurePasswordStoreApplicationSettingsApplicationTest.php b/tests/Unit/Applications/SecurePasswordStoreApplicationSettingsApplicationTest.php new file mode 100644 index 0000000000..1c011cc8a6 --- /dev/null +++ b/tests/Unit/Applications/SecurePasswordStoreApplicationSettingsApplicationTest.php @@ -0,0 +1,196 @@ +assertEquals($this->properties->url, $this->testable->getUrl()); + $this->assertEquals($this->properties->url, $this->testable->url); + } + + /** @test */ + public function url_is_settable() + { + $this->testable->setUrl('http://example.com'); + $this->assertEquals('http://example.com', $this->testable->getUrl()); + + $this->testable->url = 'http://example.org'; + $this->assertEquals('http://example.org', $this->testable->getUrl()); + } + + /** @test */ + public function password_field_is_accessible() + { + $this->assertEquals($this->properties->passwordField, $this->testable->getPasswordField()); + $this->assertEquals($this->properties->passwordField, $this->testable->passwordField); + } + + /** @test */ + public function password_field_is_settable() + { + $this->testable->setPasswordField('abc'); + $this->assertEquals('abc', $this->testable->getPasswordField()); + + $this->testable->passwordField = '123'; + $this->assertEquals('123', $this->testable->getPasswordField()); + } + + /** @test */ + public function username_field_is_accessible() + { + $this->assertEquals($this->properties->usernameField, $this->testable->getUsernameField()); + $this->assertEquals($this->properties->usernameField, $this->testable->usernameField); + } + + /** @test */ + public function username_field_is_settable() + { + $this->testable->setUsernameField('abc'); + $this->assertEquals('abc', $this->testable->getUsernameField()); + + $this->testable->usernameField = '123'; + $this->assertEquals('123', $this->testable->getUsernameField()); + } + + /** @test */ + public function optional_field_1_is_accessible() + { + $this->assertEquals($this->properties->optionalField1, $this->testable->getOptionalField1()); + $this->assertEquals($this->properties->optionalField1, $this->testable->optionalField1); + } + + /** @test */ + public function optional_field_1_is_settable() + { + $this->testable->setOptionalField1('abc'); + $this->assertEquals('abc', $this->testable->getOptionalField1()); + + $this->testable->optionalField1 = '123'; + $this->assertEquals('123', $this->testable->getOptionalField1()); + } + + /** @test */ + public function options_field_2_is_accessible() + { + $this->assertEquals($this->properties->optionalField2, $this->testable->getOptionalField2()); + $this->assertEquals($this->properties->optionalField2, $this->testable->optionalField2); + } + + /** @test */ + public function options_field_2_is_settable() + { + $this->testable->setOptionalField2('abc'); + $this->assertEquals('abc', $this->testable->getOptionalField2()); + + $this->testable->optionalField2 = '123'; + $this->assertEquals('123', $this->testable->getOptionalField2()); + } + + /** @test */ + public function options_field_3_is_accessible() + { + $this->assertEquals($this->properties->optionalField3, $this->testable->getOptionalField3()); + $this->assertEquals($this->properties->optionalField3, $this->testable->optionalField3); + } + + /** @test */ + public function options_field_3_is_settable() + { + $this->testable->setOptionalField3('abc'); + $this->assertEquals('abc', $this->testable->getOptionalField3()); + + $this->testable->optionalField3 = '123'; + $this->assertEquals('123', $this->testable->getOptionalField3()); + } + + /** @test */ + public function optional_field_1_value_is_accessible() + { + $this->assertEquals($this->properties->optionalField1Value, $this->testable->getOptionalField1Value()); + $this->assertEquals($this->properties->optionalField1Value, $this->testable->optionalField1Value); + } + + /** @test */ + public function optional_field_1_value_is_settable() + { + $this->testable->setOptionalField1Value('abc'); + $this->assertEquals('abc', $this->testable->getOptionalField1Value()); + + $this->testable->optionalField1Value = '123'; + $this->assertEquals('123', $this->testable->getOptionalField1Value()); + } + + /** @test */ + public function optional_field_2_value_is_accessible() + { + $this->assertEquals($this->properties->optionalField2Value, $this->testable->getOptionalField2Value()); + $this->assertEquals($this->properties->optionalField2Value, $this->testable->optionalField2Value); + } + + /** @test */ + public function optional_field_2_value_is_settable() + { + $this->testable->setOptionalField2Value('abc'); + $this->assertEquals('abc', $this->testable->getOptionalField2Value()); + + $this->testable->optionalField2Value = '123'; + $this->assertEquals('123', $this->testable->getOptionalField2Value()); + } + + /** @test */ + public function optional_field_3_value_is_accessible() + { + $this->assertEquals($this->properties->optionalField3Value, $this->testable->getOptionalField3Value()); + $this->assertEquals($this->properties->optionalField3Value, $this->testable->optionalField3Value); + } + + /** @test */ + public function optional_field_3_value_is_settable() + { + $this->testable->setOptionalField3Value('abc'); + $this->assertEquals('abc', $this->testable->getOptionalField3Value()); + + $this->testable->optionalField3Value = '123'; + $this->assertEquals('123', $this->testable->getOptionalField3Value()); + } + + + +} diff --git a/tests/Unit/Applications/SecurePasswordStoreApplicationSettingsTest.php b/tests/Unit/Applications/SecurePasswordStoreApplicationSettingsTest.php new file mode 100644 index 0000000000..ae9550f57b --- /dev/null +++ b/tests/Unit/Applications/SecurePasswordStoreApplicationSettingsTest.php @@ -0,0 +1,54 @@ +assertInstanceOf(\Okta\Applications\SecurePasswordStoreApplicationSettingsApplication::class, $this->testable->getApp()); + $this->assertInstanceOf(\Okta\Applications\SecurePasswordStoreApplicationSettingsApplication::class, $this->testable->app); + } + + /** @test */ + public function app_is_settable() + { + $app = $this->testable->getApp(); + $app->url = "http://example.com"; + $this->testable->setApp($app); + $this->assertEquals("http://example.com", $this->testable->getApp()->url); + + $app->url = "http://example.org"; + $this->testable->app = $app; + $this->assertEquals("http://example.org", $this->testable->getApp()->url); + } + +} diff --git a/tests/Unit/Applications/SecurePasswordStoreApplicationTest.php b/tests/Unit/Applications/SecurePasswordStoreApplicationTest.php new file mode 100644 index 0000000000..a5fe9fa6c7 --- /dev/null +++ b/tests/Unit/Applications/SecurePasswordStoreApplicationTest.php @@ -0,0 +1,75 @@ +assertInstanceOf(\Okta\Applications\SecurePasswordStoreApplicationSettings::class, + $this->testable->getSettings()); + $this->assertInstanceOf(\Okta\Applications\SecurePasswordStoreApplicationSettings::class, + $this->testable->settings); + } + + /** @test */ + public function settings_is_settable() + { + $settings = $this->testable->getSettings(); + + $settings->abc = '123'; + $this->testable->setSettings($settings); + $this->assertEquals('123', $this->testable->getSettings()->abc); + + $settings->abc = '456'; + $this->testable->settings = $settings; + $this->assertEquals('456', $this->testable->getSettings()->abc); + } + + /** @test */ + public function credentials_is_accessible() + { + $this->assertInstanceOf(\Okta\Applications\SchemeApplicationCredentials::class,$this->testable->getCredentials()); + $this->assertInstanceOf(\Okta\Applications\SchemeApplicationCredentials::class,$this->testable->credentials); + } + + /** @test */ + public function credentials_is_settable() + { + $credentials = $this->testable->getCredentials(); + + $credentials->abc = '123'; + $this->testable->setCredentials($credentials); + $this->assertEquals('123', $this->testable->getCredentials()->abc); + + $credentials->abc = '456'; + $this->testable->credentials = $credentials; + $this->assertEquals('456', $this->testable->getCredentials()->abc); + } + +} diff --git a/tests/Unit/Applications/SwaApplicationSettingsApplicationTest.php b/tests/Unit/Applications/SwaApplicationSettingsApplicationTest.php new file mode 100644 index 0000000000..f5e88b1c4c --- /dev/null +++ b/tests/Unit/Applications/SwaApplicationSettingsApplicationTest.php @@ -0,0 +1,122 @@ +assertEquals($this->properties->url, $this->testable->getUrl()); + $this->assertEquals($this->properties->url, $this->testable->url); + } + + /** @test */ + public function url_is_settable() + { + $this->testable->setUrl("http://example.com"); + $this->assertEquals("http://example.com", $this->testable->getUrl()); + + $this->testable->url = "http://example.org"; + $this->assertEquals("http://example.org", $this->testable->getUrl()); + } + + /** @test */ + public function button_field_is_accessible() + { + $this->assertEquals($this->properties->buttonField, $this->testable->getButtonField()); + $this->assertEquals($this->properties->buttonField, $this->testable->buttonField); + } + + /** @test */ + public function button_field_is_settable() + { + $this->testable->setButtonField('field1'); + $this->assertEquals('field1', $this->testable->getButtonField()); + + $this->testable->buttonField = 'field2'; + $this->assertEquals('field2', $this->testable->getButtonField()); + } + + /** @test */ + public function login_url_regex_is_accessible() + { + $this->assertEquals($this->properties->loginUrlRegex, $this->testable->getLoginUrlRegex()); + $this->assertEquals($this->properties->loginUrlRegex, $this->testable->loginUrlRegex); + } + + /** @test */ + public function login_url_regex_is_settable() + { + $this->testable->setLoginUrlRegex('regex1'); + $this->assertEquals('regex1', $this->testable->getLoginUrlRegex()); + + $this->testable->loginUrlRegex = 'regex2'; + $this->assertEquals('regex2', $this->testable->getLoginUrlRegex()); + } + + /** @test */ + public function password_field_is_accessible() + { + $this->assertEquals($this->properties->passwordField, $this->testable->getPasswordField()); + $this->assertEquals($this->properties->passwordField, $this->testable->passwordField); + } + + /** @test */ + public function password_field_is_settable() + { + $this->testable->setPasswordField('field1'); + $this->assertEquals('field1', $this->testable->getPasswordField()); + + $this->testable->passwordField = 'field2'; + $this->assertEquals('field2', $this->testable->getPasswordField()); + } + + /** @test */ + public function username_field_is_accessible() + { + $this->assertEquals($this->properties->usernameField, $this->testable->getUsernameField()); + $this->assertEquals($this->properties->usernameField, $this->testable->usernameField); + } + + /** @test */ + public function username_field_is_settable() + { + $this->testable->setUsernameField('field1'); + $this->assertEquals('field1', $this->testable->getUsernameField()); + + $this->testable->usernameField = 'field2'; + $this->assertEquals('field2', $this->testable->getUsernameField()); + } + +} diff --git a/tests/Unit/Applications/SwaApplicationSettingsTest.php b/tests/Unit/Applications/SwaApplicationSettingsTest.php new file mode 100644 index 0000000000..105b4f4cc2 --- /dev/null +++ b/tests/Unit/Applications/SwaApplicationSettingsTest.php @@ -0,0 +1,60 @@ +assertInstanceOf(\Okta\Applications\SwaApplicationSettingsApplication::class, $this->testable->getApp + ()); + $this->assertInstanceOf(\Okta\Applications\SwaApplicationSettingsApplication::class, $this->testable->app); + } + + /** @test */ + public function app_is_settable() + { + $app = $this->testable->getApp(); + $app->url = "http://example.com"; + $this->testable->setApp($app); + $this->assertEquals("http://example.com", $this->testable->getApp()->url); + + $app->url = "http://example.org"; + $this->testable->app = $app; + $this->assertEquals("http://example.org", $this->testable->getApp()->url); + } + +} diff --git a/tests/Unit/Applications/SwaApplicationTest.php b/tests/Unit/Applications/SwaApplicationTest.php new file mode 100644 index 0000000000..e17cdb9e53 --- /dev/null +++ b/tests/Unit/Applications/SwaApplicationTest.php @@ -0,0 +1,52 @@ +assertInstanceOf(\Okta\Applications\SwaApplicationSettings::class, $this->testable->getSettings()); + $this->assertInstanceOf(\Okta\Applications\SwaApplicationSettings::class, $this->testable->settings); + } + + /** @test */ + public function settings_is_settable() + { + $settings = $this->testable->getSettings(); + + $settings->abc = '123'; + $this->testable->setSettings($settings); + $this->assertEquals('123', $this->testable->getSettings()->abc); + + $settings->abc = '456'; + $this->testable->settings = $settings; + $this->assertEquals('456', $this->testable->getSettings()->abc); + } + +} diff --git a/tests/Unit/Applications/SwaThreeFieldApplicationSettingsApplicationTest.php b/tests/Unit/Applications/SwaThreeFieldApplicationSettingsApplicationTest.php new file mode 100644 index 0000000000..fc64e0673f --- /dev/null +++ b/tests/Unit/Applications/SwaThreeFieldApplicationSettingsApplicationTest.php @@ -0,0 +1,161 @@ +assertEquals($this->properties->targetUrl, $this->testable->getTargetUrl()); + $this->assertEquals($this->properties->targetUrl, $this->testable->targetUrl); + } + + /** @test */ + public function target_url_is_settable() + { + $this->testable->setTargetUrl('http://example.com'); + $this->assertEquals('http://example.com', $this->testable->getTargetUrl()); + + $this->testable->targetUrl = 'http://example.org'; + $this->assertEquals('http://example.org', $this->testable->getTargetUrl()); + } + + + /** @test */ + public function button_selector_is_accessible() + { + $this->assertEquals($this->properties->buttonSelector, $this->testable->getButtonSelector()); + $this->assertEquals($this->properties->buttonSelector, $this->testable->buttonSelector); + } + + /** @test */ + public function button_selector_is_settable() + { + $this->testable->setButtonSelector('sel1'); + $this->assertEquals('sel1', $this->testable->getButtonSelector()); + + $this->testable->buttonSelector = 'sel2'; + $this->assertEquals('sel2', $this->testable->getButtonSelector()); + } + + /** @test */ + public function extra_field_value_is_accessible() + { + $this->assertEquals($this->properties->extraFieldValue, $this->testable->getExtraFieldValue()); + $this->assertEquals($this->properties->extraFieldValue, $this->testable->extraFieldValue); + } + + /** @test */ + public function extra_field_value_is_settable() + { + $this->testable->setExtraFieldValue('val1'); + $this->assertEquals('val1', $this->testable->getExtraFieldValue()); + + $this->testable->extraFieldValue = 'val2'; + $this->assertEquals('val2', $this->testable->getExtraFieldValue()); + } + + /** @test */ + public function password_selector_is_accessible() + { + $this->assertEquals($this->properties->passwordSelector, $this->testable->getPasswordSelector()); + $this->assertEquals($this->properties->passwordSelector, $this->testable->passwordSelector); + } + + /** @test */ + public function password_selector_is_settable() + { + $this->testable->setPasswordSelector('pass1'); + $this->assertEquals('pass1', $this->testable->getPasswordSelector()); + + $this->testable->passwordSelector = 'pass2'; + $this->assertEquals('pass2', $this->testable->getPasswordSelector()); + } + + /** @test */ + public function user_name_selector_is_accessible() + { + $this->assertEquals($this->properties->userNameSelector, $this->testable->getUserNameSelector()); + $this->assertEquals($this->properties->userNameSelector, $this->testable->userNameSelector); + } + + /** @test */ + public function user_name_selector_is_settable() + { + $this->testable->setUserNameSelector('un1'); + $this->assertEquals('un1', $this->testable->getUserNameSelector()); + + $this->testable->userNameSelector = 'un2'; + $this->assertEquals('un2', $this->testable->getUserNameSelector()); + } + + /** @test */ + public function extra_field_selector_is_accessible() + { + $this->assertEquals($this->properties->extraFieldSelector, $this->testable->getExtraFieldSelector()); + $this->assertEquals($this->properties->extraFieldSelector, $this->testable->extraFieldSelector); + } + + /** @test */ + public function extra_field_selector_is_settable() + { + $this->testable->setExtraFieldSelector('sel1'); + $this->assertEquals('sel1', $this->testable->getExtraFieldSelector()); + + $this->testable->extraFieldSelector = 'sel2'; + $this->assertEquals('sel2', $this->testable->getExtraFieldSelector()); + } + + /** @test */ + public function login_url_regex_is_accessible() + { + $this->assertEquals($this->properties->loginUrlRegex, $this->testable->getLoginUrlRegex()); + $this->assertEquals($this->properties->loginUrlRegex, $this->testable->loginUrlRegex); + } + + /** @test */ + public function login_url_regex_is_settable() + { + $this->testable->setLoginUrlRegex('regex1'); + $this->assertEquals('regex1', $this->testable->getLoginUrlRegex()); + + $this->testable->loginUrlRegex = 'regex2'; + $this->assertEquals('regex2', $this->testable->getLoginUrlRegex()); + } + + + +} diff --git a/tests/Unit/Applications/SwaThreeFieldApplicationSettingsTest.php b/tests/Unit/Applications/SwaThreeFieldApplicationSettingsTest.php new file mode 100644 index 0000000000..015dd8da5c --- /dev/null +++ b/tests/Unit/Applications/SwaThreeFieldApplicationSettingsTest.php @@ -0,0 +1,62 @@ +assertInstanceOf(\Okta\Applications\SwaThreeFieldApplicationSettingsApplication::class, $this->testable->getApp + ()); + $this->assertInstanceOf(\Okta\Applications\SwaThreeFieldApplicationSettingsApplication::class, $this->testable->app); + } + + /** @test */ + public function app_is_settable() + { + $app = $this->testable->getApp(); + $app->url = "http://example.com"; + $this->testable->setApp($app); + $this->assertEquals("http://example.com", $this->testable->getApp()->url); + + $app->url = "http://example.org"; + $this->testable->app = $app; + $this->assertEquals("http://example.org", $this->testable->getApp()->url); + } + +} diff --git a/tests/Unit/Applications/SwaThreeFieldApplicationTest.php b/tests/Unit/Applications/SwaThreeFieldApplicationTest.php new file mode 100644 index 0000000000..0adad8d9a8 --- /dev/null +++ b/tests/Unit/Applications/SwaThreeFieldApplicationTest.php @@ -0,0 +1,52 @@ +assertInstanceOf(\Okta\Applications\SwaThreeFieldApplicationSettings::class, $this->testable->getSettings()); + $this->assertInstanceOf(\Okta\Applications\SwaThreeFieldApplicationSettings::class, $this->testable->settings); + } + + /** @test */ + public function settings_is_settable() + { + $settings = $this->testable->getSettings(); + + $settings->abc = '123'; + $this->testable->setSettings($settings); + $this->assertEquals('123', $this->testable->getSettings()->abc); + + $settings->abc = '456'; + $this->testable->settings = $settings; + $this->assertEquals('456', $this->testable->getSettings()->abc); + } + +} diff --git a/tests/Unit/Applications/WsFederationApplicationSettingsApplicationTest.php b/tests/Unit/Applications/WsFederationApplicationSettingsApplicationTest.php new file mode 100644 index 0000000000..231551d765 --- /dev/null +++ b/tests/Unit/Applications/WsFederationApplicationSettingsApplicationTest.php @@ -0,0 +1,248 @@ +assertEquals($this->properties->realm, $this->testable->getRealm()); + $this->assertEquals($this->properties->realm, $this->testable->realm); + } + + /** @test */ + public function realm_is_settable() + { + $this->testable->setRealm('realm1'); + $this->assertEquals('realm1', $this->testable->getRealm()); + + $this->testable->realm = 'realm2'; + $this->assertEquals('realm2', $this->testable->getRealm()); + } + + /** @test */ + public function site_url_is_accessible() + { + $this->assertEquals($this->properties->siteURL, $this->testable->getSiteUrl()); + $this->assertEquals($this->properties->siteURL, $this->testable->siteUrl); + } + + /** @test */ + public function site_url_is_settable() + { + $this->testable->setSiteUrl('http://example.com'); + $this->assertEquals('http://example.com', $this->testable->getSiteUrl()); + + $this->testable->siteUrl = 'http://example.org'; + $this->assertEquals('http://example.org', $this->testable->getSiteUrl()); + } + + /** @test */ + public function group_name_is_accessible() + { + $this->assertEquals($this->properties->groupName, $this->testable->getGroupName()); + $this->assertEquals($this->properties->groupName, $this->testable->groupName); + } + + /** @test */ + public function group_name_is_settable() + { + $this->testable->setGroupName('name1'); + $this->assertEquals('name1', $this->testable->getGroupName()); + + $this->testable->groupName = 'name2'; + $this->assertEquals('name2', $this->testable->getGroupName()); + } + + /** @test */ + public function w_reply_Url_is_accessible() + { + $this->assertEquals($this->properties->wReplyURL, $this->testable->getWReplyUrl()); + $this->assertEquals($this->properties->wReplyURL, $this->testable->wReplyUrl); + } + + /** @test */ + public function w_reply_Url_is_settable() + { + $this->testable->setWReplyUrl('http://example.net'); + $this->assertEquals('http://example.net', $this->testable->getWReplyUrl()); + + $this->testable->wReplyUrl = 'http://example.org'; + $this->assertEquals('http://example.org', $this->testable->getWReplyUrl()); + } + + /** @test */ + public function group_filter_is_accessible() + { + $this->assertEquals($this->properties->groupFilter, $this->testable->getGroupFilter()); + $this->assertEquals($this->properties->groupFilter, $this->testable->groupFilter); + } + + /** @test */ + public function group_filter_is_settable() + { + $this->testable->setGroupFilter('filter1'); + $this->assertEquals('filter1', $this->testable->getGroupFilter()); + + $this->testable->groupFilter = 'filter2'; + $this->assertEquals('filter2', $this->testable->getGroupFilter()); + } + + /** @test */ + public function name_id_format_is_accessible() + { + $this->assertEquals($this->properties->nameIDFormat, $this->testable->getNameIdFormat()); + $this->assertEquals($this->properties->nameIDFormat, $this->testable->nameIdFormat); + } + + /** @test */ + public function name_id_format_is_settable() + { + $this->testable->setNameIdFormat('format1'); + $this->assertEquals('format1', $this->testable->getNameIdFormat()); + + $this->testable->nameIdFormat = 'format2'; + $this->assertEquals('format2', $this->testable->getNameIdFormat()); + } + + /** @test */ + public function w_reply_override_is_accessible() + { + $this->assertEquals($this->properties->wReplyOverride, $this->testable->getWReplyOverride()); + $this->assertEquals($this->properties->wReplyOverride, $this->testable->wReplyOverride); + } + + /** @test */ + public function w_reply_override_is_settable() + { + $this->testable->setWReplyOverride(true); + $this->assertEquals(true, $this->testable->getWReplyOverride()); + + $this->testable->wReplyOverride = false; + $this->assertEquals(false, $this->testable->getWReplyOverride()); + } + + /** @test */ + public function group_value_format_is_accessible() + { + $this->assertEquals($this->properties->groupValueFormat, $this->testable->getGroupValueFormat()); + $this->assertEquals($this->properties->groupValueFormat, $this->testable->groupValueFormat); + } + + /** @test */ + public function group_value_format_is_settable() + { + $this->testable->setGroupValueFormat('format1'); + $this->assertEquals('format1', $this->testable->getGroupValueFormat()); + + $this->testable->groupValueFormat = 'format2'; + $this->assertEquals('format2', $this->testable->getGroupValueFormat()); + } + + /** @test */ + public function username_attribute_is_accessible() + { + $this->assertEquals($this->properties->usernameAttribute, $this->testable->getUsernameAttribute()); + $this->assertEquals($this->properties->usernameAttribute, $this->testable->usernameAttribute); + } + + /** @test */ + public function username_attribute_is_settable() + { + $this->testable->setUsernameAttribute('att1'); + $this->assertEquals('att1', $this->testable->getUsernameAttribute()); + + $this->testable->usernameAttribute = 'att2'; + $this->assertEquals('att2', $this->testable->getUsernameAttribute()); + } + + /** @test */ + public function attribute_statements_is_accessible() + { + $this->assertEquals($this->properties->attributeStatements, $this->testable->getAttributeStatements()); + $this->assertEquals($this->properties->attributeStatements, $this->testable->attributeStatements); + } + + /** @test */ + public function attribute_statements_is_settable() + { + $this->testable->setAttributeStatements('state1'); + $this->assertEquals('state1', $this->testable->getAttributeStatements()); + + $this->testable->attributeStatements = 'state2'; + $this->assertEquals('state2', $this->testable->getAttributeStatements()); + } + + /** @test */ + public function audience_restriction_is_accessible() + { + $this->assertEquals($this->properties->audienceRestriction, $this->testable->getAudienceRestriction()); + $this->assertEquals($this->properties->audienceRestriction, $this->testable->audienceRestriction); + } + + /** @test */ + public function audience_restriction_is_settable() + { + $this->testable->setAudienceRestriction('res1'); + $this->assertEquals('res1', $this->testable->getAudienceRestriction()); + + $this->testable->audienceRestriction = 'res2'; + $this->assertEquals('res2', $this->testable->getAudienceRestriction()); + } + + /** @test */ + public function authn_context_class_ref_is_accessible() + { + $this->assertEquals($this->properties->authnContextClassRef, $this->testable->getAuthnContextClassRef()); + $this->assertEquals($this->properties->authnContextClassRef, $this->testable->authnContextClassRef); + } + + /** @test */ + public function authn_context_class_ref_is_settable() + { + $this->testable->setAuthnContextClassRef('ref1'); + $this->assertEquals('ref1', $this->testable->getAuthnContextClassRef()); + + $this->testable->authnContextClassRef = 'ref2'; + $this->assertEquals('ref2', $this->testable->getAuthnContextClassRef()); + } + +} diff --git a/tests/Unit/Applications/WsFederationApplicationSettingsTest.php b/tests/Unit/Applications/WsFederationApplicationSettingsTest.php new file mode 100644 index 0000000000..e8b46e100c --- /dev/null +++ b/tests/Unit/Applications/WsFederationApplicationSettingsTest.php @@ -0,0 +1,67 @@ +assertInstanceOf(\Okta\Applications\WsFederationApplicationSettingsApplication::class, $this->testable->getApp + ()); + $this->assertInstanceOf(\Okta\Applications\WsFederationApplicationSettingsApplication::class, $this->testable->app); + } + + /** @test */ + public function app_is_settable() + { + $app = $this->testable->getApp(); + $app->url = "http://example.com"; + $this->testable->setApp($app); + $this->assertEquals("http://example.com", $this->testable->getApp()->url); + + $app->url = "http://example.org"; + $this->testable->app = $app; + $this->assertEquals("http://example.org", $this->testable->getApp()->url); + } + +} diff --git a/tests/Unit/Applications/WsFederationApplicationTest.php b/tests/Unit/Applications/WsFederationApplicationTest.php new file mode 100644 index 0000000000..94c9c76da8 --- /dev/null +++ b/tests/Unit/Applications/WsFederationApplicationTest.php @@ -0,0 +1,52 @@ +assertInstanceOf(\Okta\Applications\WsFederationApplicationSettings::class, $this->testable->getSettings()); + $this->assertInstanceOf(\Okta\Applications\WsFederationApplicationSettings::class, $this->testable->settings); + } + + /** @test */ + public function settings_is_settable() + { + $settings = $this->testable->getSettings(); + + $settings->abc = '123'; + $this->testable->setSettings($settings); + $this->assertEquals('123', $this->testable->getSettings()->abc); + + $settings->abc = '456'; + $this->testable->settings = $settings; + $this->assertEquals('456', $this->testable->getSettings()->abc); + } + +} diff --git a/tests/Unit/Users/UserTest.php b/tests/Unit/Users/UserTest.php index 08006d7b64..3d8f8db0b1 100644 --- a/tests/Unit/Users/UserTest.php +++ b/tests/Unit/Users/UserTest.php @@ -762,7 +762,9 @@ public function expire_password_makes_request_to_correct_location() /** @test */ public function adding_factor_makes_request_to_correct_location() { - $httpClient = $this->createNewHttpClient(); + $httpClient = $this->createNewHttpClient([ + "getBody" => '{"id": "abc123", "factorType": "sms"}' + ]); $user = $this->createNewUser(); $factor = new\Okta\UserFactors\Factor; diff --git a/tests/models/Applications/applicationUser.json b/tests/models/Applications/applicationUser.json new file mode 100644 index 0000000000..2e7be6e793 --- /dev/null +++ b/tests/models/Applications/applicationUser.json @@ -0,0 +1,39 @@ +{ + "id": "00u11z6WHMYCGPCHCRFK", + "externalId": "70c14cc17d3745e8a9f98d599a68329c", + "created": "2014-06-24T15:27:59.000Z", + "lastUpdated": "2014-06-24T15:28:14.000Z", + "scope": "USER", + "status": "ACTIVE", + "statusChanged": "2014-06-24T15:28:14.000Z", + "passwordChanged": "2014-06-24T15:27:59.000Z", + "syncState": "SYNCHRONIZED", + "lastSync": "2014-06-24T15:27:59.000Z", + "credentials": { + "userName": "saml.jackson@example.com", + "password": {} + }, + "profile": { + "secondEmail": null, + "lastName": "Jackson", + "mobilePhone": null, + "email": "saml.jackson@example.com", + "salesforceGroups": [ + "Employee" + ], + "role": "CEO", + "firstName": "Saml", + "profile": "Standard User" + }, + "_links": { + "app": { + "href": "https://php.oktapreview.com/api/v1/apps/0oabhnUQFYHMBNVSVXMV" + }, + "user": { + "href": "https://php.oktapreview.com/api/v1/users/00u11z6WHMYCGPCHCRFK" + } + }, + "_embedded": { + "test": "test" + } +} diff --git a/tests/models/Applications/applicationVisibility.json b/tests/models/Applications/applicationVisibility.json new file mode 100644 index 0000000000..7571ac0927 --- /dev/null +++ b/tests/models/Applications/applicationVisibility.json @@ -0,0 +1,10 @@ +{ + "autoSubmitToolbar": false, + "hide": { + "iOS": false, + "web": false + }, + "appLinks": { + "login": true + } +} \ No newline at end of file diff --git a/tests/models/Applications/groupAssignment.json b/tests/models/Applications/groupAssignment.json new file mode 100644 index 0000000000..cd89abfc90 --- /dev/null +++ b/tests/models/Applications/groupAssignment.json @@ -0,0 +1,19 @@ +{ + "id": "00gbkkGFFWZDLCNTAGQR", + "lastUpdated": "2013-10-02T07:38:20.000Z", + "priority": 0, + "profile": { + "email": "demo@mailinator.com" + }, + "_links": { + "app": { + "href": "https://php.oktapreview.com/api/v1/apps/0oabhnUQFYHMBNVSVXMV" + }, + "user": { + "href": "https://php.oktapreview.com/api/v1/users/00u11z6WHMYCGPCHCRFK" + } + }, + "_embedded": { + "test": "test" + } +} \ No newline at end of file diff --git a/tests/models/Applications/jsonWebKey.json b/tests/models/Applications/jsonWebKey.json new file mode 100644 index 0000000000..9d6ee5fb05 --- /dev/null +++ b/tests/models/Applications/jsonWebKey.json @@ -0,0 +1,19 @@ +{ + "created": "2017-11-29T15:51:16.000Z", + "lastUpdated": "2017-11-29T15:51:16.000Z", + "expiresAt": "2019-11-29T15:51:15.000Z", + "x5c": [ + "MIIDljCFgJhn19z0tt6PoVxaTJ+UI5rb0KQ==" + ], + "e": "AQAB", + "n": "5CouWC8W0zl8MigCnnndUi42XOQawhc2oWQ", + "kid": "HPgXeMtIzC-uAlEh5sZ-1LYwNrQmZhEPbJtNIyBaOzs", + "kty": "RSA", + "use": "sig", + "x5t#S256": "umP4NH5NnHHUDE-LdXVeHfyxgFQVDdeOuUKzUKsBm_A", + "alg": "hs256", + "x5t": "H5NnHHUDE-LdXVeHfy", + "x5u": "eHfyxgFQVDdeOuU", + "status": "ENABLED", + "key_ops": ["eMtIzC-uAlEh5"] +} \ No newline at end of file diff --git a/tests/models/Applications/samlApplicationSettingsSignOn.json b/tests/models/Applications/samlApplicationSettingsSignOn.json new file mode 100644 index 0000000000..906e9247fb --- /dev/null +++ b/tests/models/Applications/samlApplicationSettingsSignOn.json @@ -0,0 +1,32 @@ +{ + "audience": "asdqwe123", + "spIssuer": "123", + "idpIssuer": "http://www.okta.com/${org.externalKey}", + "recipient": "http://testorgone.okta", + "ssoAcsUrl": "http://testorgone.okta", + "destination": "http://testorgone.okta", + "responseSigned": true, + "assertionSigned": true, + "digestAlgorithm": "SHA256", + "honorForceAuthn": true, + "audienceOverride": "string", + "defaultRelayState": "abc", + "recipientOverride": "string", + "requestCompressed": false, + "ssoAcsUrlOverride": "string", + "signatureAlgorithm": "RSA_SHA256", + "attributeStatements": [ + { + "type": "EXPRESSION", + "name": "Attribute", + "namespace": "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified", + "values": [ + "Value" + ] + } + ], + "destinationOverride": "string", + "subjectNameIdFormat": "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified", + "authnContextClassRef": "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport", + "subjectNameIdTemplate": "${user.userName}" +} \ No newline at end of file From 0a48d8f81aa77963dfcca9819d24fca7e4de48aa Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Thu, 30 Nov 2017 15:49:04 -0500 Subject: [PATCH 15/22] Application tests --- openapi/generator/index.js | 35 ++- .../deleteApplicationGroupAssignment.php.hbs | 10 + .../templates/deleteApplicationUser.php.hbs | 10 + openapi/generator/templates/model.php.hbs | 13 +- .../templates/updateApplicationUser.php.hbs | 11 + src/Applications/Application.php | 50 ++++- src/Generated/Applications/AppUser.php | 29 +-- src/Generated/Applications/Application.php | 3 +- .../ApplicationGroupAssignment.php | 13 +- .../SchemeApplicationCredentials.php | 10 +- src/Generated/GroupRules/GroupRule.php | 3 +- src/Generated/Groups/Group.php | 3 +- src/Generated/UserFactors/Factor.php | 2 +- src/Generated/Users/User.php | 3 +- tests/Integration/ApplicationsTest.php | 71 ++++++ tests/Unit/Applications/AppUserTest.php | 37 ++++ .../ApplicationGroupAssignmentTest.php | 15 ++ ...IdConnectApplicationSettingsClientTest.php | 205 ++++++++++++++++++ .../SamlApplicationSettingsTest.php | 82 +++++++ .../Unit/Applications/SamlApplicationTest.php | 52 +++++ .../SchemeApplicationCredentialsTest.php | 24 +- .../applications/samlApplication.json | 105 +++++++++ .../applications/swaApplication.json | 61 ++++++ 23 files changed, 805 insertions(+), 42 deletions(-) create mode 100644 openapi/generator/templates/deleteApplicationGroupAssignment.php.hbs create mode 100644 openapi/generator/templates/deleteApplicationUser.php.hbs create mode 100644 openapi/generator/templates/updateApplicationUser.php.hbs create mode 100644 tests/Integration/ApplicationsTest.php create mode 100644 tests/Unit/Applications/OpenIdConnectApplicationSettingsClientTest.php create mode 100644 tests/Unit/Applications/SamlApplicationSettingsTest.php create mode 100644 tests/Unit/Applications/SamlApplicationTest.php create mode 100644 tests/responses/applications/samlApplication.json create mode 100644 tests/responses/applications/swaApplication.json diff --git a/openapi/generator/index.js b/openapi/generator/index.js index 5f04241758..f01d7e85c3 100644 --- a/openapi/generator/index.js +++ b/openapi/generator/index.js @@ -1,5 +1,6 @@ const _ = require('lodash'); _.mixin(require('lodash-inflection')); +const fs = require('fs'); const php = module.exports; @@ -56,7 +57,7 @@ function getType(obj, model) { case 'WsFederationApplicationCredentials': return '\\Okta\\Applications\\ApplicationCredentials'; default: - return `\\${model}\\${obj.model}`; + return `\\Okta\\` + getFirstTagFromReference(obj.reference) + `\\${obj.model}`; } case 'hash': return String.raw`\stdClass`; @@ -124,7 +125,7 @@ function getSafeType(obj, model) { case 'WsFederationApplicationSettingsApplication': return ': \\Okta\\Applications\\ApplicationSettingsApplication'; default: - return `: \\${model}\\${obj.model}`; + return `: \\Okta\\` + getFirstTagFromReference(obj.reference) + `\\${obj.model}`; } case 'hash': return String.raw`: \stdClass`; @@ -191,7 +192,7 @@ function getTypeHint(obj) { case 'WsFederationApplicationSettingsApplication': return '\\Okta\\Applications\\ApplicationSettingsApplication'; default: - return `\\${obj.baseClass}\\${obj.model}`; + return `\\Okta\\` + getFirstTagFromReference(obj.reference) + `\\${obj.model}`; } } @@ -484,7 +485,22 @@ function buildGetResourceParams(model) { } +function lookUpRef(model) { + const ref = model['$ref'].split("/").pop(); + return php.spec.definitions[ref]; +} + +function getRefTag(ref) { + return ref['x-okta-tags'][0] +} + +function getFirstTagFromReference(reference) { + return pluralize(reference['x-okta-tags'][0]); +} + + php.process = ({ spec, operations, models, handlebars }) => { + php.spec = spec; const templates = []; const modelMap = {}; @@ -501,10 +517,12 @@ php.process = ({ spec, operations, models, handlebars }) => { for (let property of model.properties) { property.baseClass = `Okta\\${model.namespace}`; + property.reference = php.spec.definitions[property.model]; } if (model.methods) { for(let method of model.methods) { + method.reference = php.spec.definitions[method.operation.responseModel]; method.baseClass = `Okta\\${model.namespace}`; } } @@ -522,6 +540,7 @@ php.process = ({ spec, operations, models, handlebars }) => { if (model.methods) { for (let method of model.methods) { + const responseModel = method.operation.responseModel; if (modelMap[responseModel] && model.namespace !== modelMap[responseModel].namespace) { model.namespacedModels.push(modelMap[responseModel]); @@ -586,8 +605,16 @@ php.process = ({ spec, operations, models, handlebars }) => { customLog, getClassNameForCollection, getCollectionName, - buildGetResourceParams + buildGetResourceParams, + lookUpRef, + getRefTag, + getFirstTagFromReference + }); + handlebars.registerPartial('updateApplicationUser', fs.readFileSync('generator/templates/updateApplicationUser.php.hbs', 'utf8')) + handlebars.registerPartial('deleteApplicationUser', fs.readFileSync('generator/templates/deleteApplicationUser.php.hbs', 'utf8')) + handlebars.registerPartial('deleteApplicationGroupAssignment', fs.readFileSync('generator/templates/deleteApplicationGroupAssignment.php.hbs', 'utf8')) + return templates; }; diff --git a/openapi/generator/templates/deleteApplicationGroupAssignment.php.hbs b/openapi/generator/templates/deleteApplicationGroupAssignment.php.hbs new file mode 100644 index 0000000000..c3f7fa53e5 --- /dev/null +++ b/openapi/generator/templates/deleteApplicationGroupAssignment.php.hbs @@ -0,0 +1,10 @@ +public function delete( $appId ) +{ + return \Okta\Client::getInstance() + ->getDataStore() + ->deleteResource( + "/apps/{$appId}/group", + $this + ); +} + diff --git a/openapi/generator/templates/deleteApplicationUser.php.hbs b/openapi/generator/templates/deleteApplicationUser.php.hbs new file mode 100644 index 0000000000..1b69fed2be --- /dev/null +++ b/openapi/generator/templates/deleteApplicationUser.php.hbs @@ -0,0 +1,10 @@ +public function delete( $appId ) +{ + return \Okta\Client::getInstance() + ->getDataStore() + ->deleteResource( + "/apps/{$appId}/users", + $this + ); +} + diff --git a/openapi/generator/templates/model.php.hbs b/openapi/generator/templates/model.php.hbs index f0a3d8d41c..bc35f6040b 100644 --- a/openapi/generator/templates/model.php.hbs +++ b/openapi/generator/templates/model.php.hbs @@ -74,6 +74,9 @@ class {{modelName}} extends {{getExtends modelName}} {{/if}} {{#if (eq alias "update")}} + {{#if (eq this.operation.operationId "updateApplicationUser")}} + {{> updateApplicationUser }} + {{else}} public function save() { return \Okta\Client::getInstance() @@ -84,9 +87,14 @@ class {{modelName}} extends {{getExtends modelName}} \\{{this.defaultReturnType}}::class ); } - + {{/if}} {{/if}} {{#if (eq alias "delete")}} + {{#if (eq this.operation.operationId "deleteApplicationUser")}} + {{> deleteApplicationUser }} + {{else if (eq this.operation.operationId "deleteApplicationGroupAssignment")}} + {{> deleteApplicationGroupAssignment }} + {{else}} {{#unless (eq this.operation.operationId "deleteFactor")}} public function delete() { @@ -98,6 +106,7 @@ class {{modelName}} extends {{getExtends modelName}} ); } {{/unless}} + {{/if}} {{/if}} {{/each}} {{#each properties}} @@ -112,7 +121,7 @@ class {{modelName}} extends {{getExtends modelName}} { return $this->getResourceProperty( self::{{upperSnakeCase propertyName}}, - \\{{baseClass}}\\{{model}}::class, + \Okta\\{{getFirstTagFromReference this.reference}}\\{{model}}::class, $options ); } diff --git a/openapi/generator/templates/updateApplicationUser.php.hbs b/openapi/generator/templates/updateApplicationUser.php.hbs new file mode 100644 index 0000000000..cc3905803c --- /dev/null +++ b/openapi/generator/templates/updateApplicationUser.php.hbs @@ -0,0 +1,11 @@ +public function save( $appId ) +{ + return \Okta\Client::getInstance() + ->getDataStore() + ->saveResource( + "/apps/{$appId}/users", + $this, + \\{{this.defaultReturnType}}::class + ); +} + diff --git a/src/Applications/Application.php b/src/Applications/Application.php index 248e2f31b3..02fd22a1a4 100644 --- a/src/Applications/Application.php +++ b/src/Applications/Application.php @@ -19,5 +19,53 @@ class Application extends \Okta\Generated\Applications\Application { - + public function get($query) + { + $application = parent::get($query); + return $this->convertFromGenericApplication($application); + } + + public function convertFromGenericApplication($application) + { + switch($application->getSignOnMode()) { + case "BOOKMARK": + $appClass = \Okta\Applications\BookmarkApplication::class; + break; + case "BASIC_AUTH": + $appClass = \Okta\Applications\BasicAuthApplication::class; + break; + case "BROWSER_PLUGIN": + switch($application->getName()) { + case "template_swa": + $appClass = \Okta\Applications\SwaApplication::class; + break; + case "template_swa3field": + $appClass = \Okta\Applications\SwaThreeFieldApplication::class; + break; + } + break; + case "SECURE_PASSWORD_STORE": + $appClass = \Okta\Applications\SecurePasswordStoreApplication::class; + break; + case "AUTO_LOGIN": + $appClass = \Okta\Applications\AutoLoginApplication::class; + break; + case "WS_FEDERATION": + $appClass = \Okta\Applications\WsFederationApplication::class; + break; + case "SAML_2_0": + $appClass = \Okta\Applications\SamlApplication::class; + break; + case "OPENID_CONNECT": + $appClass = \Okta\Applications\OpenIdConnectApplication::class; + break; + } + + $properties = new \stdClass(); + foreach ($application->getPropertyNames() as $name) { + $properties->$name = $application->getProperty($name); + } + + return new $appClass(null, $properties); + } } diff --git a/src/Generated/Applications/AppUser.php b/src/Generated/Applications/AppUser.php index 1626747955..bb43ac412b 100644 --- a/src/Generated/Applications/AppUser.php +++ b/src/Generated/Applications/AppUser.php @@ -36,26 +36,27 @@ class AppUser extends \Okta\Resource\AbstractResource const PASSWORD_CHANGED = 'passwordChanged'; - public function save() + public function save( $appId ) { return \Okta\Client::getInstance() - ->getDataStore() - ->saveResource( - "/apps", - $this, - \Okta\Applications\AppUser::class - ); + ->getDataStore() + ->saveResource( + "/apps/{$appId}/users", + $this, + \Okta\Applications\AppUser::class + ); } - - public function delete() + + public function delete( $appId ) { return \Okta\Client::getInstance() - ->getDataStore() - ->deleteResource( - "/apps", - $this - ); + ->getDataStore() + ->deleteResource( + "/apps/{$appId}/users", + $this + ); } + /** * Get the id. * diff --git a/src/Generated/Applications/Application.php b/src/Generated/Applications/Application.php index 9ed0ab4eca..185f87c7bc 100644 --- a/src/Generated/Applications/Application.php +++ b/src/Generated/Applications/Application.php @@ -57,7 +57,6 @@ public function save() \Okta\Applications\Application::class ); } - public function delete() { return \Okta\Client::getInstance() @@ -67,7 +66,7 @@ public function delete() $this ); } - /** + /** * Get the id. * * @return string diff --git a/src/Generated/Applications/ApplicationGroupAssignment.php b/src/Generated/Applications/ApplicationGroupAssignment.php index a81708d2c7..bcf999a480 100644 --- a/src/Generated/Applications/ApplicationGroupAssignment.php +++ b/src/Generated/Applications/ApplicationGroupAssignment.php @@ -28,15 +28,16 @@ class ApplicationGroupAssignment extends \Okta\Resource\AbstractResource const LAST_UPDATED = 'lastUpdated'; - public function delete() + public function delete( $appId ) { return \Okta\Client::getInstance() - ->getDataStore() - ->deleteResource( - "/apps", - $this - ); + ->getDataStore() + ->deleteResource( + "/apps/{$appId}/group", + $this + ); } + /** * Get the id. * diff --git a/src/Generated/Applications/SchemeApplicationCredentials.php b/src/Generated/Applications/SchemeApplicationCredentials.php index 6696301677..7ca68f64fa 100644 --- a/src/Generated/Applications/SchemeApplicationCredentials.php +++ b/src/Generated/Applications/SchemeApplicationCredentials.php @@ -83,13 +83,13 @@ public function setSigning(\Okta\Applications\ApplicationCredentialsSigning $sig /** * Get the password. * - * @return \Okta\Applications\PasswordCredential + * @return \Okta\Users\PasswordCredential */ - public function getPassword(array $options = []): \Okta\Applications\PasswordCredential + public function getPassword(array $options = []): \Okta\Users\PasswordCredential { return $this->getResourceProperty( self::PASSWORD, - \Okta\Applications\PasswordCredential::class, + \Okta\Users\PasswordCredential::class, $options ); } @@ -97,10 +97,10 @@ public function getPassword(array $options = []): \Okta\Applications\PasswordCre /** * Set the password. * - * @param \Okta\Applications\PasswordCredential $password The PasswordCredential instance. + * @param \Okta\Users\PasswordCredential $password The PasswordCredential instance. * @return self */ - public function setPassword(\Okta\Applications\PasswordCredential $password) + public function setPassword(\Okta\Users\PasswordCredential $password) { $this->setResourceProperty( self::PASSWORD, diff --git a/src/Generated/GroupRules/GroupRule.php b/src/Generated/GroupRules/GroupRule.php index 63dce077fa..72aa8ccdc6 100644 --- a/src/Generated/GroupRules/GroupRule.php +++ b/src/Generated/GroupRules/GroupRule.php @@ -40,7 +40,6 @@ public function save() \Okta\GroupRules\GroupRule::class ); } - public function delete() { return \Okta\Client::getInstance() @@ -50,7 +49,7 @@ public function delete() $this ); } - /** + /** * Get the id. * * @return string diff --git a/src/Generated/Groups/Group.php b/src/Generated/Groups/Group.php index 5b1a25dafc..ea87508241 100644 --- a/src/Generated/Groups/Group.php +++ b/src/Generated/Groups/Group.php @@ -42,7 +42,6 @@ public function save() \Okta\Groups\Group::class ); } - public function delete() { return \Okta\Client::getInstance() @@ -52,7 +51,7 @@ public function delete() $this ); } - /** + /** * Get the id. * * @return string diff --git a/src/Generated/UserFactors/Factor.php b/src/Generated/UserFactors/Factor.php index e936ff6cc7..95adaa8b28 100644 --- a/src/Generated/UserFactors/Factor.php +++ b/src/Generated/UserFactors/Factor.php @@ -36,7 +36,7 @@ class Factor extends \Okta\Resource\AbstractResource const RECHALLENGE_EXISTING_FACTOR = 'rechallengeExistingFactor'; - /** + /** * Get the id. * * @return string diff --git a/src/Generated/Users/User.php b/src/Generated/Users/User.php index a0c298fe5e..332d251c4e 100644 --- a/src/Generated/Users/User.php +++ b/src/Generated/Users/User.php @@ -69,7 +69,6 @@ public function save() \Okta\Users\User::class ); } - public function delete() { return \Okta\Client::getInstance() @@ -79,7 +78,7 @@ public function delete() $this ); } - /** + /** * Get the id. * * @return string diff --git a/tests/Integration/ApplicationsTest.php b/tests/Integration/ApplicationsTest.php new file mode 100644 index 0000000000..69ac233308 --- /dev/null +++ b/tests/Integration/ApplicationsTest.php @@ -0,0 +1,71 @@ +createNewHttpClient([ + 'getBody' => file_get_contents(__DIR__ . '/../responses/applications/samlApplication.json') + ]); + + $application = new \Okta\Applications\Application(); + $app = $application->get('application123'); + + $requests = $client->getRequests(); + + + $this->assertEquals( + "/api/v1/apps/application123", + $requests[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\SamlApplication::class, $app); + $this->assertequals('application/json', $requests[0]->getHeaderLine('Accept')); + $this->assertEmpty($requests[0]->getHeaderLine('Content-Type')); + $this->assertEquals("SSWS {$this->token}", $requests[0]->getHeaderLine('Authorization')); + + } + + /** @test */ + public function an_swa_application_can_be_retrieved_by_id() + { + $client = $this->createNewHttpClient([ + 'getBody' => file_get_contents(__DIR__ . '/../responses/applications/swaApplication.json') + ]); + + $application = new \Okta\Applications\Application(); + $app = $application->get('application123'); + + $requests = $client->getRequests(); + + + $this->assertEquals( + "/api/v1/apps/application123", + $requests[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\SwaApplication::class, $app); + $this->assertequals('application/json', $requests[0]->getHeaderLine('Accept')); + $this->assertEmpty($requests[0]->getHeaderLine('Content-Type')); + $this->assertEquals("SSWS {$this->token}", $requests[0]->getHeaderLine('Authorization')); + + } + +} diff --git a/tests/Unit/Applications/AppUserTest.php b/tests/Unit/Applications/AppUserTest.php index d0406c6bff..236cfcdf4c 100644 --- a/tests/Unit/Applications/AppUserTest.php +++ b/tests/Unit/Applications/AppUserTest.php @@ -29,6 +29,43 @@ class AppUserTest extends BaseUnitTestCase protected $model = '/Applications/applicationUser.json'; protected $modelType = \Okta\Applications\AppUser::class; + /** @test */ + public function saving_an_application_user_makes_requests_to_correct_endpoint() + { + $client = $this->createNewHttpClient(); + $this->testable->save('application1123'); + + $requests = $client->getRequests(); + + $this->assertEquals( + "/api/v1/apps/application1123/users/{$this->testable->getId()}", + $requests[0]->getUri()->getPath() + ); + $this->assertEquals('POST', $requests[0]->getMethod()); + } + + /** @test */ + public function saving_an_application_user_will_return_correct_type() + { + $client = $this->createNewHttpClient(); + + $app = $this->testable->save('application1123'); + + $this->assertInstanceOf(AppUser::class, $app); + } + + /** @test */ + public function deleting_an_application_makes_requests_to_correct_endpoint() + { + $client = $this->createNewHttpClient(); + $this->testable->delete('application123'); + + $requests = $client->getRequests(); + + $this->assertEquals("/api/v1/apps/application123/users/{$this->testable->getId()}", $requests[0]->getUri()->getPath()); + $this->assertEquals('DELETE', $requests[0]->getMethod()); + } + /** @test */ public function id_is_accessible() { diff --git a/tests/Unit/Applications/ApplicationGroupAssignmentTest.php b/tests/Unit/Applications/ApplicationGroupAssignmentTest.php index 9b1266a2f1..ba966cfc87 100644 --- a/tests/Unit/Applications/ApplicationGroupAssignmentTest.php +++ b/tests/Unit/Applications/ApplicationGroupAssignmentTest.php @@ -29,6 +29,21 @@ class ApplicationGroupAssignmentTest extends BaseUnitTestCase protected $model = '/Applications/groupAssignment.json'; protected $modelType = \Okta\Applications\ApplicationGroupAssignment::class; + /** @test */ + public function deleting_an_application_group_assignment_makes_requests_to_correct_endpoint() + { + $client = $this->createNewHttpClient(); + $this->testable->delete('application123'); + + $requests = $client->getRequests(); + + $this->assertEquals( + "/api/v1/apps/application123/group/{$this->testable->getId()}", + $requests[0]->getUri()->getPath() + ); + $this->assertEquals('DELETE', $requests[0]->getMethod()); + } + /** @test */ public function id_is_accessible() { diff --git a/tests/Unit/Applications/OpenIdConnectApplicationSettingsClientTest.php b/tests/Unit/Applications/OpenIdConnectApplicationSettingsClientTest.php new file mode 100644 index 0000000000..b8384d2a0f --- /dev/null +++ b/tests/Unit/Applications/OpenIdConnectApplicationSettingsClientTest.php @@ -0,0 +1,205 @@ +assertEquals($this->properties->tos_uri, $this->testable->getTosUri()); + $this->assertEquals($this->properties->tos_uri, $this->testable->tosUri); + } + + /** @test */ + public function tos_uri_is_settable() + { + $this->testable->setTosUri('http://example.com'); + $this->assertEquals('http://example.com', $this->testable->getTosUri()); + + $this->testable->tosUri = 'http://example.net'; + $this->assertEquals('http://example.net', $this->testable->getTosUri()); + } + + /** @test */ + public function logo_uri_is_accessible() + { + $this->assertEquals($this->properties->logo_uri, $this->testable->getLogoUri()); + $this->assertEquals($this->properties->logo_uri, $this->testable->logoUri); + } + + /** @test */ + public function logo_uri_is_settable() + { + $this->testable->setLogoUri('http://example.com'); + $this->assertEquals('http://example.com', $this->testable->getLogoUri()); + + $this->testable->logoUri = 'http://example.net'; + $this->assertEquals('http://example.net', $this->testable->getLogoUri()); + } + + /** @test */ + public function client_uri_is_accessible() + { + $this->assertEquals($this->properties->client_uri, $this->testable->getClientUri()); + $this->assertEquals($this->properties->client_uri, $this->testable->clientUri); + } + + /** @test */ + public function client_uri_is_settable() + { + $this->testable->setClientUri('http://example.com'); + $this->assertEquals('http://example.com', $this->testable->getClientUri()); + + $this->testable->clientUri = 'http://example.org'; + $this->assertEquals('http://example.org', $this->testable->getClientUri()); + } + + /** @test */ + public function policy_uri_is_accessible() + { + $this->assertEquals($this->properties->policy_uri, $this->testable->getPolicyUri()); + $this->assertEquals($this->properties->policy_uri, $this->testable->policyUri); + } + + /** @test */ + public function policy_uri_is_settable() + { + $this->testable->setPolicyUri('http://example.com'); + $this->assertEquals('http://example.com', $this->testable->getPolicyUri()); + + $this->testable->policyUri = 'http://example.net'; + $this->assertEquals('http://example.net', $this->testable->getPolicyUri()); + } + + /** @test */ + public function grant_types_is_accessible() + { + $this->assertEquals($this->properties->grant_types, $this->testable->getGrantTypes()); + $this->assertEquals($this->properties->grant_types, $this->testable->grantTypes); + } + + /** @test */ + public function grant_types_is_settable() + { + $this->testable->setGrantTypes(['code']); + $this->assertEquals(['code'], $this->testable->getGrantTypes()); + + $this->testable->grantTypes = ['client_cred']; + $this->assertEquals(['client_cred'], $this->testable->getGrantTypes()); + } + + /** @test */ + public function redirect_uris_is_accessible() + { + $this->assertEquals($this->properties->redirect_uris, $this->testable->getRedirectUris()); + $this->assertEquals($this->properties->redirect_uris, $this->testable->redirectUris); + } + + /** @test */ + public function redirect_uris_is_settable() + { + $this->testable->setRedirectUris(['http://example.com']); + $this->assertEquals(['http://example.com'], $this->testable->getRedirectUris()); + + $this->testable->redirectUris = ['http://example.net']; + $this->assertEquals(['http://example.net'], $this->testable->getRedirectUris()); + } + + /** @test */ + public function consent_method_is_accessible() + { + $this->assertEquals($this->properties->consent_method, $this->testable->getConsentMethod()); + $this->assertEquals($this->properties->consent_method, $this->testable->consentMethod); + } + + /** @test */ + public function consent_method_is_settable() + { + $this->testable->setConsentMethod('REQUIRED'); + $this->assertEquals('REQUIRED', $this->testable->getConsentMethod()); + + $this->testable->consentMethod = 'OPTIONAL'; + $this->assertEquals('OPTIONAL', $this->testable->getConsentMethod()); + } + + /** @test */ + public function response_types_is_accessible() + { + $this->assertEquals($this->properties->response_types, $this->testable->getResponseTypes()); + $this->assertEquals($this->properties->response_types, $this->testable->responseTypes); + } + + /** @test */ + public function response_types_is_settable() + { + $this->testable->setResponseTypes(['token']); + $this->assertEquals(['token'], $this->testable->getResponseTypes()); + + $this->testable->responseTypes = ['code']; + $this->assertEquals(['code'], $this->testable->getResponseTypes()); + } + + /** @test */ + public function application_type_is_accessible() + { + $this->assertEquals($this->properties->application_type, $this->testable->getApplicationType()); + $this->assertEquals($this->properties->application_type, $this->testable->applicationType); + } + + /** @test */ + public function application_type_is_settable() + { + $this->testable->setApplicationType('native'); + $this->assertEquals('native', $this->testable->getApplicationType()); + + $this->testable->applicationType = 'web'; + $this->assertEquals('web', $this->testable->getApplicationType()); + } + + +} diff --git a/tests/Unit/Applications/SamlApplicationSettingsTest.php b/tests/Unit/Applications/SamlApplicationSettingsTest.php new file mode 100644 index 0000000000..4313e879a2 --- /dev/null +++ b/tests/Unit/Applications/SamlApplicationSettingsTest.php @@ -0,0 +1,82 @@ +assertInstanceOf(\Okta\Applications\SamlApplicationSettingsSignOn::class, $this->testable->getSignOn()); + $this->assertInstanceOf(\Okta\Applications\SamlApplicationSettingsSignOn::class, $this->testable->signOn); + } + + /** @test */ + public function sign_on_is_settable() + { + $signOn = $this->testable->getSignOn(); + + $signOn->testing = 'this'; + $this->testable->setSignOn($signOn); + $this->assertEquals('this', $this->testable->getSignOn()->testing); + + $signOn->testing = 'that'; + $this->testable->signOn = $signOn; + $this->assertEquals('that', $this->testable->getSignOn()->testing); + } + + +} diff --git a/tests/Unit/Applications/SamlApplicationTest.php b/tests/Unit/Applications/SamlApplicationTest.php new file mode 100644 index 0000000000..bfd8c2bf91 --- /dev/null +++ b/tests/Unit/Applications/SamlApplicationTest.php @@ -0,0 +1,52 @@ +assertInstanceOf(\Okta\Applications\SamlApplicationSettings::class, $this->testable->getSettings()); + $this->assertInstanceOf(\Okta\Applications\SamlApplicationSettings::class, $this->testable->settings); + } + + /** @test */ + public function settings_is_settable() + { + $settings = $this->testable->getSettings(); + + $settings->abc = '123'; + $this->testable->setSettings($settings); + $this->assertEquals('123', $this->testable->getSettings()->abc); + + $settings->abc = '456'; + $this->testable->settings = $settings; + $this->assertEquals('456', $this->testable->getSettings()->abc); + } + +} diff --git a/tests/Unit/Applications/SchemeApplicationCredentialsTest.php b/tests/Unit/Applications/SchemeApplicationCredentialsTest.php index e565377c01..1e763aa1a9 100644 --- a/tests/Unit/Applications/SchemeApplicationCredentialsTest.php +++ b/tests/Unit/Applications/SchemeApplicationCredentialsTest.php @@ -34,7 +34,7 @@ class SchemeApplicationCredentialsTest extends BaseUnitTestCase "revealPassword": false, "signing": {"test": "this"}, "userName": "email@example.com", - "password": {} + "password": {"value": "password"} }'; protected $modelType = \Okta\Applications\SchemeApplicationCredentials::class; @@ -75,6 +75,28 @@ public function signing_is_settable() $this->testable->signing = $signing; $this->assertEquals('sign2', $this->testable->getSigning()->signature); } + + /** @test */ + public function password_is_accessible() + { + $this->assertInstanceOf(\Okta\Users\PasswordCredential::class, $this->testable->getPassword()); + $this->assertInstanceOf(\Okta\Users\PasswordCredential::class, $this->testable->password); + } + + /** @test */ + public function password_is_settable() + { + $password = $this->testable->getPassword(); + + $password->value = 'pass1'; + $this->testable->setPassword($password); + $this->assertEquals('pass1', $this->testable->getPassword()->value); + + $password->value = 'pass2'; + $this->testable->password = $password; + $this->assertEquals('pass2', $this->testable->getPassword()->value); + } + /** @test */ public function user_name_is_accessible() diff --git a/tests/responses/applications/samlApplication.json b/tests/responses/applications/samlApplication.json new file mode 100644 index 0000000000..df473dee1b --- /dev/null +++ b/tests/responses/applications/samlApplication.json @@ -0,0 +1,105 @@ +{ + "id": "0oav8uiWzPDrDMYxU0g3", + "name": "testorgone_examplecustomsaml20app_1", + "label": "Example Custom SAML 2.0 App", + "status": "ACTIVE", + "lastUpdated": "2016-06-29T19:57:33.000Z", + "created": "2016-06-29T19:57:33.000Z", + "accessibility": { + "selfService": false, + "errorRedirectUrl": null, + "loginRedirectUrl": null + }, + "visibility": { + "autoSubmitToolbar": false, + "hide": { + "iOS": false, + "web": false + }, + "appLinks": { + "testorgone_examplecustomsaml20app_6_link": true + } + }, + "features": [], + "signOnMode": "SAML_2_0", + "credentials": { + "userNameTemplate": { + "template": "${source.login}", + "type": "BUILT_IN" + }, + "signing": {} + }, + "settings": { + "app": {}, + "notifications": { + "vpn": { + "network": { + "connection": "DISABLED" + }, + "message": null, + "helpUrl": null + } + }, + "signOn": { + "defaultRelayState": null, + "ssoAcsUrl": "http://testorgone.okta", + "idpIssuer": "http://www.okta.com/${org.externalKey}", + "audience": "asdqwe123", + "recipient": "http://testorgone.okta", + "destination": "http://testorgone.okta", + "subjectNameIdTemplate": "${user.userName}", + "subjectNameIdFormat": "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified", + "responseSigned": true, + "assertionSigned": true, + "signatureAlgorithm": "RSA_SHA256", + "digestAlgorithm": "SHA256", + "honorForceAuthn": true, + "authnContextClassRef": "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport", + "spIssuer": null, + "requestCompressed": false, + "attributeStatements": [ + { + "type": "EXPRESSION", + "name": "Attribute", + "namespace": "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified", + "values": [ + "Value" + ] + } + ] + } + }, + "_links": { + "logo": [ + { + "name": "medium", + "href": "http://testorgone.okta.com/assets/img/logos/default.6770228fb0dab49a1695ef440a5279bb.png", + "type": "image/png" + } + ], + "appLinks": [ + { + "name": "testorgone_examplecustomsaml20app_6_link", + "href": "http://testorgone.okta.com/home/testorgone_examplecustomsaml20app_6/0oav8uiWzPDrDMYxU0g3/alnvjz6hLyuTZadi80g3", + "type": "text/html" + } + ], + "help": { + "href": "http://testorgone-admin.okta.com/app/testorgone_examplecustomsaml20app_6/0oav8uiWzPDrDMYxU0g3/setup/help/SAML_2_0/instructions", + "type": "text/html" + }, + "users": { + "href": "http://testorgone.okta.com/api/v1/apps/0oav8uiWzPDrDMYxU0g3/users" + }, + "deactivate": { + "href": "http://testorgone.okta.com/api/v1/apps/0oav8uiWzPDrDMYxU0g3/lifecycle/deactivate" + }, + "groups": { + "href": "http://testorgone.okta.com/api/v1/apps/0oav8uiWzPDrDMYxU0g3/groups" + }, + "metadata": { + "href": "http://testorgone.okta.com:/api/v1/apps/0oav8uiWzPDrDMYxU0g3/sso/saml/metadata", + "type": "application/xml" + } + } +} \ No newline at end of file diff --git a/tests/responses/applications/swaApplication.json b/tests/responses/applications/swaApplication.json new file mode 100644 index 0000000000..05806cd6ce --- /dev/null +++ b/tests/responses/applications/swaApplication.json @@ -0,0 +1,61 @@ +{ + "id": "0oabkvBLDEKCNXBGYUAS", + "name": "template_swa", + "label": "Sample Plugin App", + "status": "ACTIVE", + "lastUpdated": "2013-09-11T17:58:54.000Z", + "created": "2013-09-11T17:46:08.000Z", + "accessibility": { + "selfService": false, + "errorRedirectUrl": null + }, + "visibility": { + "autoSubmitToolbar": false, + "hide": { + "iOS": false, + "web": false + }, + "appLinks": { + "login": true + } + }, + "features": [], + "signOnMode": "BROWSER_PLUGIN", + "credentials": { + "scheme": "EDIT_USERNAME_AND_PASSWORD", + "userNameTemplate": { + "template": "${source.login}", + "type": "BUILT_IN" + } + }, + "settings": { + "app": { + "buttonField": "btn-login", + "passwordField": "txtbox-password", + "usernameField": "txtbox-username", + "url": "https://example.com/login.html", + "loginUrlRegex": "REGEX_EXPRESSION" + } + }, + "_links": { + "logo": [ + { + "href": "https:/example.okta.com/img/logos/logo_1.png", + "name": "medium", + "type": "image/png" + } + ], + "users": { + "href": "https://php.oktapreview.com/api/v1/apps/0oabkvBLDEKCNXBGYUAS/users" + }, + "groups": { + "href": "https://php.oktapreview.com/api/v1/apps/0oabkvBLDEKCNXBGYUAS/groups" + }, + "self": { + "href": "https://php.oktapreview.com/api/v1/apps/0oabkvBLDEKCNXBGYUAS" + }, + "deactivate": { + "href": "https://php.oktapreview.com/api/v1/apps/0oabkvBLDEKCNXBGYUAS/lifecycle/deactivate" + } + } +} \ No newline at end of file From 7d20d71809d7741d65f6fce3f278a47a50e3d1a0 Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Thu, 30 Nov 2017 16:56:21 -0500 Subject: [PATCH 16/22] Fixed Tests --- openapi/generator/templates/model.php.hbs | 12 ++++++++ src/Applications/Application.php | 16 ++++------ src/Generated/Applications/Application.php | 4 ++- .../ApplicationCredentialsOAuthClient.php | 30 ------------------- src/Generated/Users/User.php | 2 +- tests/Integration/ApplicationsTest.php | 2 +- .../ApplicationCredentialsOAuthClientTest.php | 20 ------------- tests/Unit/Applications/ApplicationTest.php | 12 +++++--- .../OAuthApplicationCredentialsTest.php | 8 ++--- 9 files changed, 34 insertions(+), 72 deletions(-) diff --git a/openapi/generator/templates/model.php.hbs b/openapi/generator/templates/model.php.hbs index bc35f6040b..486ef72b70 100644 --- a/openapi/generator/templates/model.php.hbs +++ b/openapi/generator/templates/model.php.hbs @@ -46,6 +46,18 @@ class {{modelName}} extends {{getExtends modelName}} "{{getCrudOperationPath this}}" ); return $factor->convertFromGenericFactor(); + } + {{else if (eq this.operation.operationId "getApplication")}} + public function get($query) + { + $application = \Okta\Client::getInstance() + ->getDataStore() + ->getResource( + $query, + \\{{this.defaultReturnType}}::class, + "{{getCrudOperationPath this}}" + ); + return $application->convertFromGenericApplication(); } {{else}} public function get($query) diff --git a/src/Applications/Application.php b/src/Applications/Application.php index 02fd22a1a4..7ad2eb833a 100644 --- a/src/Applications/Application.php +++ b/src/Applications/Application.php @@ -19,15 +19,9 @@ class Application extends \Okta\Generated\Applications\Application { - public function get($query) + public function convertFromGenericApplication() { - $application = parent::get($query); - return $this->convertFromGenericApplication($application); - } - - public function convertFromGenericApplication($application) - { - switch($application->getSignOnMode()) { + switch($this->getSignOnMode()) { case "BOOKMARK": $appClass = \Okta\Applications\BookmarkApplication::class; break; @@ -35,7 +29,7 @@ public function convertFromGenericApplication($application) $appClass = \Okta\Applications\BasicAuthApplication::class; break; case "BROWSER_PLUGIN": - switch($application->getName()) { + switch($this->getName()) { case "template_swa": $appClass = \Okta\Applications\SwaApplication::class; break; @@ -62,8 +56,8 @@ public function convertFromGenericApplication($application) } $properties = new \stdClass(); - foreach ($application->getPropertyNames() as $name) { - $properties->$name = $application->getProperty($name); + foreach ($this->getPropertyNames() as $name) { + $properties->$name = $this->getProperty($name); } return new $appClass(null, $properties); diff --git a/src/Generated/Applications/Application.php b/src/Generated/Applications/Application.php index 185f87c7bc..01a9ae0435 100644 --- a/src/Generated/Applications/Application.php +++ b/src/Generated/Applications/Application.php @@ -39,13 +39,15 @@ class Application extends \Okta\Resource\AbstractResource public function get($query) { - return \Okta\Client::getInstance() + $application = \Okta\Client::getInstance() ->getDataStore() ->getResource( $query, \Okta\Applications\Application::class, "/apps" ); + + return $application->convertFromGenericApplication(); } public function save() { diff --git a/src/Generated/Applications/ApplicationCredentialsOAuthClient.php b/src/Generated/Applications/ApplicationCredentialsOAuthClient.php index 03e50b7e50..f7402d1f7d 100644 --- a/src/Generated/Applications/ApplicationCredentialsOAuthClient.php +++ b/src/Generated/Applications/ApplicationCredentialsOAuthClient.php @@ -35,21 +35,6 @@ public function getClientId(): string { return $this->getProperty(self::CLIENT_ID); } - /** - * Set the client_id. - * - * @param mixed $client_id The value to set. - * @return self - */ - public function setClientId($client_id) - { - $this->setProperty( - self::CLIENT_ID, - $client_id - ); - - return $this; - } /** * Get the client_secret. * @@ -59,21 +44,6 @@ public function getClientSecret(): string { return $this->getProperty(self::CLIENT_SECRET); } - /** - * Set the client_secret. - * - * @param mixed $client_secret The value to set. - * @return self - */ - public function setClientSecret($client_secret) - { - $this->setProperty( - self::CLIENT_SECRET, - $client_secret - ); - - return $this; - } /** * Get the autoKeyRotation. * diff --git a/src/Generated/Users/User.php b/src/Generated/Users/User.php index 332d251c4e..23b6ae86a3 100644 --- a/src/Generated/Users/User.php +++ b/src/Generated/Users/User.php @@ -59,7 +59,7 @@ public function get($query) "/users" ); } - public function save() + public function save() { return \Okta\Client::getInstance() ->getDataStore() diff --git a/tests/Integration/ApplicationsTest.php b/tests/Integration/ApplicationsTest.php index 69ac233308..acecf986ab 100644 --- a/tests/Integration/ApplicationsTest.php +++ b/tests/Integration/ApplicationsTest.php @@ -15,7 +15,7 @@ * limitations under the License. * ******************************************************************************/ -class FactorsTest extends BaseTestCase +class ApplicationsTest extends BaseTestCase { /** @test */ diff --git a/tests/Unit/Applications/ApplicationCredentialsOAuthClientTest.php b/tests/Unit/Applications/ApplicationCredentialsOAuthClientTest.php index dd724421f5..47bdbeb3ec 100644 --- a/tests/Unit/Applications/ApplicationCredentialsOAuthClientTest.php +++ b/tests/Unit/Applications/ApplicationCredentialsOAuthClientTest.php @@ -40,16 +40,6 @@ public function client_id_is_accessible() $this->assertEquals($this->properties->client_id, $this->testable->clientId); } - /** @test */ - public function client_id_is_settable() - { - $this->testable->setClientId('abc'); - $this->assertEquals('abc', $this->testable->getClientId()); - - $this->testable->clientId = '123'; - $this->assertEquals('123', $this->testable->getClientId()); - } - /** @test */ public function client_secret_is_accessible() { @@ -57,16 +47,6 @@ public function client_secret_is_accessible() $this->assertEquals($this->properties->client_secret, $this->testable->clientSecret); } - /** @test */ - public function client_secret_is_settable() - { - $this->testable->setClientSecret('abc'); - $this->assertEquals('abc', $this->testable->getClientSecret()); - - $this->testable->clientSecret = '123'; - $this->assertEquals('123', $this->testable->getClientSecret()); - } - /** @test */ public function auto_key_rotation_is_accessible() { diff --git a/tests/Unit/Applications/ApplicationTest.php b/tests/Unit/Applications/ApplicationTest.php index 44037638cd..642650aa2e 100644 --- a/tests/Unit/Applications/ApplicationTest.php +++ b/tests/Unit/Applications/ApplicationTest.php @@ -31,11 +31,13 @@ class ApplicationTest extends BaseUnitTestCase /** @test */ public function getting_an_application_will_make_request_to_correct_endpoint() { - $client = $this->createNewHttpClient(); + $httpClient = $this->createNewHttpClient([ + "getBody" => '{"id":"abc123", "signOnMode": "BOOKMARK"}' + ]); $this->testable->get('abc123'); - $requests = $client->getRequests(); + $requests = $httpClient->getRequests(); $this->assertEquals('/api/v1/apps/abc123', $requests[0]->getUri()->getPath()); $this->assertEquals('GET', $requests[0]->getMethod()); @@ -44,11 +46,13 @@ public function getting_an_application_will_make_request_to_correct_endpoint() /** @test */ public function getting_an_application_will_return_application_object() { - $client = $this->createNewHttpClient(); + $client = $this->createNewHttpClient([ + "getBody" => '{"id":"abc123", "signOnMode": "BOOKMARK"}' + ]); $app = $this->testable->get('abc123'); - $this->assertInstanceOf(Application::class, $app); + $this->assertInstanceOf(\Okta\Applications\BookmarkApplication::class, $app); } /** @test */ diff --git a/tests/Unit/Applications/OAuthApplicationCredentialsTest.php b/tests/Unit/Applications/OAuthApplicationCredentialsTest.php index 6b35d579ac..405f19890a 100644 --- a/tests/Unit/Applications/OAuthApplicationCredentialsTest.php +++ b/tests/Unit/Applications/OAuthApplicationCredentialsTest.php @@ -48,13 +48,13 @@ public function oauth_client_is_settable() { $client = $this->testable->getOauthClient(); - $client->clientId = 'abc'; + $client->autoKeyRotation = true; $this->testable->setOauthClient($client); - $this->assertEquals('abc', $this->testable->getOauthClient()->clientId); + $this->assertEquals(true, $this->testable->getOauthClient()->autoKeyRotation); - $client->clientId = '123'; + $client->autoKeyRotation = false; $this->testable->oauthClient = $client; - $this->assertEquals('123', $this->testable->getOauthClient()->clientId); + $this->assertEquals(false, $this->testable->getOauthClient()->autoKeyRotation); } From cd8bb5de2a3ad9a7f13b9d8a59e3b6e20b5896a0 Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Thu, 30 Nov 2017 16:57:44 -0500 Subject: [PATCH 17/22] Rebuild Resources --- .../AppUserPasswordCredential.php | 1 - src/Applications/Application.php | 4 +-- src/Applications/JsonWebKey.php | 2 +- src/Applications/SamlAttributeStatement.php | 2 +- src/Generated/Applications/AppUser.php | 5 ++- .../Applications/AppUserCredentials.php | 1 - .../AppUserPasswordCredential.php | 1 - src/Generated/Applications/Application.php | 2 -- .../Applications/ApplicationAccessibility.php | 1 - .../Applications/ApplicationCredentials.php | 1 - .../ApplicationCredentialsOAuthClient.php | 1 - .../ApplicationCredentialsSigning.php | 1 - ...ApplicationCredentialsUsernameTemplate.php | 1 - .../ApplicationGroupAssignment.php | 3 +- .../Applications/ApplicationLicensing.php | 1 - .../Applications/ApplicationSettings.php | 1 - .../ApplicationSettingsApplication.php | 1 - .../ApplicationSettingsNotifications.php | 1 - .../ApplicationSettingsNotificationsVpn.php | 1 - ...icationSettingsNotificationsVpnNetwork.php | 1 - .../Applications/ApplicationTemplateName.php | 31 ------------------- .../Applications/ApplicationVisibility.php | 1 - .../ApplicationVisibilityHide.php | 1 - .../Applications/AutoLoginApplication.php | 1 - .../AutoLoginApplicationSettings.php | 1 - .../AutoLoginApplicationSettingsSignOn.php | 1 - .../Applications/BasicApplicationSettings.php | 1 - .../BasicApplicationSettingsApplication.php | 1 - .../Applications/BasicAuthApplication.php | 1 - .../Applications/BookmarkApplication.php | 1 - .../BookmarkApplicationSettings.php | 1 - ...BookmarkApplicationSettingsApplication.php | 1 - .../Applications/BrowserPluginApplication.php | 1 - src/Generated/Applications/JsonWebKey.php | 1 - .../OAuthApplicationCredentials.php | 1 - .../Applications/OpenIdConnectApplication.php | 1 - .../OpenIdConnectApplicationSettings.php | 1 - ...OpenIdConnectApplicationSettingsClient.php | 1 - .../Applications/SamlApplication.php | 1 - .../Applications/SamlApplicationSettings.php | 1 - .../SamlApplicationSettingsSignOn.php | 1 - .../Applications/SamlAttributeStatement.php | 1 - .../SchemeApplicationCredentials.php | 1 - .../SecurePasswordStoreApplication.php | 1 - ...SecurePasswordStoreApplicationSettings.php | 1 - ...ordStoreApplicationSettingsApplication.php | 1 - src/Generated/Applications/SwaApplication.php | 1 - .../Applications/SwaApplicationSettings.php | 1 - .../SwaApplicationSettingsApplication.php | 1 - .../Applications/SwaThreeFieldApplication.php | 1 - .../SwaThreeFieldApplicationSettings.php | 1 - ...reeFieldApplicationSettingsApplication.php | 1 - .../Applications/WsFederationApplication.php | 1 - .../WsFederationApplicationSettings.php | 1 - ...derationApplicationSettingsApplication.php | 1 - src/Generated/GroupRules/GroupRule.php | 1 - src/Generated/GroupRules/GroupRuleAction.php | 1 - .../GroupRules/GroupRuleConditions.php | 1 - .../GroupRules/GroupRuleExpression.php | 1 - .../GroupRules/GroupRuleGroupAssignment.php | 1 - .../GroupRules/GroupRuleGroupCondition.php | 1 - .../GroupRules/GroupRulePeopleCondition.php | 1 - .../GroupRules/GroupRuleUserCondition.php | 1 - src/Generated/Groups/GroupProfile.php | 1 - src/Generated/UserFactors/CallFactor.php | 1 - .../UserFactors/CallFactorProfile.php | 1 - src/Generated/UserFactors/EmailFactor.php | 1 - .../UserFactors/EmailFactorProfile.php | 1 - src/Generated/UserFactors/Factor.php | 1 - src/Generated/UserFactors/FactorProfile.php | 1 - src/Generated/UserFactors/HardwareFactor.php | 1 - .../UserFactors/HardwareFactorProfile.php | 1 - src/Generated/UserFactors/PushFactor.php | 1 - .../UserFactors/PushFactorProfile.php | 1 - .../UserFactors/SecurityQuestion.php | 1 - .../UserFactors/SecurityQuestionFactor.php | 1 - .../SecurityQuestionFactorProfile.php | 1 - src/Generated/UserFactors/SmsFactor.php | 1 - .../UserFactors/SmsFactorProfile.php | 1 - src/Generated/UserFactors/TokenFactor.php | 1 - .../UserFactors/TokenFactorProfile.php | 1 - src/Generated/UserFactors/TotpFactor.php | 1 - .../UserFactors/TotpFactorProfile.php | 1 - .../UserFactors/VerifyFactorRequest.php | 1 - .../UserFactors/VerifyFactorResponse.php | 1 - src/Generated/UserFactors/WebFactor.php | 1 - .../UserFactors/WebFactorProfile.php | 1 - src/Generated/Users/AppLink.php | 1 - .../Users/AuthenticationProvider.php | 1 - src/Generated/Users/ChangePasswordRequest.php | 1 - .../Users/ForgotPasswordResponse.php | 1 - src/Generated/Users/PasswordCredential.php | 1 - .../Users/RecoveryQuestionCredential.php | 1 - src/Generated/Users/ResetPasswordToken.php | 1 - src/Generated/Users/Role.php | 1 - src/Generated/Users/TempPassword.php | 1 - src/Generated/Users/User.php | 18 +++++------ src/Generated/Users/UserActivationToken.php | 1 - src/Generated/Users/UserCredentials.php | 1 - src/Generated/Users/UserProfile.php | 1 - 100 files changed, 16 insertions(+), 143 deletions(-) delete mode 100644 src/Generated/Applications/ApplicationTemplateName.php diff --git a/src/Applications/AppUserPasswordCredential.php b/src/Applications/AppUserPasswordCredential.php index af55e07a14..c5ba1fe78d 100644 --- a/src/Applications/AppUserPasswordCredential.php +++ b/src/Applications/AppUserPasswordCredential.php @@ -17,7 +17,6 @@ namespace Okta\Applications; - class AppUserPasswordCredential extends \Okta\Generated\Applications\AppUserPasswordCredential { diff --git a/src/Applications/Application.php b/src/Applications/Application.php index 7ad2eb833a..4254683a64 100644 --- a/src/Applications/Application.php +++ b/src/Applications/Application.php @@ -21,7 +21,7 @@ class Application extends \Okta\Generated\Applications\Application { public function convertFromGenericApplication() { - switch($this->getSignOnMode()) { + switch ($this->getSignOnMode()) { case "BOOKMARK": $appClass = \Okta\Applications\BookmarkApplication::class; break; @@ -29,7 +29,7 @@ public function convertFromGenericApplication() $appClass = \Okta\Applications\BasicAuthApplication::class; break; case "BROWSER_PLUGIN": - switch($this->getName()) { + switch ($this->getName()) { case "template_swa": $appClass = \Okta\Applications\SwaApplication::class; break; diff --git a/src/Applications/JsonWebKey.php b/src/Applications/JsonWebKey.php index 23f7297ab9..7ee42ee5d4 100644 --- a/src/Applications/JsonWebKey.php +++ b/src/Applications/JsonWebKey.php @@ -20,4 +20,4 @@ class JsonWebKey extends \Okta\Generated\Applications\JsonWebKey { -} \ No newline at end of file +} diff --git a/src/Applications/SamlAttributeStatement.php b/src/Applications/SamlAttributeStatement.php index e72a88ee72..852fe731b0 100644 --- a/src/Applications/SamlAttributeStatement.php +++ b/src/Applications/SamlAttributeStatement.php @@ -20,4 +20,4 @@ class SamlAttributeStatement extends \Okta\Generated\Applications\SamlAttributeStatement { -} \ No newline at end of file +} diff --git a/src/Generated/Applications/AppUser.php b/src/Generated/Applications/AppUser.php index bb43ac412b..d88f76599e 100644 --- a/src/Generated/Applications/AppUser.php +++ b/src/Generated/Applications/AppUser.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class AppUser extends \Okta\Resource\AbstractResource { const ID = 'id'; @@ -36,7 +35,7 @@ class AppUser extends \Okta\Resource\AbstractResource const PASSWORD_CHANGED = 'passwordChanged'; - public function save( $appId ) + public function save($appId) { return \Okta\Client::getInstance() ->getDataStore() @@ -47,7 +46,7 @@ public function save( $appId ) ); } - public function delete( $appId ) + public function delete($appId) { return \Okta\Client::getInstance() ->getDataStore() diff --git a/src/Generated/Applications/AppUserCredentials.php b/src/Generated/Applications/AppUserCredentials.php index 1ac50e1d8e..ec3c41a397 100644 --- a/src/Generated/Applications/AppUserCredentials.php +++ b/src/Generated/Applications/AppUserCredentials.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class AppUserCredentials extends \Okta\Resource\AbstractResource { const PASSWORD = 'password'; diff --git a/src/Generated/Applications/AppUserPasswordCredential.php b/src/Generated/Applications/AppUserPasswordCredential.php index 2c51e2eb7c..faafb66ae5 100644 --- a/src/Generated/Applications/AppUserPasswordCredential.php +++ b/src/Generated/Applications/AppUserPasswordCredential.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class AppUserPasswordCredential extends \Okta\Resource\AbstractResource { const VALUE = 'value'; diff --git a/src/Generated/Applications/Application.php b/src/Generated/Applications/Application.php index 01a9ae0435..f190703dc0 100644 --- a/src/Generated/Applications/Application.php +++ b/src/Generated/Applications/Application.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class Application extends \Okta\Resource\AbstractResource { const ID = 'id'; @@ -46,7 +45,6 @@ public function get($query) \Okta\Applications\Application::class, "/apps" ); - return $application->convertFromGenericApplication(); } public function save() diff --git a/src/Generated/Applications/ApplicationAccessibility.php b/src/Generated/Applications/ApplicationAccessibility.php index 27469cd3d2..a0b4acf3e7 100644 --- a/src/Generated/Applications/ApplicationAccessibility.php +++ b/src/Generated/Applications/ApplicationAccessibility.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationAccessibility extends \Okta\Resource\AbstractResource { const SELF_SERVICE = 'selfService'; diff --git a/src/Generated/Applications/ApplicationCredentials.php b/src/Generated/Applications/ApplicationCredentials.php index 7c3bd1d8f5..9016b87c32 100644 --- a/src/Generated/Applications/ApplicationCredentials.php +++ b/src/Generated/Applications/ApplicationCredentials.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationCredentials extends \Okta\Resource\AbstractResource { const SIGNING = 'signing'; diff --git a/src/Generated/Applications/ApplicationCredentialsOAuthClient.php b/src/Generated/Applications/ApplicationCredentialsOAuthClient.php index f7402d1f7d..797943f211 100644 --- a/src/Generated/Applications/ApplicationCredentialsOAuthClient.php +++ b/src/Generated/Applications/ApplicationCredentialsOAuthClient.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationCredentialsOAuthClient extends \Okta\Resource\AbstractResource { const CLIENT_ID = 'client_id'; diff --git a/src/Generated/Applications/ApplicationCredentialsSigning.php b/src/Generated/Applications/ApplicationCredentialsSigning.php index a0fcf4587a..ba46c0530b 100644 --- a/src/Generated/Applications/ApplicationCredentialsSigning.php +++ b/src/Generated/Applications/ApplicationCredentialsSigning.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationCredentialsSigning extends \Okta\Resource\AbstractResource { const KID = 'kid'; diff --git a/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php b/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php index 1e439fed6e..6df0d9f9a2 100644 --- a/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php +++ b/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationCredentialsUsernameTemplate extends \Okta\Resource\AbstractResource { const TYPE = 'type'; diff --git a/src/Generated/Applications/ApplicationGroupAssignment.php b/src/Generated/Applications/ApplicationGroupAssignment.php index bcf999a480..e83aed1f67 100644 --- a/src/Generated/Applications/ApplicationGroupAssignment.php +++ b/src/Generated/Applications/ApplicationGroupAssignment.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationGroupAssignment extends \Okta\Resource\AbstractResource { const ID = 'id'; @@ -28,7 +27,7 @@ class ApplicationGroupAssignment extends \Okta\Resource\AbstractResource const LAST_UPDATED = 'lastUpdated'; - public function delete( $appId ) + public function delete($appId) { return \Okta\Client::getInstance() ->getDataStore() diff --git a/src/Generated/Applications/ApplicationLicensing.php b/src/Generated/Applications/ApplicationLicensing.php index b643e7db90..15bd5ee171 100644 --- a/src/Generated/Applications/ApplicationLicensing.php +++ b/src/Generated/Applications/ApplicationLicensing.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationLicensing extends \Okta\Resource\AbstractResource { const SEAT_COUNT = 'seatCount'; diff --git a/src/Generated/Applications/ApplicationSettings.php b/src/Generated/Applications/ApplicationSettings.php index 1463a949c3..5c97cb0030 100644 --- a/src/Generated/Applications/ApplicationSettings.php +++ b/src/Generated/Applications/ApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationSettings extends \Okta\Resource\AbstractResource { const APP = 'app'; diff --git a/src/Generated/Applications/ApplicationSettingsApplication.php b/src/Generated/Applications/ApplicationSettingsApplication.php index 0f67ac958c..9a68e7f2cc 100644 --- a/src/Generated/Applications/ApplicationSettingsApplication.php +++ b/src/Generated/Applications/ApplicationSettingsApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationSettingsApplication extends \Okta\Resource\AbstractResource { diff --git a/src/Generated/Applications/ApplicationSettingsNotifications.php b/src/Generated/Applications/ApplicationSettingsNotifications.php index 841647e26c..b8da7fc7f6 100644 --- a/src/Generated/Applications/ApplicationSettingsNotifications.php +++ b/src/Generated/Applications/ApplicationSettingsNotifications.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationSettingsNotifications extends \Okta\Resource\AbstractResource { const VPN = 'vpn'; diff --git a/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php b/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php index e0f7ae850b..8a7df15153 100644 --- a/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php +++ b/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationSettingsNotificationsVpn extends \Okta\Resource\AbstractResource { const HELP_URL = 'helpUrl'; diff --git a/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php b/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php index 222e2aa381..14d3ca48c6 100644 --- a/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php +++ b/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationSettingsNotificationsVpnNetwork extends \Okta\Resource\AbstractResource { const EXCLUDE = 'exclude'; diff --git a/src/Generated/Applications/ApplicationTemplateName.php b/src/Generated/Applications/ApplicationTemplateName.php deleted file mode 100644 index 0b3fdaa16a..0000000000 --- a/src/Generated/Applications/ApplicationTemplateName.php +++ /dev/null @@ -1,31 +0,0 @@ -getDataStore() - ->saveResource( - "/users", - $this, - \Okta\Users\User::class - ); + ->getDataStore() + ->saveResource( + "/users", + $this, + \Okta\Users\User::class + ); } public function delete() { @@ -395,7 +395,7 @@ public function getGroupTargetsForRole($roleId, array $options = []): \Okta\Grou /** - * + * * * * @return mixed|null @@ -415,7 +415,7 @@ public function removeGroupTargetFromRole($roleId, $groupId) /** - * + * * * * @return mixed|null diff --git a/src/Generated/Users/UserActivationToken.php b/src/Generated/Users/UserActivationToken.php index 098b7a1c52..5779f34763 100644 --- a/src/Generated/Users/UserActivationToken.php +++ b/src/Generated/Users/UserActivationToken.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Users; - class UserActivationToken extends \Okta\Resource\AbstractResource { const ACTIVATION_URL = 'activationUrl'; diff --git a/src/Generated/Users/UserCredentials.php b/src/Generated/Users/UserCredentials.php index bb7af020d8..ba91df803d 100644 --- a/src/Generated/Users/UserCredentials.php +++ b/src/Generated/Users/UserCredentials.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Users; - class UserCredentials extends \Okta\Resource\AbstractResource { const PASSWORD = 'password'; diff --git a/src/Generated/Users/UserProfile.php b/src/Generated/Users/UserProfile.php index 7eb577d104..2c99b24e73 100644 --- a/src/Generated/Users/UserProfile.php +++ b/src/Generated/Users/UserProfile.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Users; - class UserProfile extends \Okta\Resource\AbstractResource { const EMAIL = 'email'; From e88964dc8a8e5440823246644909b397ed9daa80 Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Fri, 1 Dec 2017 13:42:40 -0500 Subject: [PATCH 18/22] Fixes typo --- openapi/generator/index.js | 26 ++++++++-------- src/Applications/BookmarkApplication.php | 2 +- src/Generated/Applications/AppUser.php | 5 +-- .../Applications/AppUserCredentials.php | 1 + .../AppUserPasswordCredential.php | 1 + src/Generated/Applications/Application.php | 1 + .../Applications/ApplicationAccessibility.php | 1 + .../Applications/ApplicationCredentials.php | 1 + .../ApplicationCredentialsOAuthClient.php | 31 +++++++++++++++++++ .../ApplicationCredentialsSigning.php | 1 + ...ApplicationCredentialsUsernameTemplate.php | 1 + .../ApplicationGroupAssignment.php | 3 +- .../Applications/ApplicationLicensing.php | 1 + .../Applications/ApplicationSettings.php | 1 + .../ApplicationSettingsApplication.php | 1 + .../ApplicationSettingsNotifications.php | 1 + .../ApplicationSettingsNotificationsVpn.php | 1 + ...icationSettingsNotificationsVpnNetwork.php | 1 + .../Applications/ApplicationVisibility.php | 1 + .../ApplicationVisibilityHide.php | 1 + .../Applications/AutoLoginApplication.php | 1 + .../AutoLoginApplicationSettings.php | 1 + .../AutoLoginApplicationSettingsSignOn.php | 1 + .../Applications/BasicApplicationSettings.php | 1 + .../BasicApplicationSettingsApplication.php | 1 + .../Applications/BasicAuthApplication.php | 1 + .../Applications/BookmarkApplication.php | 11 ++++--- .../BookmarkApplicationSettings.php | 11 ++++--- ...BookmarkApplicationSettingsApplication.php | 3 +- .../Applications/BrowserPluginApplication.php | 1 + src/Generated/Applications/JsonWebKey.php | 1 + .../OAuthApplicationCredentials.php | 1 + .../Applications/OpenIdConnectApplication.php | 1 + .../OpenIdConnectApplicationSettings.php | 1 + ...OpenIdConnectApplicationSettingsClient.php | 1 + .../Applications/SamlApplication.php | 1 + .../Applications/SamlApplicationSettings.php | 1 + .../SamlApplicationSettingsSignOn.php | 1 + .../Applications/SamlAttributeStatement.php | 1 + .../SchemeApplicationCredentials.php | 1 + .../SecurePasswordStoreApplication.php | 1 + ...SecurePasswordStoreApplicationSettings.php | 1 + ...ordStoreApplicationSettingsApplication.php | 1 + src/Generated/Applications/SwaApplication.php | 1 + .../Applications/SwaApplicationSettings.php | 1 + .../SwaApplicationSettingsApplication.php | 1 + .../Applications/SwaThreeFieldApplication.php | 1 + .../SwaThreeFieldApplicationSettings.php | 1 + ...reeFieldApplicationSettingsApplication.php | 1 + .../Applications/WsFederationApplication.php | 1 + .../WsFederationApplicationSettings.php | 1 + ...derationApplicationSettingsApplication.php | 1 + src/Generated/GroupRules/GroupRule.php | 1 + src/Generated/GroupRules/GroupRuleAction.php | 1 + .../GroupRules/GroupRuleConditions.php | 1 + .../GroupRules/GroupRuleExpression.php | 1 + .../GroupRules/GroupRuleGroupAssignment.php | 1 + .../GroupRules/GroupRuleGroupCondition.php | 1 + .../GroupRules/GroupRulePeopleCondition.php | 1 + .../GroupRules/GroupRuleUserCondition.php | 1 + src/Generated/Groups/GroupProfile.php | 1 + src/Generated/UserFactors/CallFactor.php | 1 + .../UserFactors/CallFactorProfile.php | 1 + src/Generated/UserFactors/EmailFactor.php | 1 + .../UserFactors/EmailFactorProfile.php | 1 + src/Generated/UserFactors/Factor.php | 1 + src/Generated/UserFactors/FactorProfile.php | 1 + src/Generated/UserFactors/FactorProvider.php | 31 +++++++++++++++++++ src/Generated/UserFactors/FactorType.php | 1 + src/Generated/UserFactors/HardwareFactor.php | 1 + .../UserFactors/HardwareFactorProfile.php | 1 + src/Generated/UserFactors/PushFactor.php | 1 + .../UserFactors/PushFactorProfile.php | 1 + .../UserFactors/SecurityQuestion.php | 1 + .../UserFactors/SecurityQuestionFactor.php | 1 + .../SecurityQuestionFactorProfile.php | 1 + src/Generated/UserFactors/SmsFactor.php | 1 + .../UserFactors/SmsFactorProfile.php | 1 + src/Generated/UserFactors/TokenFactor.php | 1 + .../UserFactors/TokenFactorProfile.php | 1 + src/Generated/UserFactors/TotpFactor.php | 1 + .../UserFactors/TotpFactorProfile.php | 1 + .../UserFactors/VerifyFactorRequest.php | 1 + .../UserFactors/VerifyFactorResponse.php | 1 + src/Generated/UserFactors/WebFactor.php | 1 + .../UserFactors/WebFactorProfile.php | 1 + src/Generated/Users/AppLink.php | 1 + .../Users/AuthenticationProvider.php | 1 + src/Generated/Users/ChangePasswordRequest.php | 1 + .../Users/ForgotPasswordResponse.php | 1 + src/Generated/Users/PasswordCredential.php | 1 + .../Users/RecoveryQuestionCredential.php | 1 + src/Generated/Users/ResetPasswordToken.php | 1 + src/Generated/Users/Role.php | 1 + src/Generated/Users/TempPassword.php | 1 + src/Generated/Users/User.php | 18 +++++------ src/Generated/Users/UserActivationToken.php | 1 + src/Generated/Users/UserCredentials.php | 1 + src/Generated/Users/UserProfile.php | 1 + 99 files changed, 193 insertions(+), 37 deletions(-) create mode 100644 src/Generated/UserFactors/FactorProvider.php diff --git a/openapi/generator/index.js b/openapi/generator/index.js index f01d7e85c3..86b9a09a5c 100644 --- a/openapi/generator/index.js +++ b/openapi/generator/index.js @@ -24,7 +24,7 @@ function getType(obj, model) { case 'AutoLoginApplicationSettings': case 'BasicAuthApplicationSettings': case 'BasicApplicationSettings': - case 'BookmarApplicationSettings': + case 'BookmarkApplicationSettings': case 'BrowserPluginApplicationSettings': case 'OpenIdConnectApplicationSettings': case 'SamlApplicationSettings': @@ -36,7 +36,7 @@ function getType(obj, model) { case 'AutoLoginApplicationSettingsApplication': case 'BasicAuthApplicationSettingsApplication': case 'BasicApplicationSettingsApplication': - case 'BookmarApplicationSettingsApplication': + case 'BookmarkApplicationSettingsApplication': case 'BrowserPluginApplicationSettingsApplication': case 'OpenIdConnectApplicationSettingsApplication': case 'SamlApplicationSettingsApplication': @@ -47,7 +47,7 @@ function getType(obj, model) { return '\\Okta\\Applications\\ApplicationSettingsApplication'; case 'AutoLoginApplicationCredentials': case 'BasicAuthApplicationCredentials': - case 'BookmarApplicationCredentials': + case 'BookmarkApplicationCredentials': case 'BrowserPluginApplicationCredentials': case 'OAuthApplicationCredentials': case 'OpenIdConnectApplicationCredentials': @@ -92,7 +92,7 @@ function getSafeType(obj, model) { case 'AutoLoginApplicationSettings': case 'BasicAuthApplicationSettings': case 'BasicApplicationSettings': - case 'BookmarApplicationSettings': + case 'BookmarkApplicationSettings': case 'BrowserPluginApplicationSettings': case 'OpenIdConnectApplicationSettings': case 'SamlApplicationSettings': @@ -103,7 +103,7 @@ function getSafeType(obj, model) { return ': \\Okta\\Applications\\ApplicationSettings'; case 'AutoLoginApplicationCredentials': case 'BasicAuthApplicationCredentials': - case 'BookmarApplicationCredentials': + case 'BookmarkApplicationCredentials': case 'BrowserPluginApplicationCredentials': case 'OAuthApplicationCredentials': case 'OpenIdConnectApplicationCredentials': @@ -115,7 +115,7 @@ function getSafeType(obj, model) { case 'AutoLoginApplicationSettingsApplication': case 'BasicAuthApplicationSettingsApplication': case 'BasicApplicationSettingsApplication': - case 'BookmarApplicationSettingsApplication': + case 'BookmarkApplicationSettingsApplication': case 'BrowserPluginApplicationSettingsApplication': case 'OpenIdConnectApplicationSettingsApplication': case 'SamlApplicationSettingsApplication': @@ -159,7 +159,7 @@ function getTypeHint(obj) { case 'AutoLoginApplicationSettings': case 'BasicAuthApplicationSettings': case 'BasicApplicationSettings': - case 'BookmarApplicationSettings': + case 'BookmarkApplicationSettings': case 'BrowserPluginApplicationSettings': case 'OpenIdConnectApplicationSettings': case 'SamlApplicationSettings': @@ -170,7 +170,7 @@ function getTypeHint(obj) { return '\\Okta\\Applications\\ApplicationSettings'; case 'AutoLoginApplicationCredentials': case 'BasicAuthApplicationCredentials': - case 'BookmarApplicationCredentials': + case 'BookmarkApplicationCredentials': case 'BrowserPluginApplicationCredentials': case 'OAuthApplicationCredentials': case 'OpenIdConnectApplicationCredentials': @@ -182,7 +182,7 @@ function getTypeHint(obj) { case 'AutoLoginApplicationSettingsApplication': case 'BasicAuthApplicationSettingsApplication': case 'BasicApplicationSettingsApplication': - case 'BookmarApplicationSettingsApplication': + case 'BookmarkApplicationSettingsApplication': case 'BrowserPluginApplicationSettingsApplication': case 'OpenIdConnectApplicationSettingsApplication': case 'SamlApplicationSettingsApplication': @@ -210,7 +210,7 @@ function getExtends(modelName) { return '\\Okta\\UserFactors\\Factor'; case 'AutoLoginApplication': case 'BasicAuthApplication': - case 'BookmarApplication': + case 'BookmarkApplication': case 'BrowserPluginApplication': case 'OpenIdConnectApplication': case 'SamlApplication': @@ -220,7 +220,7 @@ function getExtends(modelName) { case 'AutoLoginApplicationSettings': case 'BasicAuthApplicationSettings': case 'BasicApplicationSettings': - case 'BookmarApplicationSettings': + case 'BookmarkApplicationSettings': case 'BrowserPluginApplicationSettings': case 'OpenIdConnectApplicationSettings': case 'SamlApplicationSettings': @@ -231,7 +231,7 @@ function getExtends(modelName) { return '\\Okta\\Applications\\ApplicationSettings'; case 'AutoLoginApplicationCredentials': case 'BasicAuthApplicationCredentials': - case 'BookmarApplicationCredentials': + case 'BookmarkApplicationCredentials': case 'BrowserPluginApplicationCredentials': case 'OAuthApplicationCredentials': case 'OpenIdConnectApplicationCredentials': @@ -243,7 +243,7 @@ function getExtends(modelName) { case 'AutoLoginApplicationSettingsApplication': case 'BasicAuthApplicationSettingsApplication': case 'BasicApplicationSettingsApplication': - case 'BookmarApplicationSettingsApplication': + case 'BookmarkApplicationSettingsApplication': case 'BrowserPluginApplicationSettingsApplication': case 'OpenIdConnectApplicationSettingsApplication': case 'SamlApplicationSettingsApplication': diff --git a/src/Applications/BookmarkApplication.php b/src/Applications/BookmarkApplication.php index 1742926ec4..8cd7f71ff3 100644 --- a/src/Applications/BookmarkApplication.php +++ b/src/Applications/BookmarkApplication.php @@ -19,5 +19,5 @@ class BookmarkApplication extends \Okta\Generated\Applications\BookmarkApplication { - private $name = "bookmark"; + } diff --git a/src/Generated/Applications/AppUser.php b/src/Generated/Applications/AppUser.php index d88f76599e..bb43ac412b 100644 --- a/src/Generated/Applications/AppUser.php +++ b/src/Generated/Applications/AppUser.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class AppUser extends \Okta\Resource\AbstractResource { const ID = 'id'; @@ -35,7 +36,7 @@ class AppUser extends \Okta\Resource\AbstractResource const PASSWORD_CHANGED = 'passwordChanged'; - public function save($appId) + public function save( $appId ) { return \Okta\Client::getInstance() ->getDataStore() @@ -46,7 +47,7 @@ public function save($appId) ); } - public function delete($appId) + public function delete( $appId ) { return \Okta\Client::getInstance() ->getDataStore() diff --git a/src/Generated/Applications/AppUserCredentials.php b/src/Generated/Applications/AppUserCredentials.php index ec3c41a397..1ac50e1d8e 100644 --- a/src/Generated/Applications/AppUserCredentials.php +++ b/src/Generated/Applications/AppUserCredentials.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class AppUserCredentials extends \Okta\Resource\AbstractResource { const PASSWORD = 'password'; diff --git a/src/Generated/Applications/AppUserPasswordCredential.php b/src/Generated/Applications/AppUserPasswordCredential.php index faafb66ae5..2c51e2eb7c 100644 --- a/src/Generated/Applications/AppUserPasswordCredential.php +++ b/src/Generated/Applications/AppUserPasswordCredential.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class AppUserPasswordCredential extends \Okta\Resource\AbstractResource { const VALUE = 'value'; diff --git a/src/Generated/Applications/Application.php b/src/Generated/Applications/Application.php index f190703dc0..1c4155ac65 100644 --- a/src/Generated/Applications/Application.php +++ b/src/Generated/Applications/Application.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class Application extends \Okta\Resource\AbstractResource { const ID = 'id'; diff --git a/src/Generated/Applications/ApplicationAccessibility.php b/src/Generated/Applications/ApplicationAccessibility.php index a0b4acf3e7..27469cd3d2 100644 --- a/src/Generated/Applications/ApplicationAccessibility.php +++ b/src/Generated/Applications/ApplicationAccessibility.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class ApplicationAccessibility extends \Okta\Resource\AbstractResource { const SELF_SERVICE = 'selfService'; diff --git a/src/Generated/Applications/ApplicationCredentials.php b/src/Generated/Applications/ApplicationCredentials.php index 9016b87c32..7c3bd1d8f5 100644 --- a/src/Generated/Applications/ApplicationCredentials.php +++ b/src/Generated/Applications/ApplicationCredentials.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class ApplicationCredentials extends \Okta\Resource\AbstractResource { const SIGNING = 'signing'; diff --git a/src/Generated/Applications/ApplicationCredentialsOAuthClient.php b/src/Generated/Applications/ApplicationCredentialsOAuthClient.php index 797943f211..03e50b7e50 100644 --- a/src/Generated/Applications/ApplicationCredentialsOAuthClient.php +++ b/src/Generated/Applications/ApplicationCredentialsOAuthClient.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class ApplicationCredentialsOAuthClient extends \Okta\Resource\AbstractResource { const CLIENT_ID = 'client_id'; @@ -34,6 +35,21 @@ public function getClientId(): string { return $this->getProperty(self::CLIENT_ID); } + /** + * Set the client_id. + * + * @param mixed $client_id The value to set. + * @return self + */ + public function setClientId($client_id) + { + $this->setProperty( + self::CLIENT_ID, + $client_id + ); + + return $this; + } /** * Get the client_secret. * @@ -43,6 +59,21 @@ public function getClientSecret(): string { return $this->getProperty(self::CLIENT_SECRET); } + /** + * Set the client_secret. + * + * @param mixed $client_secret The value to set. + * @return self + */ + public function setClientSecret($client_secret) + { + $this->setProperty( + self::CLIENT_SECRET, + $client_secret + ); + + return $this; + } /** * Get the autoKeyRotation. * diff --git a/src/Generated/Applications/ApplicationCredentialsSigning.php b/src/Generated/Applications/ApplicationCredentialsSigning.php index ba46c0530b..a0fcf4587a 100644 --- a/src/Generated/Applications/ApplicationCredentialsSigning.php +++ b/src/Generated/Applications/ApplicationCredentialsSigning.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class ApplicationCredentialsSigning extends \Okta\Resource\AbstractResource { const KID = 'kid'; diff --git a/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php b/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php index 6df0d9f9a2..1e439fed6e 100644 --- a/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php +++ b/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class ApplicationCredentialsUsernameTemplate extends \Okta\Resource\AbstractResource { const TYPE = 'type'; diff --git a/src/Generated/Applications/ApplicationGroupAssignment.php b/src/Generated/Applications/ApplicationGroupAssignment.php index e83aed1f67..bcf999a480 100644 --- a/src/Generated/Applications/ApplicationGroupAssignment.php +++ b/src/Generated/Applications/ApplicationGroupAssignment.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class ApplicationGroupAssignment extends \Okta\Resource\AbstractResource { const ID = 'id'; @@ -27,7 +28,7 @@ class ApplicationGroupAssignment extends \Okta\Resource\AbstractResource const LAST_UPDATED = 'lastUpdated'; - public function delete($appId) + public function delete( $appId ) { return \Okta\Client::getInstance() ->getDataStore() diff --git a/src/Generated/Applications/ApplicationLicensing.php b/src/Generated/Applications/ApplicationLicensing.php index 15bd5ee171..b643e7db90 100644 --- a/src/Generated/Applications/ApplicationLicensing.php +++ b/src/Generated/Applications/ApplicationLicensing.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class ApplicationLicensing extends \Okta\Resource\AbstractResource { const SEAT_COUNT = 'seatCount'; diff --git a/src/Generated/Applications/ApplicationSettings.php b/src/Generated/Applications/ApplicationSettings.php index 5c97cb0030..1463a949c3 100644 --- a/src/Generated/Applications/ApplicationSettings.php +++ b/src/Generated/Applications/ApplicationSettings.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class ApplicationSettings extends \Okta\Resource\AbstractResource { const APP = 'app'; diff --git a/src/Generated/Applications/ApplicationSettingsApplication.php b/src/Generated/Applications/ApplicationSettingsApplication.php index 9a68e7f2cc..0f67ac958c 100644 --- a/src/Generated/Applications/ApplicationSettingsApplication.php +++ b/src/Generated/Applications/ApplicationSettingsApplication.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class ApplicationSettingsApplication extends \Okta\Resource\AbstractResource { diff --git a/src/Generated/Applications/ApplicationSettingsNotifications.php b/src/Generated/Applications/ApplicationSettingsNotifications.php index b8da7fc7f6..841647e26c 100644 --- a/src/Generated/Applications/ApplicationSettingsNotifications.php +++ b/src/Generated/Applications/ApplicationSettingsNotifications.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class ApplicationSettingsNotifications extends \Okta\Resource\AbstractResource { const VPN = 'vpn'; diff --git a/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php b/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php index 8a7df15153..e0f7ae850b 100644 --- a/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php +++ b/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class ApplicationSettingsNotificationsVpn extends \Okta\Resource\AbstractResource { const HELP_URL = 'helpUrl'; diff --git a/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php b/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php index 14d3ca48c6..222e2aa381 100644 --- a/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php +++ b/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class ApplicationSettingsNotificationsVpnNetwork extends \Okta\Resource\AbstractResource { const EXCLUDE = 'exclude'; diff --git a/src/Generated/Applications/ApplicationVisibility.php b/src/Generated/Applications/ApplicationVisibility.php index 6696caced1..9d5fa46032 100644 --- a/src/Generated/Applications/ApplicationVisibility.php +++ b/src/Generated/Applications/ApplicationVisibility.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class ApplicationVisibility extends \Okta\Resource\AbstractResource { const HIDE = 'hide'; diff --git a/src/Generated/Applications/ApplicationVisibilityHide.php b/src/Generated/Applications/ApplicationVisibilityHide.php index 9e2cfa6c3d..80ba6674ac 100644 --- a/src/Generated/Applications/ApplicationVisibilityHide.php +++ b/src/Generated/Applications/ApplicationVisibilityHide.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class ApplicationVisibilityHide extends \Okta\Resource\AbstractResource { const I_OS = 'iOS'; diff --git a/src/Generated/Applications/AutoLoginApplication.php b/src/Generated/Applications/AutoLoginApplication.php index e03e1b0118..e3e9cb09a5 100644 --- a/src/Generated/Applications/AutoLoginApplication.php +++ b/src/Generated/Applications/AutoLoginApplication.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class AutoLoginApplication extends \Okta\Applications\Application { const SETTINGS = 'settings'; diff --git a/src/Generated/Applications/AutoLoginApplicationSettings.php b/src/Generated/Applications/AutoLoginApplicationSettings.php index 1c966f3374..9f8bacdc62 100644 --- a/src/Generated/Applications/AutoLoginApplicationSettings.php +++ b/src/Generated/Applications/AutoLoginApplicationSettings.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class AutoLoginApplicationSettings extends \Okta\Applications\ApplicationSettings { const SIGN_ON = 'signOn'; diff --git a/src/Generated/Applications/AutoLoginApplicationSettingsSignOn.php b/src/Generated/Applications/AutoLoginApplicationSettingsSignOn.php index aa58d1e13f..57f365435c 100644 --- a/src/Generated/Applications/AutoLoginApplicationSettingsSignOn.php +++ b/src/Generated/Applications/AutoLoginApplicationSettingsSignOn.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class AutoLoginApplicationSettingsSignOn extends \Okta\Resource\AbstractResource { const LOGIN_URL = 'loginUrl'; diff --git a/src/Generated/Applications/BasicApplicationSettings.php b/src/Generated/Applications/BasicApplicationSettings.php index a3457812da..f1cbeb97ef 100644 --- a/src/Generated/Applications/BasicApplicationSettings.php +++ b/src/Generated/Applications/BasicApplicationSettings.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class BasicApplicationSettings extends \Okta\Applications\ApplicationSettings { const APP = 'app'; diff --git a/src/Generated/Applications/BasicApplicationSettingsApplication.php b/src/Generated/Applications/BasicApplicationSettingsApplication.php index 55cd2c589b..9bd724ceb0 100644 --- a/src/Generated/Applications/BasicApplicationSettingsApplication.php +++ b/src/Generated/Applications/BasicApplicationSettingsApplication.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class BasicApplicationSettingsApplication extends \Okta\Applications\ApplicationSettingsApplication { const URL = 'url'; diff --git a/src/Generated/Applications/BasicAuthApplication.php b/src/Generated/Applications/BasicAuthApplication.php index e7cc13158e..f34ea49620 100644 --- a/src/Generated/Applications/BasicAuthApplication.php +++ b/src/Generated/Applications/BasicAuthApplication.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class BasicAuthApplication extends \Okta\Applications\Application { const NAME = 'name'; diff --git a/src/Generated/Applications/BookmarkApplication.php b/src/Generated/Applications/BookmarkApplication.php index 79219d086d..0ead31abcf 100644 --- a/src/Generated/Applications/BookmarkApplication.php +++ b/src/Generated/Applications/BookmarkApplication.php @@ -17,7 +17,8 @@ namespace Okta\Generated\Applications; -class BookmarkApplication extends \Okta\Resource\AbstractResource + +class BookmarkApplication extends \Okta\Applications\Application { const NAME = 'name'; const SETTINGS = 'settings'; @@ -27,9 +28,9 @@ class BookmarkApplication extends \Okta\Resource\AbstractResource /** * Get the settings. * - * @return \Okta\Applications\BookmarkApplicationSettings + * @return \Okta\Applications\ApplicationSettings */ - public function getSettings(array $options = []): \Okta\Applications\BookmarkApplicationSettings + public function getSettings(array $options = []): \Okta\Applications\ApplicationSettings { return $this->getResourceProperty( self::SETTINGS, @@ -41,10 +42,10 @@ public function getSettings(array $options = []): \Okta\Applications\BookmarkApp /** * Set the settings. * - * @param \Okta\Applications\BookmarkApplicationSettings $settings The BookmarkApplicationSettings instance. + * @param \Okta\Applications\ApplicationSettings $settings The BookmarkApplicationSettings instance. * @return self */ - public function setSettings(\Okta\Applications\BookmarkApplicationSettings $settings) + public function setSettings(\Okta\Applications\ApplicationSettings $settings) { $this->setResourceProperty( self::SETTINGS, diff --git a/src/Generated/Applications/BookmarkApplicationSettings.php b/src/Generated/Applications/BookmarkApplicationSettings.php index 6a12e63ac9..e37ebe24d7 100644 --- a/src/Generated/Applications/BookmarkApplicationSettings.php +++ b/src/Generated/Applications/BookmarkApplicationSettings.php @@ -17,7 +17,8 @@ namespace Okta\Generated\Applications; -class BookmarkApplicationSettings extends \Okta\Resource\AbstractResource + +class BookmarkApplicationSettings extends \Okta\Applications\ApplicationSettings { const APP = 'app'; @@ -25,9 +26,9 @@ class BookmarkApplicationSettings extends \Okta\Resource\AbstractResource /** * Get the app. * - * @return \Okta\Applications\BookmarkApplicationSettingsApplication + * @return \Okta\Applications\ApplicationSettingsApplication */ - public function getApp(array $options = []): \Okta\Applications\BookmarkApplicationSettingsApplication + public function getApp(array $options = []): \Okta\Applications\ApplicationSettingsApplication { return $this->getResourceProperty( self::APP, @@ -39,10 +40,10 @@ public function getApp(array $options = []): \Okta\Applications\BookmarkApplicat /** * Set the app. * - * @param \Okta\Applications\BookmarkApplicationSettingsApplication $app The BookmarkApplicationSettingsApplication instance. + * @param \Okta\Applications\ApplicationSettingsApplication $app The BookmarkApplicationSettingsApplication instance. * @return self */ - public function setApp(\Okta\Applications\BookmarkApplicationSettingsApplication $app) + public function setApp(\Okta\Applications\ApplicationSettingsApplication $app) { $this->setResourceProperty( self::APP, diff --git a/src/Generated/Applications/BookmarkApplicationSettingsApplication.php b/src/Generated/Applications/BookmarkApplicationSettingsApplication.php index b95ec5adff..5d86d97154 100644 --- a/src/Generated/Applications/BookmarkApplicationSettingsApplication.php +++ b/src/Generated/Applications/BookmarkApplicationSettingsApplication.php @@ -17,7 +17,8 @@ namespace Okta\Generated\Applications; -class BookmarkApplicationSettingsApplication extends \Okta\Resource\AbstractResource + +class BookmarkApplicationSettingsApplication extends \Okta\Applications\ApplicationSettingsApplication { const URL = 'url'; const REQUEST_INTEGRATION = 'requestIntegration'; diff --git a/src/Generated/Applications/BrowserPluginApplication.php b/src/Generated/Applications/BrowserPluginApplication.php index 9e3c217ddb..242bb7fd5c 100644 --- a/src/Generated/Applications/BrowserPluginApplication.php +++ b/src/Generated/Applications/BrowserPluginApplication.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class BrowserPluginApplication extends \Okta\Applications\Application { const CREDENTIALS = 'credentials'; diff --git a/src/Generated/Applications/JsonWebKey.php b/src/Generated/Applications/JsonWebKey.php index 87ceaf1a20..636c88d234 100644 --- a/src/Generated/Applications/JsonWebKey.php +++ b/src/Generated/Applications/JsonWebKey.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class JsonWebKey extends \Okta\Resource\AbstractResource { const E = 'e'; diff --git a/src/Generated/Applications/OAuthApplicationCredentials.php b/src/Generated/Applications/OAuthApplicationCredentials.php index 25832c149e..a2c0c7d4fd 100644 --- a/src/Generated/Applications/OAuthApplicationCredentials.php +++ b/src/Generated/Applications/OAuthApplicationCredentials.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class OAuthApplicationCredentials extends \Okta\Applications\ApplicationCredentials { const OAUTH_CLIENT = 'oauthClient'; diff --git a/src/Generated/Applications/OpenIdConnectApplication.php b/src/Generated/Applications/OpenIdConnectApplication.php index f7884f0e92..52d3926c36 100644 --- a/src/Generated/Applications/OpenIdConnectApplication.php +++ b/src/Generated/Applications/OpenIdConnectApplication.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class OpenIdConnectApplication extends \Okta\Applications\Application { const NAME = 'name'; diff --git a/src/Generated/Applications/OpenIdConnectApplicationSettings.php b/src/Generated/Applications/OpenIdConnectApplicationSettings.php index 6d0553380d..f5c0578af2 100644 --- a/src/Generated/Applications/OpenIdConnectApplicationSettings.php +++ b/src/Generated/Applications/OpenIdConnectApplicationSettings.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class OpenIdConnectApplicationSettings extends \Okta\Applications\ApplicationSettings { const OAUTH_CLIENT = 'oauthClient'; diff --git a/src/Generated/Applications/OpenIdConnectApplicationSettingsClient.php b/src/Generated/Applications/OpenIdConnectApplicationSettingsClient.php index 78781c526e..f037b0e11b 100644 --- a/src/Generated/Applications/OpenIdConnectApplicationSettingsClient.php +++ b/src/Generated/Applications/OpenIdConnectApplicationSettingsClient.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class OpenIdConnectApplicationSettingsClient extends \Okta\Resource\AbstractResource { const TOS_URI = 'tos_uri'; diff --git a/src/Generated/Applications/SamlApplication.php b/src/Generated/Applications/SamlApplication.php index cdee6638ca..0858825dac 100644 --- a/src/Generated/Applications/SamlApplication.php +++ b/src/Generated/Applications/SamlApplication.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class SamlApplication extends \Okta\Applications\Application { const SETTINGS = 'settings'; diff --git a/src/Generated/Applications/SamlApplicationSettings.php b/src/Generated/Applications/SamlApplicationSettings.php index 3f05965953..a175171dee 100644 --- a/src/Generated/Applications/SamlApplicationSettings.php +++ b/src/Generated/Applications/SamlApplicationSettings.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class SamlApplicationSettings extends \Okta\Applications\ApplicationSettings { const SIGN_ON = 'signOn'; diff --git a/src/Generated/Applications/SamlApplicationSettingsSignOn.php b/src/Generated/Applications/SamlApplicationSettingsSignOn.php index 32d6357181..d14a560db0 100644 --- a/src/Generated/Applications/SamlApplicationSettingsSignOn.php +++ b/src/Generated/Applications/SamlApplicationSettingsSignOn.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class SamlApplicationSettingsSignOn extends \Okta\Resource\AbstractResource { const AUDIENCE = 'audience'; diff --git a/src/Generated/Applications/SamlAttributeStatement.php b/src/Generated/Applications/SamlAttributeStatement.php index 4f303ef18c..4a56bd9019 100644 --- a/src/Generated/Applications/SamlAttributeStatement.php +++ b/src/Generated/Applications/SamlAttributeStatement.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class SamlAttributeStatement extends \Okta\Resource\AbstractResource { const NAME = 'name'; diff --git a/src/Generated/Applications/SchemeApplicationCredentials.php b/src/Generated/Applications/SchemeApplicationCredentials.php index a1f4aa3307..7ca68f64fa 100644 --- a/src/Generated/Applications/SchemeApplicationCredentials.php +++ b/src/Generated/Applications/SchemeApplicationCredentials.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class SchemeApplicationCredentials extends \Okta\Applications\ApplicationCredentials { const SCHEME = 'scheme'; diff --git a/src/Generated/Applications/SecurePasswordStoreApplication.php b/src/Generated/Applications/SecurePasswordStoreApplication.php index 8b147c9ed7..9336f85171 100644 --- a/src/Generated/Applications/SecurePasswordStoreApplication.php +++ b/src/Generated/Applications/SecurePasswordStoreApplication.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class SecurePasswordStoreApplication extends \Okta\Applications\Application { const NAME = 'name'; diff --git a/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php b/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php index f725c0bb8e..aca7aa51b8 100644 --- a/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php +++ b/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class SecurePasswordStoreApplicationSettings extends \Okta\Applications\ApplicationSettings { const APP = 'app'; diff --git a/src/Generated/Applications/SecurePasswordStoreApplicationSettingsApplication.php b/src/Generated/Applications/SecurePasswordStoreApplicationSettingsApplication.php index 974af7b9ce..bb4eaa7b41 100644 --- a/src/Generated/Applications/SecurePasswordStoreApplicationSettingsApplication.php +++ b/src/Generated/Applications/SecurePasswordStoreApplicationSettingsApplication.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class SecurePasswordStoreApplicationSettingsApplication extends \Okta\Applications\ApplicationSettingsApplication { const URL = 'url'; diff --git a/src/Generated/Applications/SwaApplication.php b/src/Generated/Applications/SwaApplication.php index 20b8c4e5fe..8779000cbd 100644 --- a/src/Generated/Applications/SwaApplication.php +++ b/src/Generated/Applications/SwaApplication.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class SwaApplication extends \Okta\Applications\BrowserPluginApplication { const NAME = 'name'; diff --git a/src/Generated/Applications/SwaApplicationSettings.php b/src/Generated/Applications/SwaApplicationSettings.php index f57d6894ac..01aa0b52fe 100644 --- a/src/Generated/Applications/SwaApplicationSettings.php +++ b/src/Generated/Applications/SwaApplicationSettings.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class SwaApplicationSettings extends \Okta\Applications\ApplicationSettings { const APP = 'app'; diff --git a/src/Generated/Applications/SwaApplicationSettingsApplication.php b/src/Generated/Applications/SwaApplicationSettingsApplication.php index 52cade17e5..b7802c15e6 100644 --- a/src/Generated/Applications/SwaApplicationSettingsApplication.php +++ b/src/Generated/Applications/SwaApplicationSettingsApplication.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class SwaApplicationSettingsApplication extends \Okta\Applications\ApplicationSettingsApplication { const URL = 'url'; diff --git a/src/Generated/Applications/SwaThreeFieldApplication.php b/src/Generated/Applications/SwaThreeFieldApplication.php index be6a72fc7a..86da626b57 100644 --- a/src/Generated/Applications/SwaThreeFieldApplication.php +++ b/src/Generated/Applications/SwaThreeFieldApplication.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class SwaThreeFieldApplication extends \Okta\Applications\BrowserPluginApplication { const NAME = 'name'; diff --git a/src/Generated/Applications/SwaThreeFieldApplicationSettings.php b/src/Generated/Applications/SwaThreeFieldApplicationSettings.php index c1e29ec754..267c2ae5ce 100644 --- a/src/Generated/Applications/SwaThreeFieldApplicationSettings.php +++ b/src/Generated/Applications/SwaThreeFieldApplicationSettings.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class SwaThreeFieldApplicationSettings extends \Okta\Applications\ApplicationSettings { const APP = 'app'; diff --git a/src/Generated/Applications/SwaThreeFieldApplicationSettingsApplication.php b/src/Generated/Applications/SwaThreeFieldApplicationSettingsApplication.php index 1d536ecac9..96fe073508 100644 --- a/src/Generated/Applications/SwaThreeFieldApplicationSettingsApplication.php +++ b/src/Generated/Applications/SwaThreeFieldApplicationSettingsApplication.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class SwaThreeFieldApplicationSettingsApplication extends \Okta\Applications\ApplicationSettingsApplication { const TARGET_URL = 'targetUrl'; diff --git a/src/Generated/Applications/WsFederationApplication.php b/src/Generated/Applications/WsFederationApplication.php index 450271ddfe..d3aaad5ee2 100644 --- a/src/Generated/Applications/WsFederationApplication.php +++ b/src/Generated/Applications/WsFederationApplication.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class WsFederationApplication extends \Okta\Applications\Application { const NAME = 'name'; diff --git a/src/Generated/Applications/WsFederationApplicationSettings.php b/src/Generated/Applications/WsFederationApplicationSettings.php index 94d6788161..3f3719a505 100644 --- a/src/Generated/Applications/WsFederationApplicationSettings.php +++ b/src/Generated/Applications/WsFederationApplicationSettings.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class WsFederationApplicationSettings extends \Okta\Applications\ApplicationSettings { const APP = 'app'; diff --git a/src/Generated/Applications/WsFederationApplicationSettingsApplication.php b/src/Generated/Applications/WsFederationApplicationSettingsApplication.php index 5209756483..d1d01ae64c 100644 --- a/src/Generated/Applications/WsFederationApplicationSettingsApplication.php +++ b/src/Generated/Applications/WsFederationApplicationSettingsApplication.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Applications; + class WsFederationApplicationSettingsApplication extends \Okta\Applications\ApplicationSettingsApplication { const REALM = 'realm'; diff --git a/src/Generated/GroupRules/GroupRule.php b/src/Generated/GroupRules/GroupRule.php index 977581497e..72aa8ccdc6 100644 --- a/src/Generated/GroupRules/GroupRule.php +++ b/src/Generated/GroupRules/GroupRule.php @@ -17,6 +17,7 @@ namespace Okta\Generated\GroupRules; + class GroupRule extends \Okta\Resource\AbstractResource { const ID = 'id'; diff --git a/src/Generated/GroupRules/GroupRuleAction.php b/src/Generated/GroupRules/GroupRuleAction.php index 4597415325..6823aae0d6 100644 --- a/src/Generated/GroupRules/GroupRuleAction.php +++ b/src/Generated/GroupRules/GroupRuleAction.php @@ -17,6 +17,7 @@ namespace Okta\Generated\GroupRules; + class GroupRuleAction extends \Okta\Resource\AbstractResource { const ASSIGN_USER_TO_GROUPS = 'assignUserToGroups'; diff --git a/src/Generated/GroupRules/GroupRuleConditions.php b/src/Generated/GroupRules/GroupRuleConditions.php index 9f0a59149d..2f10d9cfdd 100644 --- a/src/Generated/GroupRules/GroupRuleConditions.php +++ b/src/Generated/GroupRules/GroupRuleConditions.php @@ -17,6 +17,7 @@ namespace Okta\Generated\GroupRules; + class GroupRuleConditions extends \Okta\Resource\AbstractResource { const PEOPLE = 'people'; diff --git a/src/Generated/GroupRules/GroupRuleExpression.php b/src/Generated/GroupRules/GroupRuleExpression.php index 08185f34ef..84f753285c 100644 --- a/src/Generated/GroupRules/GroupRuleExpression.php +++ b/src/Generated/GroupRules/GroupRuleExpression.php @@ -17,6 +17,7 @@ namespace Okta\Generated\GroupRules; + class GroupRuleExpression extends \Okta\Resource\AbstractResource { const TYPE = 'type'; diff --git a/src/Generated/GroupRules/GroupRuleGroupAssignment.php b/src/Generated/GroupRules/GroupRuleGroupAssignment.php index c2c015af43..7bc1bf1cc2 100644 --- a/src/Generated/GroupRules/GroupRuleGroupAssignment.php +++ b/src/Generated/GroupRules/GroupRuleGroupAssignment.php @@ -17,6 +17,7 @@ namespace Okta\Generated\GroupRules; + class GroupRuleGroupAssignment extends \Okta\Resource\AbstractResource { const GROUP_IDS = 'groupIds'; diff --git a/src/Generated/GroupRules/GroupRuleGroupCondition.php b/src/Generated/GroupRules/GroupRuleGroupCondition.php index 66b6c13f01..f2505fc769 100644 --- a/src/Generated/GroupRules/GroupRuleGroupCondition.php +++ b/src/Generated/GroupRules/GroupRuleGroupCondition.php @@ -17,6 +17,7 @@ namespace Okta\Generated\GroupRules; + class GroupRuleGroupCondition extends \Okta\Resource\AbstractResource { const EXCLUDE = 'exclude'; diff --git a/src/Generated/GroupRules/GroupRulePeopleCondition.php b/src/Generated/GroupRules/GroupRulePeopleCondition.php index 4438b0a21a..b9dc84b763 100644 --- a/src/Generated/GroupRules/GroupRulePeopleCondition.php +++ b/src/Generated/GroupRules/GroupRulePeopleCondition.php @@ -17,6 +17,7 @@ namespace Okta\Generated\GroupRules; + class GroupRulePeopleCondition extends \Okta\Resource\AbstractResource { const USERS = 'users'; diff --git a/src/Generated/GroupRules/GroupRuleUserCondition.php b/src/Generated/GroupRules/GroupRuleUserCondition.php index e8e1f1fa11..e2609334d4 100644 --- a/src/Generated/GroupRules/GroupRuleUserCondition.php +++ b/src/Generated/GroupRules/GroupRuleUserCondition.php @@ -17,6 +17,7 @@ namespace Okta\Generated\GroupRules; + class GroupRuleUserCondition extends \Okta\Resource\AbstractResource { const EXCLUDE = 'exclude'; diff --git a/src/Generated/Groups/GroupProfile.php b/src/Generated/Groups/GroupProfile.php index d3b858608d..0643ed7625 100644 --- a/src/Generated/Groups/GroupProfile.php +++ b/src/Generated/Groups/GroupProfile.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Groups; + class GroupProfile extends \Okta\Resource\AbstractResource { const NAME = 'name'; diff --git a/src/Generated/UserFactors/CallFactor.php b/src/Generated/UserFactors/CallFactor.php index 32d653367e..2474ea8e13 100644 --- a/src/Generated/UserFactors/CallFactor.php +++ b/src/Generated/UserFactors/CallFactor.php @@ -17,6 +17,7 @@ namespace Okta\Generated\UserFactors; + class CallFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; diff --git a/src/Generated/UserFactors/CallFactorProfile.php b/src/Generated/UserFactors/CallFactorProfile.php index 7608e0af45..cd07352f67 100644 --- a/src/Generated/UserFactors/CallFactorProfile.php +++ b/src/Generated/UserFactors/CallFactorProfile.php @@ -17,6 +17,7 @@ namespace Okta\Generated\UserFactors; + class CallFactorProfile extends \Okta\UserFactors\FactorProfile { const PHONE_NUMBER = 'phoneNumber'; diff --git a/src/Generated/UserFactors/EmailFactor.php b/src/Generated/UserFactors/EmailFactor.php index 63cb335bc9..d6b131e1df 100644 --- a/src/Generated/UserFactors/EmailFactor.php +++ b/src/Generated/UserFactors/EmailFactor.php @@ -17,6 +17,7 @@ namespace Okta\Generated\UserFactors; + class EmailFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; diff --git a/src/Generated/UserFactors/EmailFactorProfile.php b/src/Generated/UserFactors/EmailFactorProfile.php index ed55ac0b6d..554ecbf539 100644 --- a/src/Generated/UserFactors/EmailFactorProfile.php +++ b/src/Generated/UserFactors/EmailFactorProfile.php @@ -17,6 +17,7 @@ namespace Okta\Generated\UserFactors; + class EmailFactorProfile extends \Okta\UserFactors\FactorProfile { const EMAIL = 'email'; diff --git a/src/Generated/UserFactors/Factor.php b/src/Generated/UserFactors/Factor.php index 8c67cfb76e..95adaa8b28 100644 --- a/src/Generated/UserFactors/Factor.php +++ b/src/Generated/UserFactors/Factor.php @@ -17,6 +17,7 @@ namespace Okta\Generated\UserFactors; + class Factor extends \Okta\Resource\AbstractResource { const ID = 'id'; diff --git a/src/Generated/UserFactors/FactorProfile.php b/src/Generated/UserFactors/FactorProfile.php index 3ff7b53b7c..ce25c87e84 100644 --- a/src/Generated/UserFactors/FactorProfile.php +++ b/src/Generated/UserFactors/FactorProfile.php @@ -17,6 +17,7 @@ namespace Okta\Generated\UserFactors; + class FactorProfile extends \Okta\Resource\AbstractResource { diff --git a/src/Generated/UserFactors/FactorProvider.php b/src/Generated/UserFactors/FactorProvider.php new file mode 100644 index 0000000000..a57402597a --- /dev/null +++ b/src/Generated/UserFactors/FactorProvider.php @@ -0,0 +1,31 @@ +getDataStore() - ->saveResource( - "/users", - $this, - \Okta\Users\User::class - ); + ->getDataStore() + ->saveResource( + "/users", + $this, + \Okta\Users\User::class + ); } public function delete() { @@ -395,7 +395,7 @@ public function getGroupTargetsForRole($roleId, array $options = []): \Okta\Grou /** - * + * * * * @return mixed|null @@ -415,7 +415,7 @@ public function removeGroupTargetFromRole($roleId, $groupId) /** - * + * * * * @return mixed|null diff --git a/src/Generated/Users/UserActivationToken.php b/src/Generated/Users/UserActivationToken.php index 5779f34763..098b7a1c52 100644 --- a/src/Generated/Users/UserActivationToken.php +++ b/src/Generated/Users/UserActivationToken.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Users; + class UserActivationToken extends \Okta\Resource\AbstractResource { const ACTIVATION_URL = 'activationUrl'; diff --git a/src/Generated/Users/UserCredentials.php b/src/Generated/Users/UserCredentials.php index ba91df803d..bb7af020d8 100644 --- a/src/Generated/Users/UserCredentials.php +++ b/src/Generated/Users/UserCredentials.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Users; + class UserCredentials extends \Okta\Resource\AbstractResource { const PASSWORD = 'password'; diff --git a/src/Generated/Users/UserProfile.php b/src/Generated/Users/UserProfile.php index 2c99b24e73..7eb577d104 100644 --- a/src/Generated/Users/UserProfile.php +++ b/src/Generated/Users/UserProfile.php @@ -17,6 +17,7 @@ namespace Okta\Generated\Users; + class UserProfile extends \Okta\Resource\AbstractResource { const EMAIL = 'email'; From 9be0e895fe354d4886ca86edeaaa8afd4e1d14bd Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Fri, 1 Dec 2017 14:56:46 -0500 Subject: [PATCH 19/22] Adds Session Endpoints --- .../Sessions/AuthenticationMethod.php | 34 ++++ src/Generated/Sessions/Collection.php | 25 +++ src/Generated/Sessions/Session.php | 179 +++++++++++++++++ src/Generated/Sessions/SessionAuthority.php | 45 +++++ .../Sessions/SessionAuthorityType.php | 29 +++ src/Generated/Sessions/SessionStatus.php | 27 +++ src/Generated/Users/User.php | 20 ++ src/Sessions/AuthenticationMethod.php | 23 +++ src/Sessions/Session.php | 23 +++ src/Sessions/SessionAuthority.php | 23 +++ src/Sessions/SessionAuthorityType.php | 23 +++ src/Sessions/SessionStatus.php | 23 +++ tests/Unit/Sessions/SessionAuthorityTest.php | 46 +++++ tests/Unit/Sessions/SessionTest.php | 184 ++++++++++++++++++ tests/Unit/Users/UserTest.php | 19 ++ tests/models/Sessions/session.json | 51 +++++ 16 files changed, 774 insertions(+) create mode 100644 src/Generated/Sessions/AuthenticationMethod.php create mode 100644 src/Generated/Sessions/Collection.php create mode 100644 src/Generated/Sessions/Session.php create mode 100644 src/Generated/Sessions/SessionAuthority.php create mode 100644 src/Generated/Sessions/SessionAuthorityType.php create mode 100644 src/Generated/Sessions/SessionStatus.php create mode 100644 src/Sessions/AuthenticationMethod.php create mode 100644 src/Sessions/Session.php create mode 100644 src/Sessions/SessionAuthority.php create mode 100644 src/Sessions/SessionAuthorityType.php create mode 100644 src/Sessions/SessionStatus.php create mode 100644 tests/Unit/Sessions/SessionAuthorityTest.php create mode 100644 tests/Unit/Sessions/SessionTest.php create mode 100644 tests/models/Sessions/session.json diff --git a/src/Generated/Sessions/AuthenticationMethod.php b/src/Generated/Sessions/AuthenticationMethod.php new file mode 100644 index 0000000000..3045ceb1ff --- /dev/null +++ b/src/Generated/Sessions/AuthenticationMethod.php @@ -0,0 +1,34 @@ +getDataStore() + ->getResource( + $query, + \Okta\Sessions\Session::class, + "/sessions" + ); + } + public function delete() + { + return \Okta\Client::getInstance() + ->getDataStore() + ->deleteResource( + "/sessions", + $this + ); + } + /** + * Get the id. + * + * @return string + */ + public function getId(): string + { + return $this->getProperty(self::ID); + } + /** + * Get the amr. + * + * @return array + */ + public function getAmr(): array + { + return $this->getProperty(self::AMR); + } + /** + * Get the idp. + * + * @return \Okta\Sessions\SessionAuthority + */ + public function getIdp(array $options = []): \Okta\Sessions\SessionAuthority + { + return $this->getResourceProperty( + self::IDP, + \Okta\Sessions\SessionAuthority::class, + $options + ); + } + + /** + * Get the login. + * + * @return string + */ + public function getLogin(): string + { + return $this->getProperty(self::LOGIN); + } + /** + * Get the _links. + * + * @return \stdClass + */ + public function getLinks(): \stdClass + { + return $this->getProperty(self::LINKS); + } + /** + * Get the status. + * + * @return string + */ + public function getStatus(): string + { + return $this->getProperty(self::STATUS); + } + /** + * Get the userId. + * + * @return string + */ + public function getUserId(): string + { + return $this->getProperty(self::USER_ID); + } + /** + * Get the createdAt. + * + * @return \Carbon\Carbon|null + */ + public function getCreatedAt() + { + return $this->getDateProperty(self::CREATED_AT); + } + /** + * Get the expiresAt. + * + * @return \Carbon\Carbon|null + */ + public function getExpiresAt() + { + return $this->getDateProperty(self::EXPIRES_AT); + } + /** + * Get the lastFactorVerification. + * + * @return \Carbon\Carbon|null + */ + public function getLastFactorVerification() + { + return $this->getDateProperty(self::LAST_FACTOR_VERIFICATION); + } + /** + * Get the lastPasswordVerification. + * + * @return \Carbon\Carbon|null + */ + public function getLastPasswordVerification() + { + return $this->getDateProperty(self::LAST_PASSWORD_VERIFICATION); + } + + + /** + * + * + * + * @return mixed|null + */ + public function refresh() + { + $uri = "/api/v1/sessions/{$this->getId()}/lifecycle/refresh"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + $body = $this + ->getDataStore() + ->executeRequest('POST', $uri); + + return new \Okta\Sessions\Session(null, $body); + } +} diff --git a/src/Generated/Sessions/SessionAuthority.php b/src/Generated/Sessions/SessionAuthority.php new file mode 100644 index 0000000000..abcc0688b0 --- /dev/null +++ b/src/Generated/Sessions/SessionAuthority.php @@ -0,0 +1,45 @@ +getProperty(self::ID); + } + /** + * Get the type. + * + * @return string + */ + public function getType(): string + { + return $this->getProperty(self::TYPE); + } +} diff --git a/src/Generated/Sessions/SessionAuthorityType.php b/src/Generated/Sessions/SessionAuthorityType.php new file mode 100644 index 0000000000..08a26fa734 --- /dev/null +++ b/src/Generated/Sessions/SessionAuthorityType.php @@ -0,0 +1,29 @@ +getProperty(self::TRANSITIONING_TO_STATUS); } + + /** + * Removes all active identity provider sessions. This forces the user to authenticate on the next operation. Optionally revokes OpenID Connect and OAuth refresh and access tokens issued to the user. + * + * + * @return mixed|null + */ + public function endSessions() + { + $uri = "/api/v1/users/{$this->getId()}/sessions"; + $uri = $this->getDataStore()->buildUri( + $this->getDataStore()->getOrganizationUrl() . $uri + ); + $body = $this + ->getDataStore() + ->executeRequest('DELETE', $uri); + + return $body; + } + /** * Get the AppLink object. * diff --git a/src/Sessions/AuthenticationMethod.php b/src/Sessions/AuthenticationMethod.php new file mode 100644 index 0000000000..73c3d6a354 --- /dev/null +++ b/src/Sessions/AuthenticationMethod.php @@ -0,0 +1,23 @@ +assertEquals($this->properties->id, $this->testable->getId()); + $this->assertEquals($this->properties->id, $this->testable->id); + } + + /** @test */ + public function type_is_accessible() + { + $this->assertEquals($this->properties->type, $this->testable->getType()); + $this->assertEquals($this->properties->type, $this->testable->type); + } + + +} diff --git a/tests/Unit/Sessions/SessionTest.php b/tests/Unit/Sessions/SessionTest.php new file mode 100644 index 0000000000..e4e5040600 --- /dev/null +++ b/tests/Unit/Sessions/SessionTest.php @@ -0,0 +1,184 @@ +createNewHttpClient([ + "getBody" => '{"id":"abc123", "signOnMode": "BOOKMARK"}' + ]); + + $this->testable->get('abc123'); + + $requests = $httpClient->getRequests(); + + $this->assertEquals('/api/v1/sessions/abc123', $requests[0]->getUri()->getPath()); + $this->assertEquals('GET', $requests[0]->getMethod()); + } + + /** @test */ + public function getting_a_session_will_return_session_object() + { + $client = $this->createNewHttpClient([ + "getBody" => '{"id":"abc123", "signOnMode": "BOOKMARK"}' + ]); + + $app = $this->testable->get('abc123'); + + $this->assertInstanceOf(\Okta\Sessions\Session::class, $app); + } + + /** @test */ + public function deleting_a_session_will_make_request_to_correct_endpoint() + { + $httpClient = $this->createNewHttpClient(); + + $this->testable->delete(); + + $requests = $httpClient->getRequests(); + + $this->assertEquals('/api/v1/sessions/'.$this->testable->getId(), $requests[0]->getUri()->getPath()); + $this->assertEquals('DELETE', $requests[0]->getMethod()); + } + + /** @test */ + public function links_is_accessible() + { + $this->assertEquals($this->properties->_links, $this->testable->getLinks()); + $this->assertEquals($this->properties->_links, $this->testable->links); + } + + /** @test */ + public function amr_is_accessible() + { + $this->assertEquals($this->properties->amr, $this->testable->getAmr()); + $this->assertEquals($this->properties->amr, $this->testable->amr); + } + + + + /** @test */ + public function created_at_is_accessible() + { + $ts = Carbon::parse($this->properties->createdAt)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->createdAt); + $this->assertEquals($ts, $this->testable->getCreatedAt()->timestamp); + $this->assertEquals($ts, $this->testable->createdAt->timestamp); + } + + /** @test */ + public function expires_at_is_accessible() + { + $ts = Carbon::parse($this->properties->expiresAt)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->expiresAt); + $this->assertEquals($ts, $this->testable->getExpiresAt()->timestamp); + $this->assertEquals($ts, $this->testable->expiresAt->timestamp); + } + + /** @test */ + public function id_is_accessible() + { + $this->assertEquals($this->properties->id, $this->testable->getId()); + $this->assertEquals($this->properties->id, $this->testable->id); + } + + /** @test */ + public function idp_is_accessible() + { + $this->assertInstanceOf(\Okta\Sessions\SessionAuthority::class, $this->testable->getIdp()); + $this->assertInstanceOf(\Okta\Sessions\SessionAuthority::class, $this->testable->idp); + } + + /** @test */ + public function last_factor_verification_is_accessible() + { + $ts = Carbon::parse($this->properties->lastFactorVerification)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->lastFactorVerification); + $this->assertEquals($ts, $this->testable->getLastFactorVerification()->timestamp); + $this->assertEquals($ts, $this->testable->lastFactorVerification->timestamp); + } + + /** @test */ + public function last_password_verification_is_accessible() + { + $ts = Carbon::parse($this->properties->lastPasswordVerification)->timestamp; + $this->assertInstanceOf(\Carbon\Carbon::class, $this->testable->lastPasswordVerification); + $this->assertEquals($ts, $this->testable->getLastPasswordVerification()->timestamp); + $this->assertEquals($ts, $this->testable->lastPasswordVerification->timestamp); + } + + /** @test */ + public function login_is_accessible() + { + $this->assertEquals($this->properties->login, $this->testable->getLogin()); + $this->assertEquals($this->properties->login, $this->testable->login); + } + + /** @test */ + public function status_is_accessible() + { + $this->assertEquals($this->properties->status, $this->testable->getStatus()); + $this->assertEquals($this->properties->status, $this->testable->status); + } + + /** @test */ + public function user_id_is_accessible() + { + $this->assertEquals($this->properties->userId, $this->testable->getUserId()); + $this->assertEquals($this->properties->userId, $this->testable->userId); + } + + /** @test */ + public function refresh_makes_request_to_correct_location() + { + $httpClient = $this->createNewHttpClient([ + "getBody" => '{"id": "abc123"}' + ]); + $session = (new Session())->get('abc123'); + $session->refresh(); + + $request = $httpClient->getRequests(); + + $this->assertEquals('POST', $request[1]->getMethod()); + $this->assertEquals( + "/api/v1/sessions/abc123/lifecycle/refresh", + $request[1]->getUri()->getPath() + ); + + } + + + + + + + +} diff --git a/tests/Unit/Users/UserTest.php b/tests/Unit/Users/UserTest.php index 3d8f8db0b1..0a17caecfb 100644 --- a/tests/Unit/Users/UserTest.php +++ b/tests/Unit/Users/UserTest.php @@ -454,6 +454,25 @@ public function deactivate_makes_request_to_correct_location() ); + } + + /** @test */ + public function end_session_makes_request_to_correct_location() + { + $httpClient = $this->createNewHttpClient(); + $user = $this->createNewUser(); + + $user->endSessions(); + + $request = $httpClient->getRequests(); + + $this->assertEquals('DELETE', $request[0]->getMethod()); + $this->assertEquals( + "/api/v1/users/{$user->getId()}/sessions", + $request[0]->getUri()->getPath() + ); + + } /** @test */ diff --git a/tests/models/Sessions/session.json b/tests/models/Sessions/session.json new file mode 100644 index 0000000000..c1455a1b39 --- /dev/null +++ b/tests/models/Sessions/session.json @@ -0,0 +1,51 @@ +{ + "id": "101W_juydrDRByB7fUdRyE2JQ", + "login": "user@example.com", + "userId": "00ubgaSARVOQDIOXMORI", + "createdAt": "2015-08-30T18:41:35.818Z", + "expiresAt": "2015-08-30T18:41:35.818Z", + "status": "ACTIVE", + "lastPasswordVerification": "2015-08-30T18:41:35.818Z", + "lastFactorVerification": "2015-08-30T18:41:35.818Z", + "amr": [ + "pwd", + "otp", + "mfa" + ], + "idp": { + "id": "00oi5cpnylv792IcF0g3", + "type": "OKTA" + }, + "mfaActive": true, + "_links": { + "self": { + "href": "https://php.oktapreview.com/api/v1/sessions/101W_juydrDRByB7fUdRyE2JQ", + "hints": { + "allow": [ + "GET", + "DELETE" + ] + } + }, + "refresh": { + "href": "https://php.oktapreview.com/api/v1/sessions/101W_juydrDRByB7fUdRyE2JQ/lifecycle/refresh", + "hints": { + "allow": [ + "POST" + ] + } + }, + "user": { + "name": "Isaac Brock", + "href": "https://php.oktapreview.com/api/v1/users/00uit00ZK6ELuzPoD0g3", + "hints": { + "allow": [ + "GET" + ] + } + } + }, + "_embedded": { + "test": "this" + } +} \ No newline at end of file From 6e482a2ef86b3858f80213a6c657b80a73bc16a3 Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Mon, 4 Dec 2017 13:14:46 -0500 Subject: [PATCH 20/22] Adds full test suite for Session --- .../Sessions/CreateSessionRequest.php | 50 +++++ src/Generated/Sessions/Session.php | 6 +- ...od.php => SessionAuthenticationMethod.php} | 2 +- ...hority.php => SessionIdentityProvider.php} | 2 +- ...pe.php => SessionIdentityProviderType.php} | 2 +- src/Generated/Users/User.php | 4 +- ...orityType.php => CreateSessionRequest.php} | 2 +- ...hority.php => SessionIdentityProvider.php} | 2 +- src/Sessions/SessionIdentityProviderType.php | 23 +++ tests/Integration/ApplicationsTest.php | 188 ++++++++++++++++++ .../ApplicationCredentialsOAuthClientTest.php | 20 ++ .../Sessions/CreateSessionRequestTest.php | 50 +++++ tests/Unit/Sessions/SessionAuthorityTest.php | 8 +- tests/Unit/Sessions/SessionTest.php | 4 +- tests/Unit/Users/UserTest.php | 4 +- 15 files changed, 349 insertions(+), 18 deletions(-) create mode 100644 src/Generated/Sessions/CreateSessionRequest.php rename src/Generated/Sessions/{AuthenticationMethod.php => SessionAuthenticationMethod.php} (95%) rename src/Generated/Sessions/{SessionAuthority.php => SessionIdentityProvider.php} (94%) rename src/Generated/Sessions/{SessionAuthorityType.php => SessionIdentityProviderType.php} (95%) rename src/Sessions/{SessionAuthorityType.php => CreateSessionRequest.php} (93%) rename src/Sessions/{SessionAuthority.php => SessionIdentityProvider.php} (93%) create mode 100644 src/Sessions/SessionIdentityProviderType.php create mode 100644 tests/Unit/Sessions/CreateSessionRequestTest.php diff --git a/src/Generated/Sessions/CreateSessionRequest.php b/src/Generated/Sessions/CreateSessionRequest.php new file mode 100644 index 0000000000..c70038393e --- /dev/null +++ b/src/Generated/Sessions/CreateSessionRequest.php @@ -0,0 +1,50 @@ +getProperty(self::SESSION_TOKEN); + } + /** + * Set the sessionToken. + * + * @param mixed $sessionToken The value to set. + * @return self + */ + public function setSessionToken($sessionToken) + { + $this->setProperty( + self::SESSION_TOKEN, + $sessionToken + ); + + return $this; + } +} diff --git a/src/Generated/Sessions/Session.php b/src/Generated/Sessions/Session.php index c7f14a04f1..9f3b610e4e 100644 --- a/src/Generated/Sessions/Session.php +++ b/src/Generated/Sessions/Session.php @@ -73,13 +73,13 @@ public function getAmr(): array /** * Get the idp. * - * @return \Okta\Sessions\SessionAuthority + * @return \Okta\Sessions\SessionIdentityProvider */ - public function getIdp(array $options = []): \Okta\Sessions\SessionAuthority + public function getIdp(array $options = []): \Okta\Sessions\SessionIdentityProvider { return $this->getResourceProperty( self::IDP, - \Okta\Sessions\SessionAuthority::class, + \Okta\Sessions\SessionIdentityProvider::class, $options ); } diff --git a/src/Generated/Sessions/AuthenticationMethod.php b/src/Generated/Sessions/SessionAuthenticationMethod.php similarity index 95% rename from src/Generated/Sessions/AuthenticationMethod.php rename to src/Generated/Sessions/SessionAuthenticationMethod.php index 3045ceb1ff..63fde7a68d 100644 --- a/src/Generated/Sessions/AuthenticationMethod.php +++ b/src/Generated/Sessions/SessionAuthenticationMethod.php @@ -19,7 +19,7 @@ use Okta\Utilities\Enum; -class AuthenticationMethod extends Enum +class SessionAuthenticationMethod extends Enum { const FPT = 'fpt'; const GEO = 'geo'; diff --git a/src/Generated/Sessions/SessionAuthority.php b/src/Generated/Sessions/SessionIdentityProvider.php similarity index 94% rename from src/Generated/Sessions/SessionAuthority.php rename to src/Generated/Sessions/SessionIdentityProvider.php index abcc0688b0..ca8f72797e 100644 --- a/src/Generated/Sessions/SessionAuthority.php +++ b/src/Generated/Sessions/SessionIdentityProvider.php @@ -18,7 +18,7 @@ namespace Okta\Generated\Sessions; -class SessionAuthority extends \Okta\Resource\AbstractResource +class SessionIdentityProvider extends \Okta\Resource\AbstractResource { const ID = 'id'; const TYPE = 'type'; diff --git a/src/Generated/Sessions/SessionAuthorityType.php b/src/Generated/Sessions/SessionIdentityProviderType.php similarity index 95% rename from src/Generated/Sessions/SessionAuthorityType.php rename to src/Generated/Sessions/SessionIdentityProviderType.php index 08a26fa734..4a0491eae6 100644 --- a/src/Generated/Sessions/SessionAuthorityType.php +++ b/src/Generated/Sessions/SessionIdentityProviderType.php @@ -19,7 +19,7 @@ use Okta\Utilities\Enum; -class SessionAuthorityType extends Enum +class SessionIdentityProviderType extends Enum { const ACTIVE_DIRECTORY = 'ACTIVE_DIRECTORY'; const FEDERATION = 'FEDERATION'; diff --git a/src/Generated/Users/User.php b/src/Generated/Users/User.php index bfb5fa0382..9cd546b645 100644 --- a/src/Generated/Users/User.php +++ b/src/Generated/Users/User.php @@ -243,7 +243,7 @@ public function getTransitioningToStatus(): string * * @return mixed|null */ - public function endSessions() + public function endAllSessions($oauthTokens = false) { $uri = "/api/v1/users/{$this->getId()}/sessions"; $uri = $this->getDataStore()->buildUri( @@ -251,7 +251,7 @@ public function endSessions() ); $body = $this ->getDataStore() - ->executeRequest('DELETE', $uri); + ->executeRequest('DELETE', $uri, '', ['query' => ['oauthTokens' => $oauthTokens]]); return $body; } diff --git a/src/Sessions/SessionAuthorityType.php b/src/Sessions/CreateSessionRequest.php similarity index 93% rename from src/Sessions/SessionAuthorityType.php rename to src/Sessions/CreateSessionRequest.php index feb498ead0..b01e5d03e8 100644 --- a/src/Sessions/SessionAuthorityType.php +++ b/src/Sessions/CreateSessionRequest.php @@ -17,7 +17,7 @@ namespace Okta\Sessions; -class SessionAuthorityType extends \Okta\Generated\Sessions\SessionAuthorityType +class CreateSessionRequest extends \Okta\Generated\Sessions\CreateSessionRequest { } \ No newline at end of file diff --git a/src/Sessions/SessionAuthority.php b/src/Sessions/SessionIdentityProvider.php similarity index 93% rename from src/Sessions/SessionAuthority.php rename to src/Sessions/SessionIdentityProvider.php index 8190e067c7..9c41ce4c25 100644 --- a/src/Sessions/SessionAuthority.php +++ b/src/Sessions/SessionIdentityProvider.php @@ -17,7 +17,7 @@ namespace Okta\Sessions; -class SessionAuthority extends \Okta\Generated\Sessions\SessionAuthority +class SessionIdentityProvider extends \Okta\Generated\Sessions\SessionIdentityProvider { } \ No newline at end of file diff --git a/src/Sessions/SessionIdentityProviderType.php b/src/Sessions/SessionIdentityProviderType.php new file mode 100644 index 0000000000..f402b8fe4b --- /dev/null +++ b/src/Sessions/SessionIdentityProviderType.php @@ -0,0 +1,23 @@ +createNewHttpClient([ + 'getBody' => '{"id":"abc123", "signOnMode": "BOOKMARK"}' + ]); + + $application = new \Okta\Applications\Application(); + $app = $application->get('application123'); + + $requests = $client->getRequests(); + + + $this->assertEquals( + "/api/v1/apps/application123", + $requests[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\BookmarkApplication::class, $app); + } + + /** @test */ + public function a_basic_auth_application_returns_correct_application() + { + $client = $this->createNewHttpClient([ + 'getBody' => '{"id":"abc123", "signOnMode": "BASIC_AUTH"}' + ]); + + $application = new \Okta\Applications\Application(); + $app = $application->get('application123'); + + $requests = $client->getRequests(); + + + $this->assertEquals( + "/api/v1/apps/application123", + $requests[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\BasicAuthApplication::class, $app); + } + + /** @test */ + public function a_swa_application_returns_correct_application() + { + $client = $this->createNewHttpClient([ + 'getBody' => '{"id":"abc123", "signOnMode": "BROWSER_PLUGIN", "name": "template_swa"}' + ]); + + $application = new \Okta\Applications\Application(); + $app = $application->get('application123'); + + $requests = $client->getRequests(); + + + $this->assertEquals( + "/api/v1/apps/application123", + $requests[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\SwaApplication::class, $app); + } + + /** @test */ + public function a_swa_3_field_application_returns_correct_application() + { + $client = $this->createNewHttpClient([ + 'getBody' => '{"id":"abc123", "signOnMode": "BROWSER_PLUGIN", "name": "template_swa3field"}' + ]); + + $application = new \Okta\Applications\Application(); + $app = $application->get('application123'); + + $requests = $client->getRequests(); + + + $this->assertEquals( + "/api/v1/apps/application123", + $requests[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\SwaThreeFieldApplication::class, $app); + } + + /** @test */ + public function a_secure_password_store_application_returns_correct_application() + { + $client = $this->createNewHttpClient([ + 'getBody' => '{"id":"abc123", "signOnMode": "SECURE_PASSWORD_STORE"}' + ]); + + $application = new \Okta\Applications\Application(); + $app = $application->get('application123'); + + $requests = $client->getRequests(); + + + $this->assertEquals( + "/api/v1/apps/application123", + $requests[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\SecurePasswordStoreApplication::class, $app); + } + + /** @test */ + public function a_auto_login_application_returns_correct_application() + { + $client = $this->createNewHttpClient([ + 'getBody' => '{"id":"abc123", "signOnMode": "AUTO_LOGIN"}' + ]); + + $application = new \Okta\Applications\Application(); + $app = $application->get('application123'); + + $requests = $client->getRequests(); + + + $this->assertEquals( + "/api/v1/apps/application123", + $requests[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\AutoLoginApplication::class, $app); + } + + /** @test */ + public function a_ws_federation_application_returns_correct_application() + { + $client = $this->createNewHttpClient([ + 'getBody' => '{"id":"abc123", "signOnMode": "WS_FEDERATION"}' + ]); + + $application = new \Okta\Applications\Application(); + $app = $application->get('application123'); + + $requests = $client->getRequests(); + + + $this->assertEquals( + "/api/v1/apps/application123", + $requests[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\WsFederationApplication::class, $app); + } + + /** @test */ + public function a_saml_2_0_application_returns_correct_application() + { + $client = $this->createNewHttpClient([ + 'getBody' => '{"id":"abc123", "signOnMode": "SAML_2_0"}' + ]); + + $application = new \Okta\Applications\Application(); + $app = $application->get('application123'); + + $requests = $client->getRequests(); + + + $this->assertEquals( + "/api/v1/apps/application123", + $requests[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\SamlApplication::class, $app); + } + + /** @test */ + public function a_openid_connect_application_returns_correct_application() + { + $client = $this->createNewHttpClient([ + 'getBody' => '{"id":"abc123", "signOnMode": "OPENID_CONNECT"}' + ]); + + $application = new \Okta\Applications\Application(); + $app = $application->get('application123'); + + $requests = $client->getRequests(); + + + $this->assertEquals( + "/api/v1/apps/application123", + $requests[0]->getUri()->getPath() + ); + + $this->assertInstanceOf(\Okta\Applications\OpenIdConnectApplication::class, $app); + } } diff --git a/tests/Unit/Applications/ApplicationCredentialsOAuthClientTest.php b/tests/Unit/Applications/ApplicationCredentialsOAuthClientTest.php index 47bdbeb3ec..1cf20c223c 100644 --- a/tests/Unit/Applications/ApplicationCredentialsOAuthClientTest.php +++ b/tests/Unit/Applications/ApplicationCredentialsOAuthClientTest.php @@ -40,6 +40,16 @@ public function client_id_is_accessible() $this->assertEquals($this->properties->client_id, $this->testable->clientId); } + /** @test */ + public function client_id_is_settable() + { + $this->testable->setClientId('id1'); + $this->assertEquals('id1', $this->testable->getClientId()); + + $this->testable->clientId = 'id2'; + $this->assertEquals('id2', $this->testable->getClientId()); + } + /** @test */ public function client_secret_is_accessible() { @@ -47,6 +57,16 @@ public function client_secret_is_accessible() $this->assertEquals($this->properties->client_secret, $this->testable->clientSecret); } + /** @test */ + public function client_secret_is_settable() + { + $this->testable->setClientSecret('secret1'); + $this->assertEquals('secret1', $this->testable->getClientSecret()); + + $this->testable->clientSecret = 'secret2'; + $this->assertEquals('secret2', $this->testable->getClientSecret()); + } + /** @test */ public function auto_key_rotation_is_accessible() { diff --git a/tests/Unit/Sessions/CreateSessionRequestTest.php b/tests/Unit/Sessions/CreateSessionRequestTest.php new file mode 100644 index 0000000000..509cd74ade --- /dev/null +++ b/tests/Unit/Sessions/CreateSessionRequestTest.php @@ -0,0 +1,50 @@ +assertEquals($this->properties->sessionToken, $this->testable->getSessionToken()); + $this->assertEquals($this->properties->sessionToken, $this->testable->sessionToken); + } + + /** @test */ + public function session_token_is_settable() + { + $this->testable->setSessionToken('token1'); + $this->assertEquals('token1', $this->testable->getSessionToken()); + + $this->testable->sessionToken = 'token2'; + $this->assertEquals('token2', $this->testable->getSessionToken()); + } + + + +} diff --git a/tests/Unit/Sessions/SessionAuthorityTest.php b/tests/Unit/Sessions/SessionAuthorityTest.php index bcd5fe2bc2..7d9c2a0f10 100644 --- a/tests/Unit/Sessions/SessionAuthorityTest.php +++ b/tests/Unit/Sessions/SessionAuthorityTest.php @@ -15,18 +15,18 @@ * limitations under the License. * ******************************************************************************/ -use Okta\Sessions\SessionAuthority; +use Okta\Sessions\SessionIdentityProvider; use PHPUnit\Framework\TestCase; -class SessionAuthorityTest extends BaseUnitTestCase +class SessionIdentityProviderTest extends BaseUnitTestCase { protected $properties; - /** @var \Okta\Sessions\SessionAuthority */ + /** @var \Okta\Sessions\SessionIdentityProvider */ protected $testable; protected $model = '{"id": "abc123", "type": "ACTIVE"}'; - protected $modelType = \Okta\Sessions\SessionAuthority::class; + protected $modelType = \Okta\Sessions\SessionIdentityProvider::class; /** @test */ public function id_is_accessible() diff --git a/tests/Unit/Sessions/SessionTest.php b/tests/Unit/Sessions/SessionTest.php index e4e5040600..502ff254c6 100644 --- a/tests/Unit/Sessions/SessionTest.php +++ b/tests/Unit/Sessions/SessionTest.php @@ -113,8 +113,8 @@ public function id_is_accessible() /** @test */ public function idp_is_accessible() { - $this->assertInstanceOf(\Okta\Sessions\SessionAuthority::class, $this->testable->getIdp()); - $this->assertInstanceOf(\Okta\Sessions\SessionAuthority::class, $this->testable->idp); + $this->assertInstanceOf(\Okta\Sessions\SessionIdentityProvider::class, $this->testable->getIdp()); + $this->assertInstanceOf(\Okta\Sessions\SessionIdentityProvider::class, $this->testable->idp); } /** @test */ diff --git a/tests/Unit/Users/UserTest.php b/tests/Unit/Users/UserTest.php index 0a17caecfb..4546c76cd9 100644 --- a/tests/Unit/Users/UserTest.php +++ b/tests/Unit/Users/UserTest.php @@ -457,12 +457,12 @@ public function deactivate_makes_request_to_correct_location() } /** @test */ - public function end_session_makes_request_to_correct_location() + public function end_user_session_makes_request_to_correct_location() { $httpClient = $this->createNewHttpClient(); $user = $this->createNewUser(); - $user->endSessions(); + $user->endAllSessions(); $request = $httpClient->getRequests(); From 6d64ffabd7625e951d08c3dc8cc021ac06fc996c Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Mon, 4 Dec 2017 14:55:56 -0500 Subject: [PATCH 21/22] Builds resources based on 0.10.0 of openapi --- openapi/package.json | 2 +- src/Generated/Applications/AppUser.php | 5 ++--- .../Applications/AppUserCredentials.php | 1 - .../Applications/AppUserPasswordCredential.php | 1 - src/Generated/Applications/Application.php | 1 - .../Applications/ApplicationAccessibility.php | 1 - .../Applications/ApplicationCredentials.php | 1 - .../ApplicationCredentialsOAuthClient.php | 1 - .../ApplicationCredentialsSigning.php | 1 - .../ApplicationCredentialsUsernameTemplate.php | 1 - .../ApplicationGroupAssignment.php | 3 +-- .../Applications/ApplicationLicensing.php | 1 - .../Applications/ApplicationSettings.php | 1 - .../ApplicationSettingsApplication.php | 1 - .../ApplicationSettingsNotifications.php | 1 - .../ApplicationSettingsNotificationsVpn.php | 1 - ...licationSettingsNotificationsVpnNetwork.php | 1 - .../Applications/ApplicationVisibility.php | 1 - .../Applications/ApplicationVisibilityHide.php | 1 - .../Applications/AutoLoginApplication.php | 1 - .../AutoLoginApplicationSettings.php | 1 - .../AutoLoginApplicationSettingsSignOn.php | 1 - .../Applications/BasicApplicationSettings.php | 1 - .../BasicApplicationSettingsApplication.php | 1 - .../Applications/BasicAuthApplication.php | 1 - .../Applications/BookmarkApplication.php | 1 - .../BookmarkApplicationSettings.php | 1 - .../BookmarkApplicationSettingsApplication.php | 1 - .../Applications/BrowserPluginApplication.php | 1 - src/Generated/Applications/JsonWebKey.php | 1 - .../OAuthApplicationCredentials.php | 1 - .../Applications/OpenIdConnectApplication.php | 1 - .../OpenIdConnectApplicationSettings.php | 1 - .../OpenIdConnectApplicationSettingsClient.php | 1 - src/Generated/Applications/SamlApplication.php | 1 - .../Applications/SamlApplicationSettings.php | 1 - .../SamlApplicationSettingsSignOn.php | 1 - .../Applications/SamlAttributeStatement.php | 1 - .../SchemeApplicationCredentials.php | 1 - .../SecurePasswordStoreApplication.php | 1 - .../SecurePasswordStoreApplicationSettings.php | 1 - ...wordStoreApplicationSettingsApplication.php | 1 - src/Generated/Applications/SwaApplication.php | 1 - .../Applications/SwaApplicationSettings.php | 1 - .../SwaApplicationSettingsApplication.php | 1 - .../Applications/SwaThreeFieldApplication.php | 1 - .../SwaThreeFieldApplicationSettings.php | 1 - ...hreeFieldApplicationSettingsApplication.php | 1 - .../Applications/WsFederationApplication.php | 1 - .../WsFederationApplicationSettings.php | 1 - ...ederationApplicationSettingsApplication.php | 1 - src/Generated/GroupRules/GroupRule.php | 1 - src/Generated/GroupRules/GroupRuleAction.php | 1 - .../GroupRules/GroupRuleConditions.php | 1 - .../GroupRules/GroupRuleExpression.php | 1 - .../GroupRules/GroupRuleGroupAssignment.php | 1 - .../GroupRules/GroupRuleGroupCondition.php | 1 - .../GroupRules/GroupRulePeopleCondition.php | 1 - .../GroupRules/GroupRuleUserCondition.php | 1 - src/Generated/Groups/GroupProfile.php | 1 - .../Sessions/CreateSessionRequest.php | 1 - src/Generated/Sessions/Session.php | 15 +++++++-------- .../Sessions/SessionIdentityProvider.php | 1 - src/Generated/UserFactors/CallFactor.php | 1 - .../UserFactors/CallFactorProfile.php | 1 - src/Generated/UserFactors/EmailFactor.php | 1 - .../UserFactors/EmailFactorProfile.php | 1 - src/Generated/UserFactors/Factor.php | 1 - src/Generated/UserFactors/FactorProfile.php | 1 - src/Generated/UserFactors/HardwareFactor.php | 1 - .../UserFactors/HardwareFactorProfile.php | 1 - src/Generated/UserFactors/PushFactor.php | 1 - .../UserFactors/PushFactorProfile.php | 1 - src/Generated/UserFactors/SecurityQuestion.php | 1 - .../UserFactors/SecurityQuestionFactor.php | 1 - .../SecurityQuestionFactorProfile.php | 1 - src/Generated/UserFactors/SmsFactor.php | 1 - src/Generated/UserFactors/SmsFactorProfile.php | 1 - src/Generated/UserFactors/TokenFactor.php | 1 - .../UserFactors/TokenFactorProfile.php | 1 - src/Generated/UserFactors/TotpFactor.php | 1 - .../UserFactors/TotpFactorProfile.php | 1 - .../UserFactors/VerifyFactorRequest.php | 1 - .../UserFactors/VerifyFactorResponse.php | 1 - src/Generated/UserFactors/WebFactor.php | 1 - src/Generated/UserFactors/WebFactorProfile.php | 1 - src/Generated/Users/AppLink.php | 1 - src/Generated/Users/AuthenticationProvider.php | 1 - src/Generated/Users/ChangePasswordRequest.php | 1 - src/Generated/Users/ForgotPasswordResponse.php | 1 - src/Generated/Users/PasswordCredential.php | 1 - .../Users/RecoveryQuestionCredential.php | 1 - src/Generated/Users/ResetPasswordToken.php | 1 - src/Generated/Users/Role.php | 1 - src/Generated/Users/TempPassword.php | 1 - src/Generated/Users/User.php | 18 +++++++++--------- src/Generated/Users/UserActivationToken.php | 1 - src/Generated/Users/UserCredentials.php | 1 - src/Generated/Users/UserProfile.php | 1 - src/Sessions/AuthenticationMethod.php | 2 +- src/Sessions/CreateSessionRequest.php | 2 +- src/Sessions/Session.php | 2 +- src/Sessions/SessionIdentityProvider.php | 2 +- src/Sessions/SessionIdentityProviderType.php | 2 +- src/Sessions/SessionStatus.php | 2 +- 105 files changed, 26 insertions(+), 123 deletions(-) diff --git a/openapi/package.json b/openapi/package.json index 961f4809d1..11546b55ac 100644 --- a/openapi/package.json +++ b/openapi/package.json @@ -6,7 +6,7 @@ "generator": "okta-sdk-generator -t generator -o ../src/Generated" }, "devDependencies": { - "@okta/openapi": "^0.3.0", + "@okta/openapi": "^0.10.0", "lodash": "^4.17.4", "lodash-inflection": "^1.5.0" }, diff --git a/src/Generated/Applications/AppUser.php b/src/Generated/Applications/AppUser.php index bb43ac412b..d88f76599e 100644 --- a/src/Generated/Applications/AppUser.php +++ b/src/Generated/Applications/AppUser.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class AppUser extends \Okta\Resource\AbstractResource { const ID = 'id'; @@ -36,7 +35,7 @@ class AppUser extends \Okta\Resource\AbstractResource const PASSWORD_CHANGED = 'passwordChanged'; - public function save( $appId ) + public function save($appId) { return \Okta\Client::getInstance() ->getDataStore() @@ -47,7 +46,7 @@ public function save( $appId ) ); } - public function delete( $appId ) + public function delete($appId) { return \Okta\Client::getInstance() ->getDataStore() diff --git a/src/Generated/Applications/AppUserCredentials.php b/src/Generated/Applications/AppUserCredentials.php index 1ac50e1d8e..ec3c41a397 100644 --- a/src/Generated/Applications/AppUserCredentials.php +++ b/src/Generated/Applications/AppUserCredentials.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class AppUserCredentials extends \Okta\Resource\AbstractResource { const PASSWORD = 'password'; diff --git a/src/Generated/Applications/AppUserPasswordCredential.php b/src/Generated/Applications/AppUserPasswordCredential.php index 2c51e2eb7c..faafb66ae5 100644 --- a/src/Generated/Applications/AppUserPasswordCredential.php +++ b/src/Generated/Applications/AppUserPasswordCredential.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class AppUserPasswordCredential extends \Okta\Resource\AbstractResource { const VALUE = 'value'; diff --git a/src/Generated/Applications/Application.php b/src/Generated/Applications/Application.php index 1c4155ac65..f190703dc0 100644 --- a/src/Generated/Applications/Application.php +++ b/src/Generated/Applications/Application.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class Application extends \Okta\Resource\AbstractResource { const ID = 'id'; diff --git a/src/Generated/Applications/ApplicationAccessibility.php b/src/Generated/Applications/ApplicationAccessibility.php index 27469cd3d2..a0b4acf3e7 100644 --- a/src/Generated/Applications/ApplicationAccessibility.php +++ b/src/Generated/Applications/ApplicationAccessibility.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationAccessibility extends \Okta\Resource\AbstractResource { const SELF_SERVICE = 'selfService'; diff --git a/src/Generated/Applications/ApplicationCredentials.php b/src/Generated/Applications/ApplicationCredentials.php index 7c3bd1d8f5..9016b87c32 100644 --- a/src/Generated/Applications/ApplicationCredentials.php +++ b/src/Generated/Applications/ApplicationCredentials.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationCredentials extends \Okta\Resource\AbstractResource { const SIGNING = 'signing'; diff --git a/src/Generated/Applications/ApplicationCredentialsOAuthClient.php b/src/Generated/Applications/ApplicationCredentialsOAuthClient.php index 03e50b7e50..6f82ab880e 100644 --- a/src/Generated/Applications/ApplicationCredentialsOAuthClient.php +++ b/src/Generated/Applications/ApplicationCredentialsOAuthClient.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationCredentialsOAuthClient extends \Okta\Resource\AbstractResource { const CLIENT_ID = 'client_id'; diff --git a/src/Generated/Applications/ApplicationCredentialsSigning.php b/src/Generated/Applications/ApplicationCredentialsSigning.php index a0fcf4587a..ba46c0530b 100644 --- a/src/Generated/Applications/ApplicationCredentialsSigning.php +++ b/src/Generated/Applications/ApplicationCredentialsSigning.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationCredentialsSigning extends \Okta\Resource\AbstractResource { const KID = 'kid'; diff --git a/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php b/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php index 1e439fed6e..6df0d9f9a2 100644 --- a/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php +++ b/src/Generated/Applications/ApplicationCredentialsUsernameTemplate.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationCredentialsUsernameTemplate extends \Okta\Resource\AbstractResource { const TYPE = 'type'; diff --git a/src/Generated/Applications/ApplicationGroupAssignment.php b/src/Generated/Applications/ApplicationGroupAssignment.php index bcf999a480..e83aed1f67 100644 --- a/src/Generated/Applications/ApplicationGroupAssignment.php +++ b/src/Generated/Applications/ApplicationGroupAssignment.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationGroupAssignment extends \Okta\Resource\AbstractResource { const ID = 'id'; @@ -28,7 +27,7 @@ class ApplicationGroupAssignment extends \Okta\Resource\AbstractResource const LAST_UPDATED = 'lastUpdated'; - public function delete( $appId ) + public function delete($appId) { return \Okta\Client::getInstance() ->getDataStore() diff --git a/src/Generated/Applications/ApplicationLicensing.php b/src/Generated/Applications/ApplicationLicensing.php index b643e7db90..15bd5ee171 100644 --- a/src/Generated/Applications/ApplicationLicensing.php +++ b/src/Generated/Applications/ApplicationLicensing.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationLicensing extends \Okta\Resource\AbstractResource { const SEAT_COUNT = 'seatCount'; diff --git a/src/Generated/Applications/ApplicationSettings.php b/src/Generated/Applications/ApplicationSettings.php index 1463a949c3..5c97cb0030 100644 --- a/src/Generated/Applications/ApplicationSettings.php +++ b/src/Generated/Applications/ApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationSettings extends \Okta\Resource\AbstractResource { const APP = 'app'; diff --git a/src/Generated/Applications/ApplicationSettingsApplication.php b/src/Generated/Applications/ApplicationSettingsApplication.php index 0f67ac958c..9a68e7f2cc 100644 --- a/src/Generated/Applications/ApplicationSettingsApplication.php +++ b/src/Generated/Applications/ApplicationSettingsApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationSettingsApplication extends \Okta\Resource\AbstractResource { diff --git a/src/Generated/Applications/ApplicationSettingsNotifications.php b/src/Generated/Applications/ApplicationSettingsNotifications.php index 841647e26c..b8da7fc7f6 100644 --- a/src/Generated/Applications/ApplicationSettingsNotifications.php +++ b/src/Generated/Applications/ApplicationSettingsNotifications.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationSettingsNotifications extends \Okta\Resource\AbstractResource { const VPN = 'vpn'; diff --git a/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php b/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php index e0f7ae850b..8a7df15153 100644 --- a/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php +++ b/src/Generated/Applications/ApplicationSettingsNotificationsVpn.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationSettingsNotificationsVpn extends \Okta\Resource\AbstractResource { const HELP_URL = 'helpUrl'; diff --git a/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php b/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php index 222e2aa381..14d3ca48c6 100644 --- a/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php +++ b/src/Generated/Applications/ApplicationSettingsNotificationsVpnNetwork.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationSettingsNotificationsVpnNetwork extends \Okta\Resource\AbstractResource { const EXCLUDE = 'exclude'; diff --git a/src/Generated/Applications/ApplicationVisibility.php b/src/Generated/Applications/ApplicationVisibility.php index 9d5fa46032..6696caced1 100644 --- a/src/Generated/Applications/ApplicationVisibility.php +++ b/src/Generated/Applications/ApplicationVisibility.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationVisibility extends \Okta\Resource\AbstractResource { const HIDE = 'hide'; diff --git a/src/Generated/Applications/ApplicationVisibilityHide.php b/src/Generated/Applications/ApplicationVisibilityHide.php index 80ba6674ac..9e2cfa6c3d 100644 --- a/src/Generated/Applications/ApplicationVisibilityHide.php +++ b/src/Generated/Applications/ApplicationVisibilityHide.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class ApplicationVisibilityHide extends \Okta\Resource\AbstractResource { const I_OS = 'iOS'; diff --git a/src/Generated/Applications/AutoLoginApplication.php b/src/Generated/Applications/AutoLoginApplication.php index e3e9cb09a5..e03e1b0118 100644 --- a/src/Generated/Applications/AutoLoginApplication.php +++ b/src/Generated/Applications/AutoLoginApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class AutoLoginApplication extends \Okta\Applications\Application { const SETTINGS = 'settings'; diff --git a/src/Generated/Applications/AutoLoginApplicationSettings.php b/src/Generated/Applications/AutoLoginApplicationSettings.php index 9f8bacdc62..1c966f3374 100644 --- a/src/Generated/Applications/AutoLoginApplicationSettings.php +++ b/src/Generated/Applications/AutoLoginApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class AutoLoginApplicationSettings extends \Okta\Applications\ApplicationSettings { const SIGN_ON = 'signOn'; diff --git a/src/Generated/Applications/AutoLoginApplicationSettingsSignOn.php b/src/Generated/Applications/AutoLoginApplicationSettingsSignOn.php index 57f365435c..aa58d1e13f 100644 --- a/src/Generated/Applications/AutoLoginApplicationSettingsSignOn.php +++ b/src/Generated/Applications/AutoLoginApplicationSettingsSignOn.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class AutoLoginApplicationSettingsSignOn extends \Okta\Resource\AbstractResource { const LOGIN_URL = 'loginUrl'; diff --git a/src/Generated/Applications/BasicApplicationSettings.php b/src/Generated/Applications/BasicApplicationSettings.php index f1cbeb97ef..a3457812da 100644 --- a/src/Generated/Applications/BasicApplicationSettings.php +++ b/src/Generated/Applications/BasicApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class BasicApplicationSettings extends \Okta\Applications\ApplicationSettings { const APP = 'app'; diff --git a/src/Generated/Applications/BasicApplicationSettingsApplication.php b/src/Generated/Applications/BasicApplicationSettingsApplication.php index 9bd724ceb0..55cd2c589b 100644 --- a/src/Generated/Applications/BasicApplicationSettingsApplication.php +++ b/src/Generated/Applications/BasicApplicationSettingsApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class BasicApplicationSettingsApplication extends \Okta\Applications\ApplicationSettingsApplication { const URL = 'url'; diff --git a/src/Generated/Applications/BasicAuthApplication.php b/src/Generated/Applications/BasicAuthApplication.php index f34ea49620..e7cc13158e 100644 --- a/src/Generated/Applications/BasicAuthApplication.php +++ b/src/Generated/Applications/BasicAuthApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class BasicAuthApplication extends \Okta\Applications\Application { const NAME = 'name'; diff --git a/src/Generated/Applications/BookmarkApplication.php b/src/Generated/Applications/BookmarkApplication.php index 0ead31abcf..12f4c99657 100644 --- a/src/Generated/Applications/BookmarkApplication.php +++ b/src/Generated/Applications/BookmarkApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class BookmarkApplication extends \Okta\Applications\Application { const NAME = 'name'; diff --git a/src/Generated/Applications/BookmarkApplicationSettings.php b/src/Generated/Applications/BookmarkApplicationSettings.php index e37ebe24d7..ea40df96b2 100644 --- a/src/Generated/Applications/BookmarkApplicationSettings.php +++ b/src/Generated/Applications/BookmarkApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class BookmarkApplicationSettings extends \Okta\Applications\ApplicationSettings { const APP = 'app'; diff --git a/src/Generated/Applications/BookmarkApplicationSettingsApplication.php b/src/Generated/Applications/BookmarkApplicationSettingsApplication.php index 5d86d97154..088b148ced 100644 --- a/src/Generated/Applications/BookmarkApplicationSettingsApplication.php +++ b/src/Generated/Applications/BookmarkApplicationSettingsApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class BookmarkApplicationSettingsApplication extends \Okta\Applications\ApplicationSettingsApplication { const URL = 'url'; diff --git a/src/Generated/Applications/BrowserPluginApplication.php b/src/Generated/Applications/BrowserPluginApplication.php index 242bb7fd5c..9e3c217ddb 100644 --- a/src/Generated/Applications/BrowserPluginApplication.php +++ b/src/Generated/Applications/BrowserPluginApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class BrowserPluginApplication extends \Okta\Applications\Application { const CREDENTIALS = 'credentials'; diff --git a/src/Generated/Applications/JsonWebKey.php b/src/Generated/Applications/JsonWebKey.php index 636c88d234..87ceaf1a20 100644 --- a/src/Generated/Applications/JsonWebKey.php +++ b/src/Generated/Applications/JsonWebKey.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class JsonWebKey extends \Okta\Resource\AbstractResource { const E = 'e'; diff --git a/src/Generated/Applications/OAuthApplicationCredentials.php b/src/Generated/Applications/OAuthApplicationCredentials.php index a2c0c7d4fd..25832c149e 100644 --- a/src/Generated/Applications/OAuthApplicationCredentials.php +++ b/src/Generated/Applications/OAuthApplicationCredentials.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class OAuthApplicationCredentials extends \Okta\Applications\ApplicationCredentials { const OAUTH_CLIENT = 'oauthClient'; diff --git a/src/Generated/Applications/OpenIdConnectApplication.php b/src/Generated/Applications/OpenIdConnectApplication.php index 52d3926c36..f7884f0e92 100644 --- a/src/Generated/Applications/OpenIdConnectApplication.php +++ b/src/Generated/Applications/OpenIdConnectApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class OpenIdConnectApplication extends \Okta\Applications\Application { const NAME = 'name'; diff --git a/src/Generated/Applications/OpenIdConnectApplicationSettings.php b/src/Generated/Applications/OpenIdConnectApplicationSettings.php index f5c0578af2..6d0553380d 100644 --- a/src/Generated/Applications/OpenIdConnectApplicationSettings.php +++ b/src/Generated/Applications/OpenIdConnectApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class OpenIdConnectApplicationSettings extends \Okta\Applications\ApplicationSettings { const OAUTH_CLIENT = 'oauthClient'; diff --git a/src/Generated/Applications/OpenIdConnectApplicationSettingsClient.php b/src/Generated/Applications/OpenIdConnectApplicationSettingsClient.php index f037b0e11b..78781c526e 100644 --- a/src/Generated/Applications/OpenIdConnectApplicationSettingsClient.php +++ b/src/Generated/Applications/OpenIdConnectApplicationSettingsClient.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class OpenIdConnectApplicationSettingsClient extends \Okta\Resource\AbstractResource { const TOS_URI = 'tos_uri'; diff --git a/src/Generated/Applications/SamlApplication.php b/src/Generated/Applications/SamlApplication.php index 0858825dac..cdee6638ca 100644 --- a/src/Generated/Applications/SamlApplication.php +++ b/src/Generated/Applications/SamlApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class SamlApplication extends \Okta\Applications\Application { const SETTINGS = 'settings'; diff --git a/src/Generated/Applications/SamlApplicationSettings.php b/src/Generated/Applications/SamlApplicationSettings.php index a175171dee..3f05965953 100644 --- a/src/Generated/Applications/SamlApplicationSettings.php +++ b/src/Generated/Applications/SamlApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class SamlApplicationSettings extends \Okta\Applications\ApplicationSettings { const SIGN_ON = 'signOn'; diff --git a/src/Generated/Applications/SamlApplicationSettingsSignOn.php b/src/Generated/Applications/SamlApplicationSettingsSignOn.php index d14a560db0..32d6357181 100644 --- a/src/Generated/Applications/SamlApplicationSettingsSignOn.php +++ b/src/Generated/Applications/SamlApplicationSettingsSignOn.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class SamlApplicationSettingsSignOn extends \Okta\Resource\AbstractResource { const AUDIENCE = 'audience'; diff --git a/src/Generated/Applications/SamlAttributeStatement.php b/src/Generated/Applications/SamlAttributeStatement.php index 4a56bd9019..4f303ef18c 100644 --- a/src/Generated/Applications/SamlAttributeStatement.php +++ b/src/Generated/Applications/SamlAttributeStatement.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class SamlAttributeStatement extends \Okta\Resource\AbstractResource { const NAME = 'name'; diff --git a/src/Generated/Applications/SchemeApplicationCredentials.php b/src/Generated/Applications/SchemeApplicationCredentials.php index 7ca68f64fa..a1f4aa3307 100644 --- a/src/Generated/Applications/SchemeApplicationCredentials.php +++ b/src/Generated/Applications/SchemeApplicationCredentials.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class SchemeApplicationCredentials extends \Okta\Applications\ApplicationCredentials { const SCHEME = 'scheme'; diff --git a/src/Generated/Applications/SecurePasswordStoreApplication.php b/src/Generated/Applications/SecurePasswordStoreApplication.php index 9336f85171..8b147c9ed7 100644 --- a/src/Generated/Applications/SecurePasswordStoreApplication.php +++ b/src/Generated/Applications/SecurePasswordStoreApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class SecurePasswordStoreApplication extends \Okta\Applications\Application { const NAME = 'name'; diff --git a/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php b/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php index aca7aa51b8..f725c0bb8e 100644 --- a/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php +++ b/src/Generated/Applications/SecurePasswordStoreApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class SecurePasswordStoreApplicationSettings extends \Okta\Applications\ApplicationSettings { const APP = 'app'; diff --git a/src/Generated/Applications/SecurePasswordStoreApplicationSettingsApplication.php b/src/Generated/Applications/SecurePasswordStoreApplicationSettingsApplication.php index bb4eaa7b41..974af7b9ce 100644 --- a/src/Generated/Applications/SecurePasswordStoreApplicationSettingsApplication.php +++ b/src/Generated/Applications/SecurePasswordStoreApplicationSettingsApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class SecurePasswordStoreApplicationSettingsApplication extends \Okta\Applications\ApplicationSettingsApplication { const URL = 'url'; diff --git a/src/Generated/Applications/SwaApplication.php b/src/Generated/Applications/SwaApplication.php index 8779000cbd..20b8c4e5fe 100644 --- a/src/Generated/Applications/SwaApplication.php +++ b/src/Generated/Applications/SwaApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class SwaApplication extends \Okta\Applications\BrowserPluginApplication { const NAME = 'name'; diff --git a/src/Generated/Applications/SwaApplicationSettings.php b/src/Generated/Applications/SwaApplicationSettings.php index 01aa0b52fe..f57d6894ac 100644 --- a/src/Generated/Applications/SwaApplicationSettings.php +++ b/src/Generated/Applications/SwaApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class SwaApplicationSettings extends \Okta\Applications\ApplicationSettings { const APP = 'app'; diff --git a/src/Generated/Applications/SwaApplicationSettingsApplication.php b/src/Generated/Applications/SwaApplicationSettingsApplication.php index b7802c15e6..52cade17e5 100644 --- a/src/Generated/Applications/SwaApplicationSettingsApplication.php +++ b/src/Generated/Applications/SwaApplicationSettingsApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class SwaApplicationSettingsApplication extends \Okta\Applications\ApplicationSettingsApplication { const URL = 'url'; diff --git a/src/Generated/Applications/SwaThreeFieldApplication.php b/src/Generated/Applications/SwaThreeFieldApplication.php index 86da626b57..be6a72fc7a 100644 --- a/src/Generated/Applications/SwaThreeFieldApplication.php +++ b/src/Generated/Applications/SwaThreeFieldApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class SwaThreeFieldApplication extends \Okta\Applications\BrowserPluginApplication { const NAME = 'name'; diff --git a/src/Generated/Applications/SwaThreeFieldApplicationSettings.php b/src/Generated/Applications/SwaThreeFieldApplicationSettings.php index 267c2ae5ce..c1e29ec754 100644 --- a/src/Generated/Applications/SwaThreeFieldApplicationSettings.php +++ b/src/Generated/Applications/SwaThreeFieldApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class SwaThreeFieldApplicationSettings extends \Okta\Applications\ApplicationSettings { const APP = 'app'; diff --git a/src/Generated/Applications/SwaThreeFieldApplicationSettingsApplication.php b/src/Generated/Applications/SwaThreeFieldApplicationSettingsApplication.php index 96fe073508..1d536ecac9 100644 --- a/src/Generated/Applications/SwaThreeFieldApplicationSettingsApplication.php +++ b/src/Generated/Applications/SwaThreeFieldApplicationSettingsApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class SwaThreeFieldApplicationSettingsApplication extends \Okta\Applications\ApplicationSettingsApplication { const TARGET_URL = 'targetUrl'; diff --git a/src/Generated/Applications/WsFederationApplication.php b/src/Generated/Applications/WsFederationApplication.php index d3aaad5ee2..450271ddfe 100644 --- a/src/Generated/Applications/WsFederationApplication.php +++ b/src/Generated/Applications/WsFederationApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class WsFederationApplication extends \Okta\Applications\Application { const NAME = 'name'; diff --git a/src/Generated/Applications/WsFederationApplicationSettings.php b/src/Generated/Applications/WsFederationApplicationSettings.php index 3f3719a505..94d6788161 100644 --- a/src/Generated/Applications/WsFederationApplicationSettings.php +++ b/src/Generated/Applications/WsFederationApplicationSettings.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class WsFederationApplicationSettings extends \Okta\Applications\ApplicationSettings { const APP = 'app'; diff --git a/src/Generated/Applications/WsFederationApplicationSettingsApplication.php b/src/Generated/Applications/WsFederationApplicationSettingsApplication.php index d1d01ae64c..5209756483 100644 --- a/src/Generated/Applications/WsFederationApplicationSettingsApplication.php +++ b/src/Generated/Applications/WsFederationApplicationSettingsApplication.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Applications; - class WsFederationApplicationSettingsApplication extends \Okta\Applications\ApplicationSettingsApplication { const REALM = 'realm'; diff --git a/src/Generated/GroupRules/GroupRule.php b/src/Generated/GroupRules/GroupRule.php index 72aa8ccdc6..977581497e 100644 --- a/src/Generated/GroupRules/GroupRule.php +++ b/src/Generated/GroupRules/GroupRule.php @@ -17,7 +17,6 @@ namespace Okta\Generated\GroupRules; - class GroupRule extends \Okta\Resource\AbstractResource { const ID = 'id'; diff --git a/src/Generated/GroupRules/GroupRuleAction.php b/src/Generated/GroupRules/GroupRuleAction.php index 6823aae0d6..4597415325 100644 --- a/src/Generated/GroupRules/GroupRuleAction.php +++ b/src/Generated/GroupRules/GroupRuleAction.php @@ -17,7 +17,6 @@ namespace Okta\Generated\GroupRules; - class GroupRuleAction extends \Okta\Resource\AbstractResource { const ASSIGN_USER_TO_GROUPS = 'assignUserToGroups'; diff --git a/src/Generated/GroupRules/GroupRuleConditions.php b/src/Generated/GroupRules/GroupRuleConditions.php index 2f10d9cfdd..9f0a59149d 100644 --- a/src/Generated/GroupRules/GroupRuleConditions.php +++ b/src/Generated/GroupRules/GroupRuleConditions.php @@ -17,7 +17,6 @@ namespace Okta\Generated\GroupRules; - class GroupRuleConditions extends \Okta\Resource\AbstractResource { const PEOPLE = 'people'; diff --git a/src/Generated/GroupRules/GroupRuleExpression.php b/src/Generated/GroupRules/GroupRuleExpression.php index 84f753285c..08185f34ef 100644 --- a/src/Generated/GroupRules/GroupRuleExpression.php +++ b/src/Generated/GroupRules/GroupRuleExpression.php @@ -17,7 +17,6 @@ namespace Okta\Generated\GroupRules; - class GroupRuleExpression extends \Okta\Resource\AbstractResource { const TYPE = 'type'; diff --git a/src/Generated/GroupRules/GroupRuleGroupAssignment.php b/src/Generated/GroupRules/GroupRuleGroupAssignment.php index 7bc1bf1cc2..c2c015af43 100644 --- a/src/Generated/GroupRules/GroupRuleGroupAssignment.php +++ b/src/Generated/GroupRules/GroupRuleGroupAssignment.php @@ -17,7 +17,6 @@ namespace Okta\Generated\GroupRules; - class GroupRuleGroupAssignment extends \Okta\Resource\AbstractResource { const GROUP_IDS = 'groupIds'; diff --git a/src/Generated/GroupRules/GroupRuleGroupCondition.php b/src/Generated/GroupRules/GroupRuleGroupCondition.php index f2505fc769..66b6c13f01 100644 --- a/src/Generated/GroupRules/GroupRuleGroupCondition.php +++ b/src/Generated/GroupRules/GroupRuleGroupCondition.php @@ -17,7 +17,6 @@ namespace Okta\Generated\GroupRules; - class GroupRuleGroupCondition extends \Okta\Resource\AbstractResource { const EXCLUDE = 'exclude'; diff --git a/src/Generated/GroupRules/GroupRulePeopleCondition.php b/src/Generated/GroupRules/GroupRulePeopleCondition.php index b9dc84b763..4438b0a21a 100644 --- a/src/Generated/GroupRules/GroupRulePeopleCondition.php +++ b/src/Generated/GroupRules/GroupRulePeopleCondition.php @@ -17,7 +17,6 @@ namespace Okta\Generated\GroupRules; - class GroupRulePeopleCondition extends \Okta\Resource\AbstractResource { const USERS = 'users'; diff --git a/src/Generated/GroupRules/GroupRuleUserCondition.php b/src/Generated/GroupRules/GroupRuleUserCondition.php index e2609334d4..e8e1f1fa11 100644 --- a/src/Generated/GroupRules/GroupRuleUserCondition.php +++ b/src/Generated/GroupRules/GroupRuleUserCondition.php @@ -17,7 +17,6 @@ namespace Okta\Generated\GroupRules; - class GroupRuleUserCondition extends \Okta\Resource\AbstractResource { const EXCLUDE = 'exclude'; diff --git a/src/Generated/Groups/GroupProfile.php b/src/Generated/Groups/GroupProfile.php index 0643ed7625..d3b858608d 100644 --- a/src/Generated/Groups/GroupProfile.php +++ b/src/Generated/Groups/GroupProfile.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Groups; - class GroupProfile extends \Okta\Resource\AbstractResource { const NAME = 'name'; diff --git a/src/Generated/Sessions/CreateSessionRequest.php b/src/Generated/Sessions/CreateSessionRequest.php index c70038393e..648f0225d1 100644 --- a/src/Generated/Sessions/CreateSessionRequest.php +++ b/src/Generated/Sessions/CreateSessionRequest.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Sessions; - class CreateSessionRequest extends \Okta\Resource\AbstractResource { const SESSION_TOKEN = 'sessionToken'; diff --git a/src/Generated/Sessions/Session.php b/src/Generated/Sessions/Session.php index 9f3b610e4e..f3f4437b3e 100644 --- a/src/Generated/Sessions/Session.php +++ b/src/Generated/Sessions/Session.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Sessions; - class Session extends \Okta\Resource\AbstractResource { const ID = 'id'; @@ -43,14 +42,14 @@ public function get($query) "/sessions" ); } - public function delete() + public function delete() { return \Okta\Client::getInstance() - ->getDataStore() - ->deleteResource( - "/sessions", - $this - ); + ->getDataStore() + ->deleteResource( + "/sessions", + $this + ); } /** * Get the id. @@ -159,7 +158,7 @@ public function getLastPasswordVerification() /** - * + * * * * @return mixed|null diff --git a/src/Generated/Sessions/SessionIdentityProvider.php b/src/Generated/Sessions/SessionIdentityProvider.php index ca8f72797e..b691898a87 100644 --- a/src/Generated/Sessions/SessionIdentityProvider.php +++ b/src/Generated/Sessions/SessionIdentityProvider.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Sessions; - class SessionIdentityProvider extends \Okta\Resource\AbstractResource { const ID = 'id'; diff --git a/src/Generated/UserFactors/CallFactor.php b/src/Generated/UserFactors/CallFactor.php index 2474ea8e13..32d653367e 100644 --- a/src/Generated/UserFactors/CallFactor.php +++ b/src/Generated/UserFactors/CallFactor.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class CallFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; diff --git a/src/Generated/UserFactors/CallFactorProfile.php b/src/Generated/UserFactors/CallFactorProfile.php index cd07352f67..7608e0af45 100644 --- a/src/Generated/UserFactors/CallFactorProfile.php +++ b/src/Generated/UserFactors/CallFactorProfile.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class CallFactorProfile extends \Okta\UserFactors\FactorProfile { const PHONE_NUMBER = 'phoneNumber'; diff --git a/src/Generated/UserFactors/EmailFactor.php b/src/Generated/UserFactors/EmailFactor.php index d6b131e1df..63cb335bc9 100644 --- a/src/Generated/UserFactors/EmailFactor.php +++ b/src/Generated/UserFactors/EmailFactor.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class EmailFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; diff --git a/src/Generated/UserFactors/EmailFactorProfile.php b/src/Generated/UserFactors/EmailFactorProfile.php index 554ecbf539..ed55ac0b6d 100644 --- a/src/Generated/UserFactors/EmailFactorProfile.php +++ b/src/Generated/UserFactors/EmailFactorProfile.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class EmailFactorProfile extends \Okta\UserFactors\FactorProfile { const EMAIL = 'email'; diff --git a/src/Generated/UserFactors/Factor.php b/src/Generated/UserFactors/Factor.php index 95adaa8b28..8c67cfb76e 100644 --- a/src/Generated/UserFactors/Factor.php +++ b/src/Generated/UserFactors/Factor.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class Factor extends \Okta\Resource\AbstractResource { const ID = 'id'; diff --git a/src/Generated/UserFactors/FactorProfile.php b/src/Generated/UserFactors/FactorProfile.php index ce25c87e84..3ff7b53b7c 100644 --- a/src/Generated/UserFactors/FactorProfile.php +++ b/src/Generated/UserFactors/FactorProfile.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class FactorProfile extends \Okta\Resource\AbstractResource { diff --git a/src/Generated/UserFactors/HardwareFactor.php b/src/Generated/UserFactors/HardwareFactor.php index 099971d173..a28a99a54d 100644 --- a/src/Generated/UserFactors/HardwareFactor.php +++ b/src/Generated/UserFactors/HardwareFactor.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class HardwareFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; diff --git a/src/Generated/UserFactors/HardwareFactorProfile.php b/src/Generated/UserFactors/HardwareFactorProfile.php index e2bf7cecd2..568c3360d3 100644 --- a/src/Generated/UserFactors/HardwareFactorProfile.php +++ b/src/Generated/UserFactors/HardwareFactorProfile.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class HardwareFactorProfile extends \Okta\UserFactors\FactorProfile { const CREDENTIAL_ID = 'credentialId'; diff --git a/src/Generated/UserFactors/PushFactor.php b/src/Generated/UserFactors/PushFactor.php index b0d6500620..ea36d8866e 100644 --- a/src/Generated/UserFactors/PushFactor.php +++ b/src/Generated/UserFactors/PushFactor.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class PushFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; diff --git a/src/Generated/UserFactors/PushFactorProfile.php b/src/Generated/UserFactors/PushFactorProfile.php index 67b38b4b8e..51bcc6c8e8 100644 --- a/src/Generated/UserFactors/PushFactorProfile.php +++ b/src/Generated/UserFactors/PushFactorProfile.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class PushFactorProfile extends \Okta\UserFactors\FactorProfile { const NAME = 'name'; diff --git a/src/Generated/UserFactors/SecurityQuestion.php b/src/Generated/UserFactors/SecurityQuestion.php index 2f07415d76..203b3a3893 100644 --- a/src/Generated/UserFactors/SecurityQuestion.php +++ b/src/Generated/UserFactors/SecurityQuestion.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class SecurityQuestion extends \Okta\Resource\AbstractResource { const ANSWER = 'answer'; diff --git a/src/Generated/UserFactors/SecurityQuestionFactor.php b/src/Generated/UserFactors/SecurityQuestionFactor.php index 7c9018feeb..819926f1fb 100644 --- a/src/Generated/UserFactors/SecurityQuestionFactor.php +++ b/src/Generated/UserFactors/SecurityQuestionFactor.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class SecurityQuestionFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; diff --git a/src/Generated/UserFactors/SecurityQuestionFactorProfile.php b/src/Generated/UserFactors/SecurityQuestionFactorProfile.php index dc8a65f3a7..4dea3007fa 100644 --- a/src/Generated/UserFactors/SecurityQuestionFactorProfile.php +++ b/src/Generated/UserFactors/SecurityQuestionFactorProfile.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class SecurityQuestionFactorProfile extends \Okta\UserFactors\FactorProfile { const ANSWER = 'answer'; diff --git a/src/Generated/UserFactors/SmsFactor.php b/src/Generated/UserFactors/SmsFactor.php index f707de20ff..9d5cd06923 100644 --- a/src/Generated/UserFactors/SmsFactor.php +++ b/src/Generated/UserFactors/SmsFactor.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class SmsFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; diff --git a/src/Generated/UserFactors/SmsFactorProfile.php b/src/Generated/UserFactors/SmsFactorProfile.php index a1ec28d4cb..5385d24640 100644 --- a/src/Generated/UserFactors/SmsFactorProfile.php +++ b/src/Generated/UserFactors/SmsFactorProfile.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class SmsFactorProfile extends \Okta\UserFactors\FactorProfile { const PHONE_NUMBER = 'phoneNumber'; diff --git a/src/Generated/UserFactors/TokenFactor.php b/src/Generated/UserFactors/TokenFactor.php index 362fcac64b..6e648521f6 100644 --- a/src/Generated/UserFactors/TokenFactor.php +++ b/src/Generated/UserFactors/TokenFactor.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class TokenFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; diff --git a/src/Generated/UserFactors/TokenFactorProfile.php b/src/Generated/UserFactors/TokenFactorProfile.php index 20105d2f0f..ad89f3eaad 100644 --- a/src/Generated/UserFactors/TokenFactorProfile.php +++ b/src/Generated/UserFactors/TokenFactorProfile.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class TokenFactorProfile extends \Okta\UserFactors\FactorProfile { const CREDENTIAL_ID = 'credentialId'; diff --git a/src/Generated/UserFactors/TotpFactor.php b/src/Generated/UserFactors/TotpFactor.php index 8899ab648f..78b036f392 100644 --- a/src/Generated/UserFactors/TotpFactor.php +++ b/src/Generated/UserFactors/TotpFactor.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class TotpFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; diff --git a/src/Generated/UserFactors/TotpFactorProfile.php b/src/Generated/UserFactors/TotpFactorProfile.php index 2f1966536c..d5f7bc7f85 100644 --- a/src/Generated/UserFactors/TotpFactorProfile.php +++ b/src/Generated/UserFactors/TotpFactorProfile.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class TotpFactorProfile extends \Okta\UserFactors\FactorProfile { const CREDENTIAL_ID = 'credentialId'; diff --git a/src/Generated/UserFactors/VerifyFactorRequest.php b/src/Generated/UserFactors/VerifyFactorRequest.php index e1f434ce7b..49cecf1c47 100644 --- a/src/Generated/UserFactors/VerifyFactorRequest.php +++ b/src/Generated/UserFactors/VerifyFactorRequest.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class VerifyFactorRequest extends \Okta\Resource\AbstractResource { const ANSWER = 'answer'; diff --git a/src/Generated/UserFactors/VerifyFactorResponse.php b/src/Generated/UserFactors/VerifyFactorResponse.php index bc2464bc0f..b1a1935ed8 100644 --- a/src/Generated/UserFactors/VerifyFactorResponse.php +++ b/src/Generated/UserFactors/VerifyFactorResponse.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class VerifyFactorResponse extends \Okta\Resource\AbstractResource { const LINKS = '_links'; diff --git a/src/Generated/UserFactors/WebFactor.php b/src/Generated/UserFactors/WebFactor.php index 9e67513059..8e568e0ae0 100644 --- a/src/Generated/UserFactors/WebFactor.php +++ b/src/Generated/UserFactors/WebFactor.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class WebFactor extends \Okta\UserFactors\Factor { const PROFILE = 'profile'; diff --git a/src/Generated/UserFactors/WebFactorProfile.php b/src/Generated/UserFactors/WebFactorProfile.php index 6461aa30a2..77e5202c6b 100644 --- a/src/Generated/UserFactors/WebFactorProfile.php +++ b/src/Generated/UserFactors/WebFactorProfile.php @@ -17,7 +17,6 @@ namespace Okta\Generated\UserFactors; - class WebFactorProfile extends \Okta\UserFactors\FactorProfile { const CREDENTIAL_ID = 'credentialId'; diff --git a/src/Generated/Users/AppLink.php b/src/Generated/Users/AppLink.php index d2dfbbf32f..e92acdefa4 100644 --- a/src/Generated/Users/AppLink.php +++ b/src/Generated/Users/AppLink.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Users; - class AppLink extends \Okta\Resource\AbstractResource { const ID = 'id'; diff --git a/src/Generated/Users/AuthenticationProvider.php b/src/Generated/Users/AuthenticationProvider.php index 25bcc30c83..750b107648 100644 --- a/src/Generated/Users/AuthenticationProvider.php +++ b/src/Generated/Users/AuthenticationProvider.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Users; - class AuthenticationProvider extends \Okta\Resource\AbstractResource { const NAME = 'name'; diff --git a/src/Generated/Users/ChangePasswordRequest.php b/src/Generated/Users/ChangePasswordRequest.php index f50b36211b..3930087a17 100644 --- a/src/Generated/Users/ChangePasswordRequest.php +++ b/src/Generated/Users/ChangePasswordRequest.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Users; - class ChangePasswordRequest extends \Okta\Resource\AbstractResource { const NEW_PASSWORD = 'newPassword'; diff --git a/src/Generated/Users/ForgotPasswordResponse.php b/src/Generated/Users/ForgotPasswordResponse.php index 7e14a41172..373ec24185 100644 --- a/src/Generated/Users/ForgotPasswordResponse.php +++ b/src/Generated/Users/ForgotPasswordResponse.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Users; - class ForgotPasswordResponse extends \Okta\Resource\AbstractResource { const RESET_PASSWORD_URL = 'resetPasswordUrl'; diff --git a/src/Generated/Users/PasswordCredential.php b/src/Generated/Users/PasswordCredential.php index c878990bc9..9bc3a00f7b 100644 --- a/src/Generated/Users/PasswordCredential.php +++ b/src/Generated/Users/PasswordCredential.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Users; - class PasswordCredential extends \Okta\Resource\AbstractResource { const VALUE = 'value'; diff --git a/src/Generated/Users/RecoveryQuestionCredential.php b/src/Generated/Users/RecoveryQuestionCredential.php index dcbb584cf9..ac26b4a05d 100644 --- a/src/Generated/Users/RecoveryQuestionCredential.php +++ b/src/Generated/Users/RecoveryQuestionCredential.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Users; - class RecoveryQuestionCredential extends \Okta\Resource\AbstractResource { const ANSWER = 'answer'; diff --git a/src/Generated/Users/ResetPasswordToken.php b/src/Generated/Users/ResetPasswordToken.php index 95217e7be4..c8ea3bec3f 100644 --- a/src/Generated/Users/ResetPasswordToken.php +++ b/src/Generated/Users/ResetPasswordToken.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Users; - class ResetPasswordToken extends \Okta\Resource\AbstractResource { const RESET_PASSWORD_URL = 'resetPasswordUrl'; diff --git a/src/Generated/Users/Role.php b/src/Generated/Users/Role.php index 9dc6151cef..eb46830b93 100644 --- a/src/Generated/Users/Role.php +++ b/src/Generated/Users/Role.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Users; - class Role extends \Okta\Resource\AbstractResource { const ID = 'id'; diff --git a/src/Generated/Users/TempPassword.php b/src/Generated/Users/TempPassword.php index 663641acf8..ccf12ed41d 100644 --- a/src/Generated/Users/TempPassword.php +++ b/src/Generated/Users/TempPassword.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Users; - class TempPassword extends \Okta\Resource\AbstractResource { const TEMP_PASSWORD = 'tempPassword'; diff --git a/src/Generated/Users/User.php b/src/Generated/Users/User.php index 9cd546b645..181fb04b4f 100644 --- a/src/Generated/Users/User.php +++ b/src/Generated/Users/User.php @@ -59,15 +59,15 @@ public function get($query) "/users" ); } - public function save() + public function save() { return \Okta\Client::getInstance() - ->getDataStore() - ->saveResource( - "/users", - $this, - \Okta\Users\User::class - ); + ->getDataStore() + ->saveResource( + "/users", + $this, + \Okta\Users\User::class + ); } public function delete() { @@ -415,7 +415,7 @@ public function getGroupTargetsForRole($roleId, array $options = []): \Okta\Grou /** - * + * * * * @return mixed|null @@ -435,7 +435,7 @@ public function removeGroupTargetFromRole($roleId, $groupId) /** - * + * * * * @return mixed|null diff --git a/src/Generated/Users/UserActivationToken.php b/src/Generated/Users/UserActivationToken.php index 098b7a1c52..5779f34763 100644 --- a/src/Generated/Users/UserActivationToken.php +++ b/src/Generated/Users/UserActivationToken.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Users; - class UserActivationToken extends \Okta\Resource\AbstractResource { const ACTIVATION_URL = 'activationUrl'; diff --git a/src/Generated/Users/UserCredentials.php b/src/Generated/Users/UserCredentials.php index bb7af020d8..ba91df803d 100644 --- a/src/Generated/Users/UserCredentials.php +++ b/src/Generated/Users/UserCredentials.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Users; - class UserCredentials extends \Okta\Resource\AbstractResource { const PASSWORD = 'password'; diff --git a/src/Generated/Users/UserProfile.php b/src/Generated/Users/UserProfile.php index 7eb577d104..2c99b24e73 100644 --- a/src/Generated/Users/UserProfile.php +++ b/src/Generated/Users/UserProfile.php @@ -17,7 +17,6 @@ namespace Okta\Generated\Users; - class UserProfile extends \Okta\Resource\AbstractResource { const EMAIL = 'email'; diff --git a/src/Sessions/AuthenticationMethod.php b/src/Sessions/AuthenticationMethod.php index 73c3d6a354..e9d4facfc3 100644 --- a/src/Sessions/AuthenticationMethod.php +++ b/src/Sessions/AuthenticationMethod.php @@ -20,4 +20,4 @@ class AuthenticationMethod extends \Okta\Generated\Sessions\AuthenticationMethod { -} \ No newline at end of file +} diff --git a/src/Sessions/CreateSessionRequest.php b/src/Sessions/CreateSessionRequest.php index b01e5d03e8..c02972c721 100644 --- a/src/Sessions/CreateSessionRequest.php +++ b/src/Sessions/CreateSessionRequest.php @@ -20,4 +20,4 @@ class CreateSessionRequest extends \Okta\Generated\Sessions\CreateSessionRequest { -} \ No newline at end of file +} diff --git a/src/Sessions/Session.php b/src/Sessions/Session.php index 94dba25bb6..e4bb1451f0 100644 --- a/src/Sessions/Session.php +++ b/src/Sessions/Session.php @@ -20,4 +20,4 @@ class Session extends \Okta\Generated\Sessions\Session { -} \ No newline at end of file +} diff --git a/src/Sessions/SessionIdentityProvider.php b/src/Sessions/SessionIdentityProvider.php index 9c41ce4c25..fa5df02915 100644 --- a/src/Sessions/SessionIdentityProvider.php +++ b/src/Sessions/SessionIdentityProvider.php @@ -20,4 +20,4 @@ class SessionIdentityProvider extends \Okta\Generated\Sessions\SessionIdentityProvider { -} \ No newline at end of file +} diff --git a/src/Sessions/SessionIdentityProviderType.php b/src/Sessions/SessionIdentityProviderType.php index f402b8fe4b..cd7005303e 100644 --- a/src/Sessions/SessionIdentityProviderType.php +++ b/src/Sessions/SessionIdentityProviderType.php @@ -20,4 +20,4 @@ class SessionIdentityProviderType extends \Okta\Generated\Sessions\SessionIdentityProviderType { -} \ No newline at end of file +} diff --git a/src/Sessions/SessionStatus.php b/src/Sessions/SessionStatus.php index 43b79a31f1..9eb6a7d39e 100644 --- a/src/Sessions/SessionStatus.php +++ b/src/Sessions/SessionStatus.php @@ -20,4 +20,4 @@ class SessionStatus extends \Okta\Generated\Sessions\SessionStatus { -} \ No newline at end of file +} From 02e01913d5f5ee8ce0580cf50e2ed575273b0935 Mon Sep 17 00:00:00 2001 From: Brian Retterer Date: Wed, 6 Dec 2017 12:24:52 -0500 Subject: [PATCH 22/22] Bump version to 0.2.0 --- src/Okta.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Okta.php b/src/Okta.php index 47f1dcf04c..3d990bdfe9 100644 --- a/src/Okta.php +++ b/src/Okta.php @@ -26,7 +26,7 @@ class Okta { - const VERSION = '0.1.0'; + const VERSION = '0.2.0'; public function __construct(Client $client = null, DefaultDataStore $dataStore = null) {