Download the PHP package wakeonweb/kong-oauth2-server-bundle without Composer

On this page you can find all versions of the php package wakeonweb/kong-oauth2-server-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package kong-oauth2-server-bundle

WakeOnWebKongOAuth2ServerBundle

Note: The bundle handle the technical communication with Kong and provide an authorization page. The other security stuffs should be managed by the application (form login, reset password, etc.).

Configuration

/.env

KONG_ADMIN_URL=http://localhost:8001
KONG_API_URL=https://localhost:8443
KONG_PROVISION_KEY=34cbcb435c02b87c9cd9d68ac6c86e2c

_/config/packages/wakeonweb_kong_oauth2server.yaml

wakeonweb_kong_oauth2_server:
    kong:
        admin_url: '%env(KONG_ADMIN_URL)%'
        api_url: '%env(KONG_API_URL)%'
        provision_key: '%env(KONG_PROVISION_KEY)%'
    cancel_path: /logout

_/config/routes/wakeonweb_kong_oauth2server.yaml

wakeonweb_kong_oauth2_server.authenticate:
    path: /authenticate
    controller: WakeOnWeb\Bundle\KongOAuth2ServerBundle\Controller\AuthenticateController

wakeonweb_kong_oauth2_server.login:
    path: /api/login
    controller: WakeOnWeb\Bundle\KongOAuth2ServerBundle\Controller\LoginController

/config/packages/security.yaml

security:
    # ...

    firewalls:
        anonymous: true
        api:
            pattern: ^/api/login$
            anonymous: ~
            json_login:
                check_path: /api/login
        main:
            form_login:
                login_path: /login
                check_path: /login

    access_control:
        - { path: /api/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: /login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: /, roles: IS_AUTHENTICATED_FULLY }

OAuth2

The OAuth2 specification describe 4 grant types:

3 of them are supported out of the box. The "Client Credentials Grant" is way to specific at the moment and will be implemented later.

Authorization Code Grant

The "Authorization Code Grant" workflow is handled by the WakeOnWeb\Bundle\KongOAuth2ServerBundle\Controller\AuthenticateController. Just be sure to add a routing to this controller in order to handle it.

_/config/routes/wakeonweb_kong_oauth2server.yaml

wakeonweb_kong_oauth2_server.authenticate:
    path: /authenticate
    controller: WakeOnWeb\Bundle\KongOAuth2ServerBundle\Controller\AuthenticateController

The client application will have to route the end user to the following url: http://sso.com/authorize?client_id=<id>&response_type=code. Kong & the bundle will do the rest.

Implicit Grant

The "Implicit Grant" workflow is handled by the WakeOnWeb\Bundle\KongOAuth2ServerBundle\Controller\AuthenticateController. Just be sure to add a routing to this controller in order to handle it.

_/config/routes/wakeonweb_kong_oauth2server.yaml

wakeonweb_kong_oauth2_server.authenticate:
    path: /authenticate
    controller: WakeOnWeb\Bundle\KongOAuth2ServerBundle\Controller\AuthenticateController

The client application will have to route the end user to the following url: http://sso.com/authorize?client_id=<id>&response_type=token. Kong & the bundle will do the rest.

Resource Owner Password Credentials Grant

The "Resource Owner Password Credentials Grant" workflow is handled by the WakeOnWeb\Bundle\KongOAuth2ServerBundle\Controller\LoginController. Just be sure to add a routing to this controller in order and a security firewall to handle it.

_/config/routes/wakeonweb_kong_oauth2server.yaml

wakeonweb_kong_oauth2_server.login:
    path: /api/login
    controller: WakeOnWeb\Bundle\KongOAuth2ServerBundle\Controller\LoginController

/config/packages/security.yaml

security:
    # ...

    firewalls:
        anonymous: true
        api:
            pattern: ^/api/login$
            anonymous: ~
            json_login:
                check_path: /api/login

    access_control:
        - { path: /api/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: /, roles: IS_AUTHENTICATED_FULLY }

Client Credentials Grant

not supported yet

IdentityResolver

The user identity can be resolved from the UserInterface using an IdentityResolver. A "username as identity" strategy is used per default. This means that the UserInterface::getUsername() result will be used as the user id. You can change this behavior by implementing your own IdentityResolver.

src/User/IdentityAsIs.php

<?php

namespace App\User;

use WakeOnWeb\Bundle\KongOAuth2ServerBundle\User\IdentityResolver;
use Symfony\Component\Security\Core\User\UserInterface;

class IdentityAsIs implements IdentityResolver
{
    public function resolveIdentity(UserInterface $user): string
    {
        return $user->getId();
    }
}

_/config/packages/wakeonweb_kong_oauth2server.yaml

wakeonweb_kong_oauth2_server:
    # ...
    identity_resolver: App\User\IdentityAsIs

All versions of kong-oauth2-server-bundle with dependencies

PHP Build Version
Package Version
Requires guzzlehttp/guzzle Version ~6.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wakeonweb/kong-oauth2-server-bundle contains the following files

Loading the files please wait ....