This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
2,476 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
<?php | ||
/** | ||
* Copyright 2016 Stormpath, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
namespace Stormpath\Mfa; | ||
|
||
use Stormpath\Client; | ||
use Stormpath\Resource\Account; | ||
use Stormpath\Resource\Deletable; | ||
use Stormpath\Resource\InstanceResource; | ||
use Stormpath\Stormpath; | ||
|
||
abstract class Challenge extends InstanceResource implements Deletable | ||
{ | ||
const CODE = "code"; | ||
const FACTOR = "factor"; | ||
const STATUS = "status"; | ||
const ACCOUNT = "account"; | ||
const MESSAGE = "message"; | ||
const CREATED_AT = "createdAt"; | ||
const MODIFIED_AT = "modifiedAt"; | ||
|
||
const PATH = "challenges"; | ||
|
||
|
||
public abstract function validate($code); | ||
|
||
/** | ||
* Gets the createdAt property. | ||
* | ||
* @return string | ||
*/ | ||
public function getCreatedAt() | ||
{ | ||
return $this->getProperty(self::CREATED_AT); | ||
} | ||
|
||
/** | ||
* Gets the modifiedAt property. | ||
* | ||
* @return string | ||
*/ | ||
public function getModifiedAt() | ||
{ | ||
return $this->getProperty(self::MODIFIED_AT); | ||
} | ||
|
||
/** | ||
* Gets the status property. | ||
* | ||
* @return string | ||
*/ | ||
public function getStatus() | ||
{ | ||
return $this->getProperty(self::STATUS); | ||
} | ||
|
||
/** | ||
* Gets the factor resource property. | ||
* | ||
* @param array $options array of options. | ||
* @return Factor | ||
*/ | ||
public function getFactor(array $options = []) | ||
{ | ||
return $this->getResourceProperty(self::FACTOR, Stormpath::FACTOR, $options); | ||
} | ||
|
||
/** | ||
* Sets the factor resource property. | ||
* | ||
* @param Factor $factor The factor of the object. | ||
* @return self | ||
*/ | ||
public function setFactor(Factor $factor) | ||
{ | ||
$this->setResourceProperty(self::FACTOR, $factor); | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Gets the account resource property. | ||
* | ||
* @param array $options array of options. | ||
* @return Account | ||
*/ | ||
public function getAccount(array $options = []) | ||
{ | ||
return $this->getResourceProperty(self::ACCOUNT, Stormpath::ACCOUNT, $options); | ||
} | ||
|
||
/** | ||
* Sets the account resource property. | ||
* | ||
* @param Account $account The account of the object. | ||
* @return self | ||
*/ | ||
public function setAccount(Account $account) | ||
{ | ||
$this->setResourceProperty(self::ACCOUNT, $account); | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Sets the code property. | ||
* | ||
* @param string $code The code of the object. | ||
* @return self | ||
*/ | ||
public function setCode($code) | ||
{ | ||
$this->setProperty(self::CODE, $code); | ||
|
||
return $this; | ||
} | ||
|
||
|
||
/** | ||
* Delete the challenge. | ||
* | ||
* @return string | ||
*/ | ||
public function delete() | ||
{ | ||
return $this->getDataStore()->delete($this); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* Copyright 2016 Stormpath, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
namespace Stormpath\Mfa; | ||
|
||
use Stormpath\Resource\AbstractCollectionResource; | ||
use Stormpath\Stormpath; | ||
|
||
class ChallengeList extends AbstractCollectionResource { | ||
|
||
|
||
/** | ||
* Returns the class name for the Challenge. | ||
* | ||
* @return string | ||
*/ | ||
function getItemClassName() | ||
{ | ||
return Stormpath::CHALLENGE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
<?php | ||
/** | ||
* Copyright 2016 Stormpath, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
namespace Stormpath\Mfa; | ||
|
||
use Stormpath\Resource\Account; | ||
use Stormpath\Resource\Deletable; | ||
use Stormpath\Resource\InstanceResource; | ||
use Stormpath\Stormpath; | ||
|
||
abstract class Factor extends InstanceResource implements Deletable | ||
{ | ||
const PATH = 'factors'; | ||
|
||
const TYPE = 'type'; | ||
const CREATED_AT = 'createdAt'; | ||
const MODIFIED_AT = 'modifiedAt'; | ||
const STATUS = 'status'; | ||
const VERIFICATION_STATUS = 'verificationStatus'; | ||
const ACCOUNT = 'account'; | ||
const CHALLENGES = 'challenges'; | ||
const MOST_RECENT_CHALLENGE = "mostRecentChallenge"; | ||
|
||
/** | ||
* Gets the type property. | ||
* | ||
* @return string | ||
*/ | ||
public function getType() | ||
{ | ||
return $this->getProperty(self::TYPE); | ||
} | ||
|
||
/** | ||
* Sets the type property. | ||
* | ||
* @param string $type The type of the object. | ||
* @return self | ||
*/ | ||
protected function setType($type) | ||
{ | ||
$this->setProperty(self::TYPE, $type); | ||
|
||
return $this; | ||
} | ||
|
||
|
||
|
||
/** | ||
* Gets the createdAt property. | ||
* | ||
* @return string | ||
*/ | ||
public function getCreatedAt() | ||
{ | ||
return $this->getProperty(self::CREATED_AT); | ||
} | ||
|
||
/** | ||
* Gets the modifiedAt property. | ||
* | ||
* @return string | ||
*/ | ||
public function getModifiedAt() | ||
{ | ||
return $this->getProperty(self::MODIFIED_AT); | ||
} | ||
|
||
/** | ||
* Gets the status property. | ||
* | ||
* @return string | ||
*/ | ||
public function getStatus() | ||
{ | ||
return $this->getProperty(self::STATUS); | ||
} | ||
|
||
/** | ||
* Sets the status property. | ||
* | ||
* @param string $status The status of the object. | ||
* @return self | ||
*/ | ||
public function setStatus($status) | ||
{ | ||
$this->setProperty(self::STATUS, $status); | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Gets the verificationStatus property. | ||
* | ||
* @return string | ||
*/ | ||
public function getVerificationStatus() | ||
{ | ||
return $this->getProperty(self::VERIFICATION_STATUS); | ||
} | ||
|
||
/** | ||
* Gets the account resource property. | ||
* | ||
* @param array $options array of options. | ||
* @return Account | ||
*/ | ||
public function getAccount(array $options = []) | ||
{ | ||
return $this->getResourceProperty(self::ACCOUNT, Stormpath::ACCOUNT, $options); | ||
} | ||
|
||
/** | ||
* Gets the challenges resource property. | ||
* | ||
* @param array $options array of options. | ||
* @return ChallengeList | ||
*/ | ||
public function getChallenges(array $options = []) | ||
{ | ||
return $this->getResourceProperty(self::CHALLENGES, Stormpath::CHALLENGES, $options); | ||
} | ||
|
||
/** | ||
* Gets the mostRecentChallenge resource property. | ||
* | ||
* @param array $options array of options. | ||
* @return Challenge | ||
*/ | ||
public abstract function getMostRecentChallenge(array $options = []); | ||
|
||
|
||
public function delete() | ||
{ | ||
return $this->getDataStore()->delete($this); | ||
} | ||
|
||
|
||
|
||
} |
Oops, something went wrong.