Skip to content

Commit

Permalink
core: Formats and resolves missing test
Browse files Browse the repository at this point in the history
  • Loading branch information
arekkas committed Apr 19, 2018
1 parent 4f72a48 commit 3db984d
Show file tree
Hide file tree
Showing 89 changed files with 365 additions and 3,434 deletions.
8 changes: 1 addition & 7 deletions docs/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2032,12 +2032,6 @@
"Handler": {
"type": "object",
"properties": {
"Generators": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/KeyGenerator"
}
},
"H": {
"$ref": "#/definitions/Writer"
},
Expand All @@ -2051,7 +2045,7 @@
"$ref": "#/definitions/Firewall"
}
},
"x-go-package": "github.com/ory/hydra/jwk"
"x-go-package": "github.com/ory/hydra/warden/group"
},
"KeyGenerator": {
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion oauth2/fosite_store_memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type FositeMemoryStore struct {
IDSessions map[string]fosite.Requester
AccessTokens map[string]fosite.Requester
RefreshTokens map[string]fosite.Requester
PKCES map[string]fosite.Requester
PKCES map[string]fosite.Requester
AccessTokenLifespan time.Duration

sync.RWMutex
Expand Down
2 changes: 1 addition & 1 deletion oauth2/fosite_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func init() {
AccessTokens: make(map[string]fosite.Requester),
RefreshTokens: make(map[string]fosite.Requester),
AccessTokenLifespan: time.Hour,
PKCES: make(map[string]fosite.Requester),
PKCES: make(map[string]fosite.Requester),
}
}

Expand Down
21 changes: 21 additions & 0 deletions oauth2/fosite_store_test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,27 @@ func TestHelperCreateGetDeleteAccessTokenSession(m pkg.FositeStorer) func(t *tes
}
}

func TestHelperCreateGetDeletePKCERequestSession(m pkg.FositeStorer) func(t *testing.T) {
return func(t *testing.T) {
ctx := context.Background()
_, err := m.GetPKCERequestSession(ctx, "4321", &fosite.DefaultSession{})
assert.NotNil(t, err)

err = m.CreatePKCERequestSession(ctx, "4321", &defaultRequest)
require.NoError(t, err)

res, err := m.GetPKCERequestSession(ctx, "4321", &fosite.DefaultSession{})
require.NoError(t, err)
AssertObjectKeysEqual(t, &defaultRequest, res, "Scopes", "GrantedScopes", "Form", "Session")

err = m.DeletePKCERequestSession(ctx, "4321")
require.NoError(t, err)

_, err = m.GetPKCERequestSession(ctx, "4321", &fosite.DefaultSession{})
assert.NotNil(t, err)
}
}

var lifespan = time.Hour
var flushRequests = []*fosite.Request{
{
Expand Down
1 change: 0 additions & 1 deletion sdk/go/hydra/swagger/docs/Handler.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Generators** | [**map[string]KeyGenerator**](KeyGenerator.md) | | [optional] [default to null]
**H** | [**Writer**](Writer.md) | | [optional] [default to null]
**Manager** | [**Manager**](Manager.md) | | [optional] [default to null]
**ResourcePrefix** | **string** | | [optional] [default to null]
Expand Down
2 changes: 0 additions & 2 deletions sdk/go/hydra/swagger/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
package swagger

type Handler struct {
Generators map[string]KeyGenerator `json:"Generators,omitempty"`

H Writer `json:"H,omitempty"`

Manager Manager `json:"Manager,omitempty"`
Expand Down
1 change: 0 additions & 1 deletion sdk/js/swagger/docs/Handler.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**generators** | [**{String: KeyGenerator}**](KeyGenerator.md) | | [optional]
**H** | [**Writer**](Writer.md) | | [optional]
**manager** | [**Manager**](Manager.md) | | [optional]
**resourcePrefix** | **String** | | [optional]
Expand Down
21 changes: 2 additions & 19 deletions sdk/js/swagger/src/model/Handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,14 @@
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(
[
'ApiClient',
'model/Firewall',
'model/KeyGenerator',
'model/Manager',
'model/Writer'
],
['ApiClient', 'model/Firewall', 'model/Manager', 'model/Writer'],
factory
)
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(
require('../ApiClient'),
require('./Firewall'),
require('./KeyGenerator'),
require('./Manager'),
require('./Writer')
)
Expand All @@ -44,12 +37,11 @@
root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.Handler = factory(
root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.ApiClient,
root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.Firewall,
root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.KeyGenerator,
root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.Manager,
root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.Writer
)
}
})(this, function(ApiClient, Firewall, KeyGenerator, Manager, Writer) {
})(this, function(ApiClient, Firewall, Manager, Writer) {
'use strict'

/**
Expand Down Expand Up @@ -78,11 +70,6 @@
if (data) {
obj = obj || new exports()

if (data.hasOwnProperty('Generators')) {
obj['Generators'] = ApiClient.convertToType(data['Generators'], {
String: KeyGenerator
})
}
if (data.hasOwnProperty('H')) {
obj['H'] = Writer.constructFromObject(data['H'])
}
Expand All @@ -102,10 +89,6 @@
return obj
}

/**
* @member {Object.<String, module:model/KeyGenerator>} Generators
*/
exports.prototype['Generators'] = undefined
/**
* @member {module:model/Writer} H
*/
Expand Down
2 changes: 1 addition & 1 deletion sdk/php/.swagger-codegen/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
unset
2.2.3
36 changes: 14 additions & 22 deletions sdk/php/swagger/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# swagger
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](https://storage.googleapis.com/ory.am/hydra/json-schema.png) 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/<tag-id>/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
Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here. Keep in mind that this document reflects the latest branch, always. Support for versioned documentation is coming in the future.

This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:

- API version: Latest
- Build package: io.swagger.codegen.languages.PhpClientCodegen
For more information, please visit [https://www.ory.am](https://www.ory.am)
For more information, please visit [https://www.ory.sh](https://www.ory.sh)

## Requirements

Expand Down Expand Up @@ -57,15 +57,13 @@ Please follow the [installation procedure](#installation--usage) and then run th
<?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();
$result = $api_instance->getInstanceStatus();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling HealthApi->getInstanceMetrics: ', $e->getMessage(), PHP_EOL;
echo 'Exception when calling HealthApi->getInstanceStatus: ', $e->getMessage(), PHP_EOL;
}

?>
Expand All @@ -77,19 +75,19 @@ All URIs are relative to *http://localhost*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*HealthApi* | [**getInstanceMetrics**](docs/Api/HealthApi.md#getinstancemetrics) | **GET** /health/metrics | Show instance metrics (experimental)
*HealthApi* | [**getInstanceStatus**](docs/Api/HealthApi.md#getinstancestatus) | **GET** /health/status | Check health status of this instance
*HealthApi* | [**getInstanceStatus**](docs/Api/HealthApi.md#getinstancestatus) | **GET** /health/status | Check the Health Status
*JsonWebKeyApi* | [**createJsonWebKeySet**](docs/Api/JsonWebKeyApi.md#createjsonwebkeyset) | **POST** /keys/{set} | Generate a new JSON Web Key
*JsonWebKeyApi* | [**deleteJsonWebKey**](docs/Api/JsonWebKeyApi.md#deletejsonwebkey) | **DELETE** /keys/{set}/{kid} | Delete a JSON Web Key
*JsonWebKeyApi* | [**deleteJsonWebKeySet**](docs/Api/JsonWebKeyApi.md#deletejsonwebkeyset) | **DELETE** /keys/{set} | Delete a JSON Web Key
*JsonWebKeyApi* | [**deleteJsonWebKeySet**](docs/Api/JsonWebKeyApi.md#deletejsonwebkeyset) | **DELETE** /keys/{set} | Delete a JSON Web Key Set
*JsonWebKeyApi* | [**getJsonWebKey**](docs/Api/JsonWebKeyApi.md#getjsonwebkey) | **GET** /keys/{set}/{kid} | Retrieve a JSON Web Key
*JsonWebKeyApi* | [**getJsonWebKeySet**](docs/Api/JsonWebKeyApi.md#getjsonwebkeyset) | **GET** /keys/{set} | Retrieve a JSON Web Key Set
*JsonWebKeyApi* | [**updateJsonWebKey**](docs/Api/JsonWebKeyApi.md#updatejsonwebkey) | **PUT** /keys/{set}/{kid} | Update a JSON Web Key
*JsonWebKeyApi* | [**updateJsonWebKeySet**](docs/Api/JsonWebKeyApi.md#updatejsonwebkeyset) | **PUT** /keys/{set} | Update a JSON Web Key Set
*OAuth2Api* | [**acceptOAuth2ConsentRequest**](docs/Api/OAuth2Api.md#acceptoauth2consentrequest) | **PATCH** /oauth2/consent/requests/{id}/accept | Accept a consent request
*OAuth2Api* | [**createOAuth2Client**](docs/Api/OAuth2Api.md#createoauth2client) | **POST** /clients | Create an OAuth 2.0 client
*OAuth2Api* | [**deleteOAuth2Client**](docs/Api/OAuth2Api.md#deleteoauth2client) | **DELETE** /clients/{id} | Deletes an OAuth 2.0 Client
*OAuth2Api* | [**getOAuth2Client**](docs/Api/OAuth2Api.md#getoauth2client) | **GET** /clients/{id} | Retrieve an OAuth 2.0 Client.
*OAuth2Api* | [**flushInactiveOAuth2Tokens**](docs/Api/OAuth2Api.md#flushinactiveoauth2tokens) | **POST** /oauth2/flush | Flush Expired OAuth2 Access Tokens
*OAuth2Api* | [**getOAuth2Client**](docs/Api/OAuth2Api.md#getoauth2client) | **GET** /clients/{id} | Get an OAuth 2.0 Client.
*OAuth2Api* | [**getOAuth2ConsentRequest**](docs/Api/OAuth2Api.md#getoauth2consentrequest) | **GET** /oauth2/consent/requests/{id} | Receive consent request information
*OAuth2Api* | [**getWellKnown**](docs/Api/OAuth2Api.md#getwellknown) | **GET** /.well-known/openid-configuration | Server well known configuration
*OAuth2Api* | [**introspectOAuth2Token**](docs/Api/OAuth2Api.md#introspectoauth2token) | **POST** /oauth2/introspect | Introspect OAuth2 tokens
Expand All @@ -100,7 +98,7 @@ Class | Method | HTTP request | Description
*OAuth2Api* | [**revokeOAuth2Token**](docs/Api/OAuth2Api.md#revokeoauth2token) | **POST** /oauth2/revoke | Revoke OAuth2 tokens
*OAuth2Api* | [**updateOAuth2Client**](docs/Api/OAuth2Api.md#updateoauth2client) | **PUT** /clients/{id} | Update an OAuth 2.0 Client
*OAuth2Api* | [**userinfo**](docs/Api/OAuth2Api.md#userinfo) | **POST** /userinfo | OpenID Connect Userinfo
*OAuth2Api* | [**wellKnown**](docs/Api/OAuth2Api.md#wellknown) | **GET** /.well-known/jwks.json | Get list of well known JSON Web Keys
*OAuth2Api* | [**wellKnown**](docs/Api/OAuth2Api.md#wellknown) | **GET** /.well-known/jwks.json | Get Well-Known JSON Web Keys
*PolicyApi* | [**createPolicy**](docs/Api/PolicyApi.md#createpolicy) | **POST** /policies | Create an Access Control Policy
*PolicyApi* | [**deletePolicy**](docs/Api/PolicyApi.md#deletepolicy) | **DELETE** /policies/{id} | Delete an Access Control Policy
*PolicyApi* | [**getPolicy**](docs/Api/PolicyApi.md#getpolicy) | **GET** /policies/{id} | Get an Access Control Policy
Expand All @@ -124,11 +122,11 @@ Class | Method | HTTP request | Description
- [ConsentRequestRejection](docs/Model/ConsentRequestRejection.md)
- [Context](docs/Model/Context.md)
- [Firewall](docs/Model/Firewall.md)
- [FlushInactiveOAuth2TokensRequest](docs/Model/FlushInactiveOAuth2TokensRequest.md)
- [Group](docs/Model/Group.md)
- [GroupMembers](docs/Model/GroupMembers.md)
- [Handler](docs/Model/Handler.md)
- [InlineResponse200](docs/Model/InlineResponse200.md)
- [InlineResponse2001](docs/Model/InlineResponse2001.md)
- [InlineResponse401](docs/Model/InlineResponse401.md)
- [JoseWebKeySetRequest](docs/Model/JoseWebKeySetRequest.md)
- [JsonWebKey](docs/Model/JsonWebKey.md)
Expand All @@ -139,13 +137,15 @@ Class | Method | HTTP request | Description
- [OAuth2Client](docs/Model/OAuth2Client.md)
- [OAuth2ConsentRequest](docs/Model/OAuth2ConsentRequest.md)
- [OAuth2TokenIntrospection](docs/Model/OAuth2TokenIntrospection.md)
- [OauthTokenResponse](docs/Model/OauthTokenResponse.md)
- [Policy](docs/Model/Policy.md)
- [PolicyConditions](docs/Model/PolicyConditions.md)
- [RawMessage](docs/Model/RawMessage.md)
- [SwaggerAcceptConsentRequest](docs/Model/SwaggerAcceptConsentRequest.md)
- [SwaggerCreatePolicyParameters](docs/Model/SwaggerCreatePolicyParameters.md)
- [SwaggerDoesWardenAllowAccessRequestParameters](docs/Model/SwaggerDoesWardenAllowAccessRequestParameters.md)
- [SwaggerDoesWardenAllowTokenAccessRequestParameters](docs/Model/SwaggerDoesWardenAllowTokenAccessRequestParameters.md)
- [SwaggerFlushInactiveAccessTokens](docs/Model/SwaggerFlushInactiveAccessTokens.md)
- [SwaggerGetPolicyParameters](docs/Model/SwaggerGetPolicyParameters.md)
- [SwaggerJsonWebKeyQuery](docs/Model/SwaggerJsonWebKeyQuery.md)
- [SwaggerJwkCreateSet](docs/Model/SwaggerJwkCreateSet.md)
Expand All @@ -154,20 +154,13 @@ Class | Method | HTTP request | Description
- [SwaggerJwkUpdateSetKey](docs/Model/SwaggerJwkUpdateSetKey.md)
- [SwaggerListPolicyParameters](docs/Model/SwaggerListPolicyParameters.md)
- [SwaggerListPolicyResponse](docs/Model/SwaggerListPolicyResponse.md)
- [SwaggerOAuthConsentRequest](docs/Model/SwaggerOAuthConsentRequest.md)
- [SwaggerOAuthConsentRequestPayload](docs/Model/SwaggerOAuthConsentRequestPayload.md)
- [SwaggerOAuthIntrospectionRequest](docs/Model/SwaggerOAuthIntrospectionRequest.md)
- [SwaggerOAuthIntrospectionResponse](docs/Model/SwaggerOAuthIntrospectionResponse.md)
- [SwaggerOAuthTokenResponse](docs/Model/SwaggerOAuthTokenResponse.md)
- [SwaggerOAuthTokenResponseBody](docs/Model/SwaggerOAuthTokenResponseBody.md)
- [SwaggerRejectConsentRequest](docs/Model/SwaggerRejectConsentRequest.md)
- [SwaggerRevokeOAuth2TokenParameters](docs/Model/SwaggerRevokeOAuth2TokenParameters.md)
- [SwaggerUpdatePolicyParameters](docs/Model/SwaggerUpdatePolicyParameters.md)
- [SwaggerWardenAccessRequestResponseParameters](docs/Model/SwaggerWardenAccessRequestResponseParameters.md)
- [SwaggerWardenTokenAccessRequestResponse](docs/Model/SwaggerWardenTokenAccessRequestResponse.md)
- [SwaggeruserinfoResponse](docs/Model/SwaggeruserinfoResponse.md)
- [SwaggeruserinfoResponsePayload](docs/Model/SwaggeruserinfoResponsePayload.md)
- [TokenAllowedRequest](docs/Model/TokenAllowedRequest.md)
- [UserinfoResponse](docs/Model/UserinfoResponse.md)
- [WardenAccessRequest](docs/Model/WardenAccessRequest.md)
- [WardenAccessRequestResponse](docs/Model/WardenAccessRequestResponse.md)
- [WardenTokenAccessRequest](docs/Model/WardenTokenAccessRequest.md)
Expand All @@ -191,7 +184,6 @@ Class | Method | HTTP request | Description
- **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
Expand Down
4 changes: 2 additions & 2 deletions sdk/php/swagger/autoload.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/**
* Hydra OAuth2 & OpenID Connect Server
* ORY Hydra - Cloud Native OAuth 2.0 and OpenID Connect Server
*
* 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](https://storage.googleapis.com/ory.am/hydra/json-schema.png) 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/<tag-id>/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
* Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here. Keep in mind that this document reflects the latest branch, always. Support for versioned documentation is coming in the future.
*
* OpenAPI spec version: Latest
* Contact: [email protected]
Expand Down
Loading

0 comments on commit 3db984d

Please sign in to comment.