-
Notifications
You must be signed in to change notification settings - Fork 1
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
Steeven Andrian
committed
May 23, 2020
1 parent
7ef5629
commit a9b02e5
Showing
11 changed files
with
2,114 additions
and
2,114 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
|
||
.DS_Store | ||
|
||
.DS_Store |
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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
MIT License | ||
Copyright (c) 2016 Steeve Andrian Salim | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
MIT License | ||
|
||
Copyright (c) 2016 Steeve Andrian Salim | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 |
---|---|---|
@@ -1,46 +1,46 @@ | ||
{ | ||
"name": "o2system/security", | ||
"description": "O2System Security", | ||
"type": "package", | ||
"keywords": [ | ||
"utilities", | ||
"php", | ||
"framework", | ||
"libraries", | ||
"interfaces" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Steeven Andrian Salim", | ||
"email": "steevenz@steevenz.com", | ||
"homepage": "http://www.steevenz.com", | ||
"role": "Founder and Lead Project" | ||
}, | ||
{ | ||
"name": "Teguh Rianto", | ||
"email": "teguh.rianto22@gmail.com", | ||
"homepage": "http://teguhrianto22.pusku.com", | ||
"role": "Template Designer" | ||
} | ||
], | ||
"support": { | ||
"email": "o2system.framework@gmail.com", | ||
"issues": "https://github.com/o2system/psr/issues", | ||
"forum": "https://www.facebook.com/groups/498147006994512" | ||
}, | ||
"links": { | ||
"info": "http://www.o2system.id/libraries/psr.html", | ||
"documentation": "http://www.o2system.id/libraries/psr/documentation.html", | ||
"github-wiki": "http://github.com/o2system/psr/wiki" | ||
}, | ||
"require": { | ||
"php": "^7.2.0", | ||
"ext-openssl": "*", | ||
"o2system/session": "*" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"O2System\\Security\\": "src" | ||
} | ||
} | ||
} | ||
{ | ||
"name": "o2system/security", | ||
"description": "O2System Security", | ||
"type": "package", | ||
"keywords": [ | ||
"utilities", | ||
"php", | ||
"framework", | ||
"libraries", | ||
"interfaces" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Steeven Andrian Salim", | ||
"email": "steevenz@steevenz.com", | ||
"homepage": "http://www.steevenz.com", | ||
"role": "Founder and Lead Project" | ||
}, | ||
{ | ||
"name": "Teguh Rianto", | ||
"email": "teguh.rianto22@gmail.com", | ||
"homepage": "http://teguhrianto22.pusku.com", | ||
"role": "Template Designer" | ||
} | ||
], | ||
"support": { | ||
"email": "o2system.framework@gmail.com", | ||
"issues": "https://github.com/o2system/psr/issues", | ||
"forum": "https://www.facebook.com/groups/498147006994512" | ||
}, | ||
"links": { | ||
"info": "http://www.o2system.id/libraries/psr.html", | ||
"documentation": "http://www.o2system.id/libraries/psr/documentation.html", | ||
"github-wiki": "http://github.com/o2system/psr/wiki" | ||
}, | ||
"require": { | ||
"php": "^7.2.0", | ||
"ext-openssl": "*", | ||
"o2system/session": "*" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"O2System\\Security\\": "src" | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,49 +1,49 @@ | ||
<?php | ||
/** | ||
* This file is part of the O2System Framework package. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Steeve Andrian Salim | ||
* @copyright Copyright (c) Steeve Andrian Salim | ||
*/ | ||
|
||
// ------------------------------------------------------------------------ | ||
|
||
namespace O2System\Security\Authentication; | ||
|
||
// ------------------------------------------------------------------------ | ||
|
||
/** | ||
* Class WebToken | ||
* | ||
* @package O2System\Security\Authentication | ||
*/ | ||
class WebToken | ||
{ | ||
/** | ||
* WebToken::verify | ||
* | ||
* Checks if the posted X-WEB-TOKEN protection token is valid. | ||
* | ||
* @param string $token X-WEB-TOKEN protection token. | ||
* @param \Closure $callback Callback verification process. | ||
* | ||
* @return bool | ||
*/ | ||
public function verify($token = null, \Closure $callback) | ||
{ | ||
$token = isset($token) | ||
? $token | ||
: input()->server('HTTP_X_WEB_TOKEN'); | ||
|
||
if (is_null($token)) { | ||
return false; | ||
} elseif (is_callable($callback)) { | ||
return call_user_func($callback, $token); | ||
} | ||
|
||
return false; | ||
} | ||
<?php | ||
/** | ||
* This file is part of the O2System Framework package. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Steeve Andrian Salim | ||
* @copyright Copyright (c) Steeve Andrian Salim | ||
*/ | ||
|
||
// ------------------------------------------------------------------------ | ||
|
||
namespace O2System\Security\Authentication; | ||
|
||
// ------------------------------------------------------------------------ | ||
|
||
/** | ||
* Class WebToken | ||
* | ||
* @package O2System\Security\Authentication | ||
*/ | ||
class WebToken | ||
{ | ||
/** | ||
* WebToken::verify | ||
* | ||
* Checks if the posted X-WEB-TOKEN protection token is valid. | ||
* | ||
* @param string $token X-WEB-TOKEN protection token. | ||
* @param \Closure $callback Callback verification process. | ||
* | ||
* @return bool | ||
*/ | ||
public function verify($token = null, \Closure $callback) | ||
{ | ||
$token = isset($token) | ||
? $token | ||
: input()->server('HTTP_X_WEB_TOKEN'); | ||
|
||
if (is_null($token)) { | ||
return false; | ||
} elseif (is_callable($callback)) { | ||
return call_user_func($callback, $token); | ||
} | ||
|
||
return false; | ||
} | ||
} |
Oops, something went wrong.