Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Types and improvements #62

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/vendor/
.vscode
.idea/

.phpunit.result.cache
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM php:7.2-cli-stretch

COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer

RUN apt-get update
RUN apt-get install -y zip git

RUN pecl install xdebug-2.9.8 && docker-php-ext-enable xdebug

COPY . /app
WORKDIR /app

RUN composer install

18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ To validate a JWT, you will need a few different items:
require_once("/vendor/autoload.php"); // This should be replaced with your path to your vendor/autoload.php file

$jwtVerifier = (new \Okta\JwtVerifier\JwtVerifierBuilder())
->setDiscovery(new \Okta\JwtVerifier\Discovery\Oauth) // This is not needed if using oauth. The other option is `new \Okta\JwtVerifier\Discovery\OIDC`
->setAdaptor(new \Okta\JwtVerifier\Adaptors\FirebasePhpJwt)
->setDiscovery(new \Okta\JwtVerifier\Server\Discovery\Oauth) // This is not needed if using oauth. The other option is `new \Okta\JwtVerifier\Server\Discovery\OIDC`
->setAdaptor(new \Okta\JwtVerifier\Adaptor\FirebasePhpJwt)
->setAudience('api://default')
->setClientId('{clientId}')
->setIssuer('https://{yourOktaDomain}.com/oauth2/default')
Expand Down Expand Up @@ -87,8 +87,6 @@ The result from the verify method is a `Jwt` object which has a few helper metho
```php
dump($jwt); //Returns instance of \Okta\JwtVerifier\JWT

dump($jwt->toJson()); // Returns Claims as JSON Object

dump($jwt->getClaims()); // Returns Claims as they come from the JWT Package used

dump($jwt->getIssuedAt()); // returns Carbon instance of issued at time
Expand All @@ -111,8 +109,18 @@ If you run into problems using the SDK, you can
The above are the basic steps for verifying an access token locally. The steps are not tied directly to a framework so
you could plug in the `okta/okta-jwt` into the framework of your choice.

## Development

The repository contains a `Dockerfile` you can use to run the test suite locally:

```bash
# build the docker
docker build -t okta-jwt-verifier .
# run the tests
docker run --rm --volume "$PWD":/app okta-jwt-verifier vendor/bin/phpunit
```

[devforum]: https://devforum.okta.com/
[lang-landing]: https://developer.okta.com/code/php/
[github-issues]: /okta/okta-jwt-verifier-php/issues
[github-releases]: /okta/okta-jwt-verifier-php/releases
[github-releases]: /okta/okta-jwt-verifier-php/releases
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@
"Okta\\JwtVerifier\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Test\\": "tests/"
}
},
"require": {
"php": "^7.2",
"ext-json": "*",
"nesbot/carbon": "^2.0",
"psr/http-message": "^1.0",
"php-http/client-common": "^2.3",
Expand All @@ -26,7 +32,7 @@
"bretterer/iso_duration_converter": "^0.1.0"
},
"require-dev": {
"phpunit/phpunit": "^7.0 ",
"phpunit/phpunit": "^8.0 ",
"symfony/var-dumper": "^5.1",
"squizlabs/php_codesniffer": "^3.5",
"php-http/mock-client": "^1.4",
Expand Down
Loading