-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from akondas/knox-token
Implement Knox Token utility to sign access tokens
- Loading branch information
Showing
11 changed files
with
3,201 additions
and
0 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 +1,2 @@ | ||
/vendor/ | ||
.phpunit.result.cache |
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,33 @@ | ||
<?php | ||
|
||
return PhpCsFixer\Config::create() | ||
->setRules([ | ||
'@PSR2' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'binary_operator_spaces' => ['align_double_arrow' => false, 'align_equals' => false], | ||
'blank_line_after_opening_tag' => true, | ||
'blank_line_before_return' => true, | ||
'cast_spaces' => true, | ||
'concat_space' => ['spacing' => 'none'], | ||
'declare_strict_types' => true, | ||
'method_separation' => true, | ||
'no_blank_lines_after_class_opening' => true, | ||
'no_spaces_around_offset' => ['positions' => ['inside', 'outside']], | ||
'no_unneeded_control_parentheses' => true, | ||
'no_unused_imports' => true, | ||
'phpdoc_align' => true, | ||
'phpdoc_no_access' => true, | ||
'phpdoc_separation' => true, | ||
'pre_increment' => true, | ||
'single_quote' => true, | ||
'trim_array_spaces' => true, | ||
'single_blank_line_before_namespace' => true | ||
]) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->in(__DIR__ . '/src') | ||
->in(__DIR__ . '/tests') | ||
) | ||
->setRiskyAllowed(true) | ||
->setUsingCache(false) | ||
; |
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,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2019 Proget Sp. z o.o. | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Knox Token | ||
|
||
Support library for signing Samsung Knox API access tokens | ||
|
||
## Install | ||
|
||
``` | ||
composer require proget-hq/knox-token | ||
``` | ||
|
||
## Usage | ||
|
||
More info at [Knox Cloud API Integration Guide](https://docs.samsungknox.com/cloud-authentication/api-reference/Default.htm#section/Generate-your-access-token) | ||
|
||
### Sign your Client Identifier | ||
|
||
```php | ||
use Proget\KnoxToken; | ||
|
||
$clientIdentifierJwt = KnoxToken::signClientIdentifier('your-client-identifier', 'keys.json'); | ||
``` | ||
|
||
### Sign your Access Token | ||
|
||
```php | ||
use Proget\KnoxToken; | ||
|
||
$accessTokenJwt = KnoxToken::signAccessToken('access-token', 'keys.json'); | ||
``` | ||
|
||
## License | ||
|
||
MIT |
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 @@ | ||
{ | ||
"name": "proget-hq/knox-token", | ||
"description": "Support library for signing Samsung Knox API access tokens", | ||
"type": "library", | ||
"require": { | ||
"ext-json": "*", | ||
"firebase/php-jwt": "^5.0", | ||
"ramsey/uuid": "^3.8" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^8.2", | ||
"friendsofphp/php-cs-fixer": "^2.15" | ||
}, | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Arkadiusz Kondas", | ||
"email": "arkadiusz.kondas@gmail.com" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Proget\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Proget\\Tests\\": "tests/" | ||
} | ||
}, | ||
"scripts": { | ||
"check-cs": "php-cs-fixer fix --dry-run", | ||
"fix-cs": "php-cs-fixer fix", | ||
"test": "phpunit" | ||
} | ||
} |
Oops, something went wrong.