Skip to content

Commit

Permalink
sdk/js: officially publish nodejs sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored and arekkas committed Oct 5, 2017
1 parent c20a461 commit c007c78
Show file tree
Hide file tree
Showing 17 changed files with 362 additions and 48 deletions.
21 changes: 21 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
client/
cmd/
compose/
config/
docs/
firewall/
health/
integration/
jwk/
metrics/
oauth2/
pkg/
policy/
rand/
scripts/
sdk/go/
vendor/
warden/
*.yml
*.go
*.md
27 changes: 19 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,23 @@ after_success:
- |-
[ "${TRAVIS_TAG}" != "" ] && gox -ldflags "-X github.com/ory/hydra/cmd.Version=`git describe --tags` -X github.com/ory/hydra/cmd.BuildTime=`TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ'` -X github.com/ory/hydra/cmd.GitHash=`git rev-parse HEAD`" -output "dist/{{.Dir}}-{{.OS}}-{{.Arch}}"
before_deploy:
- npm version --no-git-tag-version $(git describe --tag)

deploy:
provider: releases
file_glob: true
api_key: "$GITHUB_TOKEN"
file: "dist/*"
skip_cleanup: true
on:
tags: true
go: 1.9
- provider: npm
api_key: "$NPM_TOKEN"
email: "$NPM_EMAIL"
skip_cleanup: true
on:
tags: true
- provider: releases
file_glob: true
api_key: "$GITHUB_TOKEN"
file: "dist/*"
skip_cleanup: true
on:
tags: true
go: 1.9
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ and low resource consumption. ORY Hydra *is not* an identity provider (user sign
but connects to your existing identity provider through a [consent app](https://ory.gitbooks.io/hydra/content/oauth2.html#consent-app-flow).
Implementing the consent app in a different language is easy, and exemplary consent apps
([Go](https://github.com/ory/hydra-consent-app-go), [Node](https://github.com/ory/hydra-consent-app-express)) and
SDKs ([Go](https://github.com/ory/hydra/tree/update-docs/sdk), [Node](https://github.com/ory/hydra-js)) are provided.
[SDKs](https://ory.gitbooks.io/hydra/content/sdk.html) are provided.

Besides mitigating various attack vectors, such as database compromisation and OAuth 2.0 weaknesses, ORY Hydra is
able to securely manage JSON Web Keys, and has a sophisticated policy-based access control you can use if you want to.
Expand Down Expand Up @@ -288,7 +288,6 @@ Fosite (which is what this is based on) is a very good implementation from a sec
## Libraries and third-party projects

Official:
* [Consent App SDK For NodeJS](https://github.com/ory/hydra-js)
* [Consent App Example written in Go](https://github.com/ory/hydra-consent-app-go)
* [Exemplary Consent App with Express and NodeJS](https://github.com/ory/hydra-consent-app-express)

Expand Down
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "ory-hydra-sdk",
"version": "0.0.0-alpha5",
"description": "The official JavaScript / NodeJS SDK for ORY Hydra.",
"license": "Apache 2.0",
"main": "sdk/js/swagger/src/index.js",
"scripts": {
"test": "./node_modules/mocha/bin/mocha --recursive"
},
"browser": {
"fs": false
},
"dependencies": {
"superagent": "3.5.2"
},
"devDependencies": {
"mocha": "~2.3.4",
"sinon": "1.17.3",
"expect.js": "~0.3.1"
}
}
3 changes: 2 additions & 1 deletion scripts/run-gensdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ scripts/run-format.sh
git add -A .

git checkout HEAD -- sdk/go/hydra/swagger/configuration.go
git checkout HEAD -- sdk/go/hydra/swagger/api_client.go
git checkout HEAD -- sdk/go/hydra/swagger/api_client.go
rm -f ./sdk/js/swagger/package.json
2 changes: 1 addition & 1 deletion sdk/js/swagger/docs/Context.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**cid** | **String** | ClientID is who the token was issued for. This is an OAuth2 app usually. | [optional]
**aud** | **String** | Audience is who the token was issued for. This is an OAuth2 app usually. | [optional]
**ext** | **{String: Object}** | Extra represents arbitrary session data. | [optional]
**iss** | **String** | Issuer is the id of the issuer, typically an hydra instance. | [optional]
**scopes** | **[String]** | GrantedScopes is a list of scopes that the subject authorized when asked for consent. | [optional]
Expand Down
1 change: 1 addition & 0 deletions sdk/js/swagger/docs/Handler.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**generators** | [**{String: KeyGenerator}**](KeyGenerator.md) | | [optional]
**H** | [**Writer**](Writer.md) | | [optional]
**manager** | [**Manager**](Manager.md) | | [optional]
**W** | [**Firewall**](Firewall.md) | | [optional]
Expand Down
2 changes: 1 addition & 1 deletion sdk/js/swagger/docs/OAuth2TokenIntrospection.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**active** | **Boolean** | Active is a boolean indicator of whether or not the presented token is currently active. The specifics of a token's \"active\" state will vary depending on the implementation of the authorization server and the information it keeps about its tokens, but a \"true\" value return for the \"active\" property will generally indicate that a given token has been issued by this authorization server, has not been revoked by the resource owner, and is within its given time window of validity (e.g., after its issuance time and before its expiration time). | [optional]
**aud** | **String** | ClientID is a service-specific string identifier or list of string identifiers representing the intended audience for this token. | [optional]
**aud** | **String** | Audience is a service-specific string identifier or list of string identifiers representing the intended audience for this token. | [optional]
**clientId** | **String** | ClientID is aclient identifier for the OAuth 2.0 client that requested this token. | [optional]
**exp** | **Number** | Expires at is an integer timestamp, measured in the number of seconds since January 1 1970 UTC, indicating when this token will expire. | [optional]
**ext** | **{String: Object}** | Extra is arbitrary data set by the session. | [optional]
Expand Down
2 changes: 1 addition & 1 deletion sdk/js/swagger/docs/OAuth2consentRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**audience** | **String** | ClientID is the audience this token is meant for. Usually a URL. | [optional]
**audience** | **String** | Audience is the client id that initiated the OAuth2 request. | [optional]
**id** | **String** | ID is the id of this consent request. | [optional]
**redirectUrl** | **String** | Redirect URL is the URL where the user agent should be redirected to after the consent has been accepted or rejected. | [optional]
**requestedScopes** | **[String]** | RequestedScopes represents a list of scopes that have been requested by the OAuth2 request initiator. | [optional]
Expand Down
21 changes: 0 additions & 21 deletions sdk/js/swagger/package.json

This file was deleted.

10 changes: 5 additions & 5 deletions sdk/js/swagger/src/model/Context.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
if (data) {
obj = obj || new exports();

if (data.hasOwnProperty('cid')) {
obj['cid'] = ApiClient.convertToType(data['cid'], 'String');
if (data.hasOwnProperty('aud')) {
obj['aud'] = ApiClient.convertToType(data['aud'], 'String');
}
if (data.hasOwnProperty('ext')) {
obj['ext'] = ApiClient.convertToType(data['ext'], {'String': Object});
Expand All @@ -87,10 +87,10 @@
}

/**
* ClientID is who the token was issued for. This is an OAuth2 app usually.
* @member {String} cid
* Audience is who the token was issued for. This is an OAuth2 app usually.
* @member {String} aud
*/
exports.prototype['cid'] = undefined;
exports.prototype['aud'] = undefined;
/**
* Extra represents arbitrary session data.
* @member {Object.<String, Object>} ext
Expand Down
16 changes: 12 additions & 4 deletions sdk/js/swagger/src/model/Handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient', 'model/Firewall', 'model/Manager', 'model/Writer'], factory);
define(['ApiClient', 'model/Firewall', 'model/KeyGenerator', '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('./Manager'), require('./Writer'));
module.exports = factory(require('../ApiClient'), require('./Firewall'), require('./KeyGenerator'), require('./Manager'), require('./Writer'));
} else {
// Browser globals (root is window)
if (!root.HydraOAuth2OpenIdConnectServer) {
root.HydraOAuth2OpenIdConnectServer = {};
}
root.HydraOAuth2OpenIdConnectServer.Handler = factory(root.HydraOAuth2OpenIdConnectServer.ApiClient, root.HydraOAuth2OpenIdConnectServer.Firewall, root.HydraOAuth2OpenIdConnectServer.Manager, root.HydraOAuth2OpenIdConnectServer.Writer);
root.HydraOAuth2OpenIdConnectServer.Handler = factory(root.HydraOAuth2OpenIdConnectServer.ApiClient, root.HydraOAuth2OpenIdConnectServer.Firewall, root.HydraOAuth2OpenIdConnectServer.KeyGenerator, root.HydraOAuth2OpenIdConnectServer.Manager, root.HydraOAuth2OpenIdConnectServer.Writer);
}
}(this, function(ApiClient, Firewall, Manager, Writer) {
}(this, function(ApiClient, Firewall, KeyGenerator, Manager, Writer) {
'use strict';


Expand All @@ -51,6 +51,7 @@




};

/**
Expand All @@ -64,6 +65,9 @@
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 @@ -77,6 +81,10 @@
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/js/swagger/src/model/OAuth2TokenIntrospection.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
*/
exports.prototype['active'] = undefined;
/**
* ClientID is a service-specific string identifier or list of string identifiers representing the intended audience for this token.
* Audience is a service-specific string identifier or list of string identifiers representing the intended audience for this token.
* @member {String} aud
*/
exports.prototype['aud'] = undefined;
Expand Down
2 changes: 1 addition & 1 deletion sdk/js/swagger/src/model/OAuth2consentRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
}

/**
* ClientID is the audience this token is meant for. Usually a URL.
* Audience is the client id that initiated the OAuth2 request.
* @member {String} audience
*/
exports.prototype['audience'] = undefined;
Expand Down
4 changes: 2 additions & 2 deletions sdk/js/swagger/test/model/Context.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
//expect(instance).to.be.a(HydraOAuth2OpenIdConnectServer.Context);
});

it('should have the property cid (base name: "cid")', function() {
// uncomment below and update the code to test the property cid
it('should have the property aud (base name: "aud")', function() {
// uncomment below and update the code to test the property aud
//var instane = new HydraOAuth2OpenIdConnectServer.Context();
//expect(instance).to.be();
});
Expand Down
6 changes: 6 additions & 0 deletions sdk/js/swagger/test/model/Handler.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
//expect(instance).to.be.a(HydraOAuth2OpenIdConnectServer.Handler);
});

it('should have the property generators (base name: "Generators")', function() {
// uncomment below and update the code to test the property generators
//var instane = new HydraOAuth2OpenIdConnectServer.Handler();
//expect(instance).to.be();
});

it('should have the property H (base name: "H")', function() {
// uncomment below and update the code to test the property H
//var instane = new HydraOAuth2OpenIdConnectServer.Handler();
Expand Down
Loading

0 comments on commit c007c78

Please sign in to comment.