Skip to content

PHP client for ORY Hydra. Requires a compatible Oauth2 client to make connections.

Notifications You must be signed in to change notification settings

tulipretail/hydra-php-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hydra-php-sdk

Please refer to the user guide for in-depth documentation: https://ory.gitbooks.io/hydra/content/ Hydra offers OAuth 2.0 and OpenID Connect Core 1.0 capabilities as a service. Hydra is different, because it works with any existing authentication infrastructure, not just LDAP or SAML. By implementing a consent app (works with any programming language) you build a bridge between Hydra and your authentication infrastructure. Hydra is able to securely manage JSON Web Keys, and has a sophisticated policy-based access control you can use if you want to. Hydra is suitable for green- (new) and brownfield (existing) projects. If you are not familiar with OAuth 2.0 and are working on a greenfield project, we recommend evaluating if OAuth 2.0 really serves your purpose. Knowledge of OAuth 2.0 is imperative in understanding what Hydra does and how it works. The official repository is located at https://github.com/ory/hydra ### Important REST API Documentation Notes The swagger generator used to create this documentation does currently not support example responses. To see request and response payloads click on "Show JSON schema": Enable JSON Schema on Apiary The API documentation always refers to the latest tagged version of ORY Hydra. For previous API documentations, please refer to https://github.com/ory/hydra/blob//docs/api.swagger.yaml - for example: 0.9.13: https://github.com/ory/hydra/blob/v0.9.13/docs/api.swagger.yaml 0.8.1: https://github.com/ory/hydra/blob/v0.8.1/docs/api.swagger.yaml

This PHP package is automatically generated by the Swagger Codegen project:

  • API version: Latest
  • Build package: io.swagger.codegen.languages.PhpClientCodegen For more information, please visit https://www.ory.am

Requirements

PHP 5.4.0 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/tulip/hydra-php-sdk.git"
    }
  ],
  "require": {
    "tulip/hydra-php-sdk": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/hydra-php-sdk/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
Hydra\SDK\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Hydra\SDK\Api\HealthApi();

try {
    $api_instance->getInstanceMetrics();
} catch (Exception $e) {
    echo 'Exception when calling HealthApi->getInstanceMetrics: ', $e->getMessage(), PHP_EOL;
}

?>

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
HealthApi getInstanceMetrics GET /health/metrics Show instance metrics (experimental)
HealthApi getInstanceStatus GET /health/status Check health status of this instance
JsonWebKeyApi createJsonWebKeySet POST /keys/{set} Generate a new JSON Web Key
JsonWebKeyApi deleteJsonWebKey DELETE /keys/{set}/{kid} Delete a JSON Web Key
JsonWebKeyApi deleteJsonWebKeySet DELETE /keys/{set} Delete a JSON Web Key
JsonWebKeyApi getJsonWebKey GET /keys/{set}/{kid} Retrieve a JSON Web Key
JsonWebKeyApi getJsonWebKeySet GET /keys/{set} Retrieve a JSON Web Key Set
JsonWebKeyApi updateJsonWebKey PUT /keys/{set}/{kid} Update a JSON Web Key
JsonWebKeyApi updateJsonWebKeySet PUT /keys/{set} Update a JSON Web Key Set
OAuth2Api acceptOAuth2ConsentRequest PATCH /oauth2/consent/requests/{id}/accept Accept a consent request
OAuth2Api createOAuth2Client POST /clients Create an OAuth 2.0 client
OAuth2Api deleteOAuth2Client DELETE /clients/{id} Deletes an OAuth 2.0 Client
OAuth2Api getOAuth2Client GET /clients/{id} Retrieve an OAuth 2.0 Client.
OAuth2Api getOAuth2ConsentRequest GET /oauth2/consent/requests/{id} Receive consent request information
OAuth2Api getWellKnown GET /.well-known/openid-configuration Server well known configuration
OAuth2Api introspectOAuth2Token POST /oauth2/introspect Introspect OAuth2 tokens
OAuth2Api listOAuth2Clients GET /clients List OAuth 2.0 Clients
OAuth2Api oauthAuth GET /oauth2/auth The OAuth 2.0 authorize endpoint
OAuth2Api oauthToken POST /oauth2/token The OAuth 2.0 token endpoint
OAuth2Api rejectOAuth2ConsentRequest PATCH /oauth2/consent/requests/{id}/reject Reject a consent request
OAuth2Api revokeOAuth2Token POST /oauth2/revoke Revoke OAuth2 tokens
OAuth2Api updateOAuth2Client PUT /clients/{id} Update an OAuth 2.0 Client
OAuth2Api userinfo POST /userinfo OpenID Connect Userinfo
OAuth2Api wellKnown GET /.well-known/jwks.json Get list of well known JSON Web Keys
PolicyApi createPolicy POST /policies Create an Access Control Policy
PolicyApi deletePolicy DELETE /policies/{id} Delete an Access Control Policy
PolicyApi getPolicy GET /policies/{id} Get an Access Control Policy
PolicyApi listPolicies GET /policies List Access Control Policies
PolicyApi updatePolicy PUT /policies/{id} Update an Access Control Polic
WardenApi addMembersToGroup POST /warden/groups/{id}/members Add members to a group
WardenApi createGroup POST /warden/groups Create a group
WardenApi deleteGroup DELETE /warden/groups/{id} Delete a group by id
WardenApi doesWardenAllowAccessRequest POST /warden/allowed Check if an access request is valid (without providing an access token)
WardenApi doesWardenAllowTokenAccessRequest POST /warden/token/allowed Check if an access request is valid (providing an access token)
WardenApi findGroupsByMember GET /warden/groups Find groups by member
WardenApi getGroup GET /warden/groups/{id} Get a group by id
WardenApi removeMembersFromGroup DELETE /warden/groups/{id}/members Remove members from a group

Documentation For Models

Documentation For Authorization

basic

  • Type: HTTP basic authentication

oauth2

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: https://your-hydra-instance.com/oauth2/auth
  • Scopes:
  • hydra.clients: A scope required to manage OAuth 2.0 Clients
  • hydra.consent: A scope required to fetch and modify consent requests
  • hydra.health: A scope required to get health information
  • hydra.keys.create: A scope required to create JSON Web Keys
  • hydra.keys.delete: A scope required to delete JSON Web Keys
  • hydra.keys.get: A scope required to fetch JSON Web Keys
  • hydra.keys.update: A scope required to get JSON Web Keys
  • hydra.policies: A scope required to manage access control policies
  • hydra.warden: A scope required to make access control inquiries
  • hydra.warden.groups: A scope required to manage warden groups
  • offline: A scope required when requesting refresh tokens
  • openid: Request an OpenID Connect ID Token

Author

hi@ory.am

About

PHP client for ORY Hydra. Requires a compatible Oauth2 client to make connections.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published