Skip to content

Commit

Permalink
cli: Print "active:false" when token is inactive
Browse files Browse the repository at this point in the history
Previously, `omitempty` caused active to be omitted when set to false.

Closes #965

Signed-off-by: arekkas <aeneas@ory.am>
  • Loading branch information
arekkas committed Aug 7, 2018
1 parent 5ca384d commit b50f456
Show file tree
Hide file tree
Showing 16 changed files with 590 additions and 141 deletions.
3 changes: 3 additions & 0 deletions docs/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2486,6 +2486,9 @@
"description": "https://tools.ietf.org/html/rfc7662",
"type": "object",
"title": "Introspection contains an access token's session data as specified by IETF RFC 7662, see:",
"required": [
"active"
],
"properties": {
"active": {
"description": "Active is a boolean indicator of whether or not the presented token\nis currently active. The specifics of a token's \"active\" state\nwill vary depending on the implementation of the authorization\nserver and the information it keeps about its tokens, but a \"true\"\nvalue return for the \"active\" property will generally indicate\nthat a given token has been issued by this authorization server,\nhas not been revoked by the resource owner, and is within its\ngiven time window of validity (e.g., after its issuance time and\nbefore its expiration time).",
Expand Down
2 changes: 2 additions & 0 deletions oauth2/introspector.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ type Introspection struct {
// 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).
//
// required: true
Active bool `json:"active"`

// Scope is a JSON string containing a space-separated list of
Expand Down
2 changes: 1 addition & 1 deletion sdk/go/hydra/swagger/docs/OAuth2TokenIntrospection.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Active** | **bool** | Active is a boolean indicator of whether or not the presented token is currently active. The specifics of a token&#39;s \&quot;active\&quot; state will vary depending on the implementation of the authorization server and the information it keeps about its tokens, but a \&quot;true\&quot; value return for the \&quot;active\&quot; 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] [default to null]
**Active** | **bool** | Active is a boolean indicator of whether or not the presented token is currently active. The specifics of a token&#39;s \&quot;active\&quot; state will vary depending on the implementation of the authorization server and the information it keeps about its tokens, but a \&quot;true\&quot; value return for the \&quot;active\&quot; 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). | [default to null]
**Aud** | **[]string** | | [optional] [default to null]
**ClientId** | **string** | ClientID is aclient identifier for the OAuth 2.0 client that requested this token. | [optional] [default to null]
**Exp** | **int64** | Expires at is an integer timestamp, measured in the number of seconds since January 1 1970 UTC, indicating when this token will expire. | [optional] [default to null]
Expand Down
2 changes: 1 addition & 1 deletion sdk/go/hydra/swagger/o_auth2_token_introspection.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ package swagger
type OAuth2TokenIntrospection struct {

// 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).
Active bool `json:"active,omitempty"`
Active bool `json:"active"`

Aud []string `json:"aud,omitempty"`

Expand Down
24 changes: 18 additions & 6 deletions sdk/js/swagger/docs/JsonWebKey.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
# OryHydraCloudNativeOAuth20AndOpenIdConnectServer.JSONWebKey
# OryHydraCloudNativeOAuth20AndOpenIdConnectServer.JsonWebKey

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**algorithm** | **String** | | [optional]
**certificates** | [**[Certificate]**](Certificate.md) | | [optional]
**key** | **Object** | | [optional]
**keyID** | **String** | | [optional]
**use** | **String** | | [optional]
**alg** | **String** | The \&quot;alg\&quot; (algorithm) parameter identifies the algorithm intended for use with the key. The values used should either be registered in the IANA \&quot;JSON Web Signature and Encryption Algorithms\&quot; registry established by [JWA] or be a value that contains a Collision- Resistant Name. | [optional]
**crv** | **String** | | [optional]
**d** | **String** | | [optional]
**dp** | **String** | | [optional]
**dq** | **String** | | [optional]
**e** | **String** | | [optional]
**k** | **String** | | [optional]
**kid** | **String** | The \&quot;kid\&quot; (key ID) parameter is used to match a specific key. This is used, for instance, to choose among a set of keys within a JWK Set during key rollover. The structure of the \&quot;kid\&quot; value is unspecified. When \&quot;kid\&quot; values are used within a JWK Set, different keys within the JWK Set SHOULD use distinct \&quot;kid\&quot; values. (One example in which different keys might use the same \&quot;kid\&quot; value is if they have different \&quot;kty\&quot; (key type) values but are considered to be equivalent alternatives by the application using them.) The \&quot;kid\&quot; value is a case-sensitive string. | [optional]
**kty** | **String** | The \&quot;kty\&quot; (key type) parameter identifies the cryptographic algorithm family used with the key, such as \&quot;RSA\&quot; or \&quot;EC\&quot;. \&quot;kty\&quot; values should either be registered in the IANA \&quot;JSON Web Key Types\&quot; registry established by [JWA] or be a value that contains a Collision- Resistant Name. The \&quot;kty\&quot; value is a case-sensitive string. | [optional]
**n** | **String** | | [optional]
**p** | **String** | | [optional]
**q** | **String** | | [optional]
**qi** | **String** | | [optional]
**use** | **String** | The \&quot;use\&quot; (public key use) parameter identifies the intended use of the public key. The \&quot;use\&quot; parameter is employed to indicate whether a public key is used for encrypting data or verifying the signature on data. Values are commonly \&quot;sig\&quot; (signature) or \&quot;enc\&quot; (encryption). | [optional]
**x** | **String** | | [optional]
**x5c** | **[String]** | The \&quot;x5c\&quot; (X.509 certificate chain) parameter contains a chain of one or more PKIX certificates [RFC5280]. The certificate chain is represented as a JSON array of certificate value strings. Each string in the array is a base64-encoded (Section 4 of [RFC4648] -- not base64url-encoded) DER [ITU.X690.1994] PKIX certificate value. The PKIX certificate containing the key value MUST be the first certificate. | [optional]
**y** | **String** | | [optional]


4 changes: 2 additions & 2 deletions sdk/js/swagger/docs/JsonWebKeySet.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# OryHydraCloudNativeOAuth20AndOpenIdConnectServer.JSONWebKeySet
# OryHydraCloudNativeOAuth20AndOpenIdConnectServer.JsonWebKeySet

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**keys** | [**[JSONWebKey]**](JSONWebKey.md) | | [optional]
**keys** | [**[JsonWebKey]**](JsonWebKey.md) | The value of the \&quot;keys\&quot; parameter is an array of JWK values. By default, the order of the JWK values within the array does not imply an order of preference among them, although applications of JWK Sets can choose to assign a meaning to the order for their purposes, if desired. | [optional]


2 changes: 1 addition & 1 deletion sdk/js/swagger/docs/OAuth2TokenIntrospection.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Properties
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&#39;s \&quot;active\&quot; state will vary depending on the implementation of the authorization server and the information it keeps about its tokens, but a \&quot;true\&quot; value return for the \&quot;active\&quot; 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]
**active** | **Boolean** | Active is a boolean indicator of whether or not the presented token is currently active. The specifics of a token&#39;s \&quot;active\&quot; state will vary depending on the implementation of the authorization server and the information it keeps about its tokens, but a \&quot;true\&quot; value return for the \&quot;active\&quot; 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). |
**aud** | **[String]** | | [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]
Expand Down
156 changes: 121 additions & 35 deletions sdk/js/swagger/src/model/JsonWebKey.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,90 +17,176 @@
;(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient', 'model/Certificate'], factory)
define(['ApiClient'], factory)
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'), require('./Certificate'))
module.exports = factory(require('../ApiClient'))
} else {
// Browser globals (root is window)
if (!root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer) {
root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer = {}
}
root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.JSONWebKey = factory(
root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.ApiClient,
root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.Certificate
root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.JsonWebKey = factory(
root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.ApiClient
)
}
})(this, function(ApiClient, Certificate) {
})(this, function(ApiClient) {
'use strict'

/**
* The JSONWebKey model module.
* @module model/JSONWebKey
* The JsonWebKey model module.
* @module model/JsonWebKey
* @version Latest
*/

/**
* Constructs a new <code>JSONWebKey</code>.
* @alias module:model/JSONWebKey
* Constructs a new <code>JsonWebKey</code>.
* @alias module:model/JsonWebKey
* @class
*/
var exports = function() {
var _this = this
}

/**
* Constructs a <code>JSONWebKey</code> from a plain JavaScript object, optionally creating a new instance.
* Constructs a <code>JsonWebKey</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/JSONWebKey} obj Optional instance to populate.
* @return {module:model/JSONWebKey} The populated <code>JSONWebKey</code> instance.
* @param {module:model/JsonWebKey} obj Optional instance to populate.
* @return {module:model/JsonWebKey} The populated <code>JsonWebKey</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports()

if (data.hasOwnProperty('Algorithm')) {
obj['Algorithm'] = ApiClient.convertToType(data['Algorithm'], 'String')
if (data.hasOwnProperty('alg')) {
obj['alg'] = ApiClient.convertToType(data['alg'], 'String')
}
if (data.hasOwnProperty('Certificates')) {
obj['Certificates'] = ApiClient.convertToType(data['Certificates'], [
Certificate
])
if (data.hasOwnProperty('crv')) {
obj['crv'] = ApiClient.convertToType(data['crv'], 'String')
}
if (data.hasOwnProperty('Key')) {
obj['Key'] = ApiClient.convertToType(data['Key'], Object)
if (data.hasOwnProperty('d')) {
obj['d'] = ApiClient.convertToType(data['d'], 'String')
}
if (data.hasOwnProperty('KeyID')) {
obj['KeyID'] = ApiClient.convertToType(data['KeyID'], 'String')
if (data.hasOwnProperty('dp')) {
obj['dp'] = ApiClient.convertToType(data['dp'], 'String')
}
if (data.hasOwnProperty('Use')) {
obj['Use'] = ApiClient.convertToType(data['Use'], 'String')
if (data.hasOwnProperty('dq')) {
obj['dq'] = ApiClient.convertToType(data['dq'], 'String')
}
if (data.hasOwnProperty('e')) {
obj['e'] = ApiClient.convertToType(data['e'], 'String')
}
if (data.hasOwnProperty('k')) {
obj['k'] = ApiClient.convertToType(data['k'], 'String')
}
if (data.hasOwnProperty('kid')) {
obj['kid'] = ApiClient.convertToType(data['kid'], 'String')
}
if (data.hasOwnProperty('kty')) {
obj['kty'] = ApiClient.convertToType(data['kty'], 'String')
}
if (data.hasOwnProperty('n')) {
obj['n'] = ApiClient.convertToType(data['n'], 'String')
}
if (data.hasOwnProperty('p')) {
obj['p'] = ApiClient.convertToType(data['p'], 'String')
}
if (data.hasOwnProperty('q')) {
obj['q'] = ApiClient.convertToType(data['q'], 'String')
}
if (data.hasOwnProperty('qi')) {
obj['qi'] = ApiClient.convertToType(data['qi'], 'String')
}
if (data.hasOwnProperty('use')) {
obj['use'] = ApiClient.convertToType(data['use'], 'String')
}
if (data.hasOwnProperty('x')) {
obj['x'] = ApiClient.convertToType(data['x'], 'String')
}
if (data.hasOwnProperty('x5c')) {
obj['x5c'] = ApiClient.convertToType(data['x5c'], ['String'])
}
if (data.hasOwnProperty('y')) {
obj['y'] = ApiClient.convertToType(data['y'], 'String')
}
}
return obj
}

/**
* @member {String} Algorithm
* The \"alg\" (algorithm) parameter identifies the algorithm intended for use with the key. The values used should either be registered in the IANA \"JSON Web Signature and Encryption Algorithms\" registry established by [JWA] or be a value that contains a Collision- Resistant Name.
* @member {String} alg
*/
exports.prototype['alg'] = undefined
/**
* @member {String} crv
*/
exports.prototype['crv'] = undefined
/**
* @member {String} d
*/
exports.prototype['d'] = undefined
/**
* @member {String} dp
*/
exports.prototype['dp'] = undefined
/**
* @member {String} dq
*/
exports.prototype['dq'] = undefined
/**
* @member {String} e
*/
exports.prototype['e'] = undefined
/**
* @member {String} k
*/
exports.prototype['k'] = undefined
/**
* The \"kid\" (key ID) parameter is used to match a specific key. This is used, for instance, to choose among a set of keys within a JWK Set during key rollover. The structure of the \"kid\" value is unspecified. When \"kid\" values are used within a JWK Set, different keys within the JWK Set SHOULD use distinct \"kid\" values. (One example in which different keys might use the same \"kid\" value is if they have different \"kty\" (key type) values but are considered to be equivalent alternatives by the application using them.) The \"kid\" value is a case-sensitive string.
* @member {String} kid
*/
exports.prototype['kid'] = undefined
/**
* The \"kty\" (key type) parameter identifies the cryptographic algorithm family used with the key, such as \"RSA\" or \"EC\". \"kty\" values should either be registered in the IANA \"JSON Web Key Types\" registry established by [JWA] or be a value that contains a Collision- Resistant Name. The \"kty\" value is a case-sensitive string.
* @member {String} kty
*/
exports.prototype['kty'] = undefined
/**
* @member {String} n
*/
exports.prototype['n'] = undefined
/**
* @member {String} p
*/
exports.prototype['p'] = undefined
/**
* @member {String} q
*/
exports.prototype['q'] = undefined
/**
* @member {String} qi
*/
exports.prototype['Algorithm'] = undefined
exports.prototype['qi'] = undefined
/**
* @member {Array.<module:model/Certificate>} Certificates
* The \"use\" (public key use) parameter identifies the intended use of the public key. The \"use\" parameter is employed to indicate whether a public key is used for encrypting data or verifying the signature on data. Values are commonly \"sig\" (signature) or \"enc\" (encryption).
* @member {String} use
*/
exports.prototype['Certificates'] = undefined
exports.prototype['use'] = undefined
/**
* @member {Object} Key
* @member {String} x
*/
exports.prototype['Key'] = undefined
exports.prototype['x'] = undefined
/**
* @member {String} KeyID
* The \"x5c\" (X.509 certificate chain) parameter contains a chain of one or more PKIX certificates [RFC5280]. The certificate chain is represented as a JSON array of certificate value strings. Each string in the array is a base64-encoded (Section 4 of [RFC4648] -- not base64url-encoded) DER [ITU.X690.1994] PKIX certificate value. The PKIX certificate containing the key value MUST be the first certificate.
* @member {Array.<String>} x5c
*/
exports.prototype['KeyID'] = undefined
exports.prototype['x5c'] = undefined
/**
* @member {String} Use
* @member {String} y
*/
exports.prototype['Use'] = undefined
exports.prototype['y'] = undefined

return exports
})
Loading

0 comments on commit b50f456

Please sign in to comment.