authlete 1.0.21 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Makefile +40 -0
- data/README.md +20 -20
- data/Rakefile +5 -0
- data/authlete.gemspec +2 -2
- data/lib/authlete.rb +28 -9
- data/lib/authlete/api.rb +153 -322
- data/lib/authlete/authentication-server.rb +230 -230
- data/lib/authlete/exception.rb +14 -15
- data/lib/authlete/model/base.rb +30 -0
- data/lib/authlete/model/client-extension.rb +17 -119
- data/lib/authlete/model/client.rb +203 -338
- data/lib/authlete/model/hashable.rb +13 -33
- data/lib/authlete/model/named-uri.rb +13 -74
- data/lib/authlete/model/pair.rb +13 -74
- data/lib/authlete/model/param-initializer.rb +45 -0
- data/lib/authlete/model/property.rb +15 -85
- data/lib/authlete/model/request/authentication-callback-request.rb +63 -55
- data/lib/authlete/model/request/authorization-fail-request.rb +14 -75
- data/lib/authlete/model/request/authorization-issue-request.rb +38 -119
- data/lib/authlete/model/request/authorization-request.rb +8 -73
- data/lib/authlete/model/request/backchannel-authentication-complete-request.rb +97 -0
- data/lib/authlete/model/request/backchannel-authentication-fail-request.rb +55 -0
- data/lib/authlete/model/request/backchannel-authentication-issue-request.rb +37 -0
- data/lib/authlete/model/request/backchannel-authentication-request.rb +63 -0
- data/lib/authlete/model/request/base.rb +26 -0
- data/lib/authlete/model/request/client-authorization-delete-request.rb +7 -93
- data/lib/authlete/model/request/client-authorization-get-list-request.rb +17 -89
- data/lib/authlete/model/request/client-authorization-update-request.rb +11 -86
- data/lib/authlete/model/request/client-registration-request.rb +49 -0
- data/lib/authlete/model/request/client-secret-update-request.rb +7 -89
- data/lib/authlete/model/request/developer-authentication-callback-request.rb +40 -43
- data/lib/authlete/model/request/device-authorization-request.rb +63 -0
- data/lib/authlete/model/request/device-complete-request.rb +99 -0
- data/lib/authlete/model/request/device-verification-request.rb +40 -0
- data/lib/authlete/model/request/granted-scopes-request.rb +8 -74
- data/lib/authlete/model/request/introspection-request.rb +24 -83
- data/lib/authlete/model/request/pushed-auth-req-request.rb +64 -0
- data/lib/authlete/model/request/revocation-request.rb +14 -88
- data/lib/authlete/model/request/standard-introspection-request.rb +8 -73
- data/lib/authlete/model/request/token-create-request.rb +52 -183
- data/lib/authlete/model/request/token-fail-request.rb +12 -74
- data/lib/authlete/model/request/token-issue-request.rb +22 -80
- data/lib/authlete/model/request/token-request.rb +44 -81
- data/lib/authlete/model/request/token-update-request.rb +35 -121
- data/lib/authlete/model/request/user-info-issue-request.rb +14 -80
- data/lib/authlete/model/request/user-info-request.rb +25 -70
- data/lib/authlete/model/response/access-token.rb +96 -0
- data/lib/authlete/model/response/authentication-callback-response.rb +24 -19
- data/lib/authlete/model/response/authorization-fail-response.rb +13 -15
- data/lib/authlete/model/response/authorization-issue-response.rb +29 -32
- data/lib/authlete/model/response/authorization-response.rb +97 -123
- data/lib/authlete/model/response/authorized-client-list-response.rb +37 -0
- data/lib/authlete/model/response/backchannel-authentication-complete-response.rb +143 -0
- data/lib/authlete/model/response/backchannel-authentication-fail-response.rb +47 -0
- data/lib/authlete/model/response/backchannel-authentication-issue-response.rb +63 -0
- data/lib/authlete/model/response/backchannel-authentication-response.rb +160 -0
- data/lib/authlete/model/response/client-list-response.rb +58 -0
- data/lib/authlete/model/response/client-registration-response.rb +50 -0
- data/lib/authlete/model/response/client-secret-refresh-response.rb +12 -12
- data/lib/authlete/model/response/client-secret-update-response.rb +12 -12
- data/lib/authlete/model/response/developer-authentication-callback-response.rb +24 -19
- data/lib/authlete/model/response/device-authorization-response.rb +134 -0
- data/lib/authlete/model/response/device-complete-response.rb +39 -0
- data/lib/authlete/model/response/device-verification-response.rb +96 -0
- data/lib/authlete/model/response/granted-scopes-get-response.rb +27 -19
- data/lib/authlete/model/response/introspection-response.rb +64 -58
- data/lib/authlete/model/response/pushed-auth-req-response.rb +59 -0
- data/lib/authlete/model/response/revocation-response.rb +12 -15
- data/lib/authlete/model/response/service-list-response.rb +54 -0
- data/lib/authlete/model/response/standard-introspection-response.rb +13 -15
- data/lib/authlete/model/response/token-create-response.rb +50 -55
- data/lib/authlete/model/response/token-fail-response.rb +14 -17
- data/lib/authlete/model/response/token-issue-response.rb +49 -62
- data/lib/authlete/model/response/token-list-response.rb +64 -0
- data/lib/authlete/model/response/token-response.rb +59 -79
- data/lib/authlete/model/response/token-update-response.rb +28 -23
- data/lib/authlete/model/response/user-info-issue-response.rb +16 -16
- data/lib/authlete/model/response/user-info-response.rb +48 -42
- data/lib/authlete/model/result.rb +14 -13
- data/lib/authlete/model/scope.rb +68 -158
- data/lib/authlete/model/service-owner.rb +32 -116
- data/lib/authlete/model/service.rb +672 -837
- data/lib/authlete/model/sns-credentials.rb +51 -124
- data/lib/authlete/model/tagged-value.rb +14 -69
- data/lib/authlete/utility.rb +70 -99
- data/lib/authlete/version.rb +3 -3
- data/test/authlete/model/request/test_authentication-callback-request.rb +100 -0
- data/test/authlete/model/request/test_authorization-fail-request.rb +67 -0
- data/test/authlete/model/request/test_authorization-issue-request.rb +94 -0
- data/test/authlete/model/request/test_authorization-request.rb +57 -0
- data/test/authlete/model/request/test_backchannel-authentication-complete-request.rb +102 -0
- data/test/authlete/model/request/test_backchannel-authentication-fail-request.rb +71 -0
- data/test/authlete/model/request/test_backchannel-authentication-issue-request.rb +57 -0
- data/test/authlete/model/request/test_backchannel-authentication-request.rb +75 -0
- data/test/authlete/model/request/test_client-authorization-delete-request.rb +57 -0
- data/test/authlete/model/request/test_client-authorization-get-list-request.rb +71 -0
- data/test/authlete/model/request/test_client-authorization-update-request.rb +63 -0
- data/test/authlete/model/request/test_client-registration-request.rb +68 -0
- data/test/authlete/model/request/test_device-authorization-request.rb +75 -0
- data/test/authlete/model/request/test_device-complete-request.rb +102 -0
- data/test/authlete/model/request/test_device-verification-request.rb +57 -0
- data/test/authlete/model/request/test_granted-scopes-request.rb +57 -0
- data/test/authlete/model/request/test_introspection-request.rb +79 -0
- data/test/authlete/model/request/test_pushed-auth-req-request.rb +75 -0
- data/test/authlete/model/request/test_revocation-request.rb +67 -0
- data/test/authlete/model/request/test_standard-introspection-request.rb +57 -0
- data/test/authlete/model/request/test_token-create-request.rb +110 -0
- data/test/authlete/model/request/test_token-fail-request.rb +63 -0
- data/test/authlete/model/request/test_token-issue-request.rb +70 -0
- data/test/authlete/model/request/test_token-request.rb +94 -0
- data/test/authlete/model/request/test_token-update-request.rb +82 -0
- data/test/authlete/model/request/test_user-info-issue-request.rb +67 -0
- data/test/authlete/model/request/test_user-info-request.rb +75 -0
- data/test/authlete/model/response/test_access-token.rb +101 -0
- data/test/authlete/model/response/test_authorization-fail-response.rb +68 -0
- data/test/authlete/model/response/test_authorization-issue-response.rb +92 -0
- data/test/authlete/model/response/test_authorization-response.rb +145 -0
- data/test/authlete/model/response/test_authorized-client-list-response.rb +83 -0
- data/test/authlete/model/response/test_backchannel-authentication-complete-response.rb +132 -0
- data/test/authlete/model/response/test_backchannel-authentication-fail-response.rb +68 -0
- data/test/authlete/model/response/test_backchannel-authentication-issue-response.rb +80 -0
- data/test/authlete/model/response/test_backchannel-authentication-response.rb +156 -0
- data/test/authlete/model/response/test_client-list-response.rb +79 -0
- data/test/authlete/model/response/test_client-secret-refresh-response.rb +68 -0
- data/test/authlete/model/response/test_client-secret-update-response.rb +68 -0
- data/test/authlete/model/response/test_device-authorization-response.rb +140 -0
- data/test/authlete/model/response/test_device-complete-response.rb +64 -0
- data/test/authlete/model/response/test_device-verification-response.rb +112 -0
- data/test/authlete/model/response/test_granted-scopes-get-response.rb +84 -0
- data/test/authlete/model/response/test_introspection-response.rb +127 -0
- data/test/authlete/model/response/test_pushed-auth-req-response.rb +76 -0
- data/test/authlete/model/response/test_revocation-response.rb +68 -0
- data/test/authlete/model/response/test_service-list-response.rb +72 -0
- data/test/authlete/model/response/test_standard-introspection-response.rb +68 -0
- data/test/authlete/model/response/test_token-create-response.rb +107 -0
- data/test/authlete/model/response/test_token-fail-response.rb +68 -0
- data/test/authlete/model/response/test_token-issue-response.rb +127 -0
- data/test/authlete/model/response/test_token-list-response.rb +84 -0
- data/test/authlete/model/response/test_token-response.rb +147 -0
- data/test/authlete/model/response/test_token-update-response.rb +87 -0
- data/test/authlete/model/response/test_user-info-issue-response.rb +68 -0
- data/test/authlete/model/response/test_user-info-response.rb +107 -0
- data/test/authlete/model/test_client-extension.rb +95 -0
- data/test/authlete/model/test_client.rb +461 -0
- data/test/authlete/model/test_named-uri.rb +85 -0
- data/test/authlete/model/test_pair.rb +85 -0
- data/test/authlete/model/test_property.rb +90 -0
- data/test/authlete/model/test_result.rb +68 -0
- data/test/authlete/model/test_scope.rb +106 -0
- data/test/authlete/model/test_service-owner.rb +80 -0
- data/test/authlete/model/test_service.rb +624 -0
- data/test/authlete/model/test_sns-credentials.rb +88 -0
- data/test/authlete/model/test_tagged-value.rb +83 -0
- data/test/authlete/test_exception.rb +70 -0
- metadata +173 -13
- data/lib/authlete/model/client-list.rb +0 -129
- data/lib/authlete/model/response/client-authorization-get-list-response.rb +0 -60
- data/lib/authlete/model/response/service-creatable-response.rb +0 -51
- data/lib/authlete/model/service-list.rb +0 -128
@@ -1,6 +1,6 @@
|
|
1
1
|
# :nodoc:
|
2
2
|
#
|
3
|
-
# Copyright (C) 2014-
|
3
|
+
# Copyright (C) 2014-2020 Authlete, Inc.
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -15,77 +15,85 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
|
18
|
-
require 'json'
|
19
|
-
|
20
|
-
|
21
18
|
module Authlete
|
22
19
|
module Model
|
23
20
|
module Request
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
attr_accessor :
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
attr_accessor :client_id
|
35
|
-
|
36
|
-
# The login ID that the end-user input to the login ID field.
|
21
|
+
class AuthenticationCallbackRequest < Authlete::Model::Request::Base
|
22
|
+
|
23
|
+
attr_accessor :serviceApiKey
|
24
|
+
alias_method :service_api_key, :serviceApiKey
|
25
|
+
alias_method :service_api_key=, :serviceApiKey=
|
26
|
+
|
27
|
+
attr_accessor :clientId
|
28
|
+
alias_method :client_id, :clientId
|
29
|
+
alias_method :client_id=, :clientId=
|
30
|
+
|
37
31
|
attr_accessor :id
|
38
32
|
|
39
|
-
# The password that the end-user input to the password field.
|
40
33
|
attr_accessor :password
|
41
34
|
|
42
|
-
# Names of requested claims (string array).
|
43
35
|
attr_accessor :claims
|
44
36
|
|
45
|
-
|
46
|
-
|
47
|
-
|
37
|
+
attr_accessor :claimsLocales
|
38
|
+
alias_method :claims_locales, :claimsLocales
|
39
|
+
alias_method :claims_locales=, :claimsLocales=
|
48
40
|
|
49
|
-
# The SNS which the end-user used for social login.
|
50
|
-
# For example, 'FACEBOOK'.
|
51
41
|
attr_accessor :sns
|
52
42
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
attr_accessor :
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
attr_accessor :
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
43
|
+
attr_accessor :accessToken
|
44
|
+
alias_method :access_token, :accessToken
|
45
|
+
alias_method :access_token=, :accessToken=
|
46
|
+
|
47
|
+
attr_accessor :refreshToken
|
48
|
+
alias_method :refresh_token, :refreshToken
|
49
|
+
alias_method :refresh_token=, :refreshToken=
|
50
|
+
|
51
|
+
attr_accessor :expiresIn
|
52
|
+
alias_method :expires_in, :expiresIn
|
53
|
+
alias_method :expires_in=, :expiresIn=
|
54
|
+
|
55
|
+
attr_accessor :rawTokenResponse
|
56
|
+
alias_method :raw_token_response, :rawTokenResponse
|
57
|
+
alias_method :raw_token_response=, :rawTokenResponse=
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def defaults
|
62
|
+
{
|
63
|
+
serviceApiKey: nil,
|
64
|
+
clientId: 0,
|
65
|
+
id: nil,
|
66
|
+
password: nil,
|
67
|
+
claims: nil,
|
68
|
+
claimsLocales: nil,
|
69
|
+
sns: nil,
|
70
|
+
accessToken: nil,
|
71
|
+
refreshToken: nil,
|
72
|
+
expiresIn: 0,
|
73
|
+
rawTokenResponse: nil
|
74
|
+
}
|
75
|
+
end
|
76
|
+
|
77
|
+
def set_params(hash)
|
78
|
+
@serviceApiKey = hash[:serviceApiKey]
|
79
|
+
@clientId = hash[:clientId]
|
80
|
+
@id = hash[:id]
|
81
|
+
@password = hash[:password]
|
82
|
+
@claims = hash[:claims]
|
83
|
+
@claimsLocales = hash[:claimsLocales]
|
84
|
+
@sns = hash[:sns]
|
85
|
+
@accessToken = hash[:accessToken]
|
86
|
+
@refreshToken = hash[:refreshToken]
|
87
|
+
@expiresIn = hash[:expiresIn]
|
88
|
+
@rawTokenResponse = hash[:rawTokenResponse]
|
81
89
|
end
|
82
90
|
|
83
|
-
|
84
|
-
|
91
|
+
public
|
92
|
+
|
85
93
|
def self.parse(json)
|
86
94
|
AuthenticationCallbackRequest.new(JSON.parse(json))
|
87
95
|
end
|
88
96
|
end
|
89
97
|
end
|
90
98
|
end
|
91
|
-
end
|
99
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# :nodoc:
|
2
2
|
#
|
3
|
-
# Copyright (C) 2014-
|
3
|
+
# Copyright (C) 2014-2020 Authlete, Inc.
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -15,94 +15,33 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
|
18
|
-
require 'set'
|
19
|
-
|
20
|
-
|
21
18
|
module Authlete
|
22
19
|
module Model
|
23
20
|
module Request
|
24
|
-
|
25
|
-
|
26
|
-
# This class represents a request to Authlete's /api/auth/authorization/fail API.
|
27
|
-
class AuthorizationFailRequest < Authlete::Model::Hashable
|
28
|
-
# The ticket issued by Authlete's /api/auth/authorization API. (String)
|
21
|
+
class AuthorizationFailRequest < Authlete::Model::Request::Base
|
22
|
+
|
29
23
|
attr_accessor :ticket
|
30
24
|
|
31
|
-
# The reason of the failure. (String)
|
32
25
|
attr_accessor :reason
|
33
26
|
|
34
|
-
# The custom description about the failure. (String)
|
35
27
|
attr_accessor :description
|
36
28
|
|
37
29
|
private
|
38
30
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
# Set default values to string attributes.
|
46
|
-
STRING_ATTRIBUTES.each do |attr|
|
47
|
-
send("#{attr}=", nil)
|
48
|
-
end
|
49
|
-
|
50
|
-
# Set attribute values using the given hash.
|
51
|
-
authlete_model_update(hash)
|
31
|
+
def defaults
|
32
|
+
{
|
33
|
+
ticket: nil,
|
34
|
+
reason: nil,
|
35
|
+
description: nil
|
36
|
+
}
|
52
37
|
end
|
53
38
|
|
54
|
-
def
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
def authlete_model_simple_attribute?(key)
|
59
|
-
STRING_ATTRIBUTES.include?(key)
|
60
|
-
end
|
61
|
-
|
62
|
-
def authlete_model_update(hash)
|
63
|
-
return if hash.nil?
|
64
|
-
|
65
|
-
hash.each do |key, value|
|
66
|
-
key = authlete_model_convert_key(key)
|
67
|
-
|
68
|
-
if authlete_model_simple_attribute?(key)
|
69
|
-
send("#{key}=", value)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
self
|
74
|
-
end
|
75
|
-
|
76
|
-
public
|
77
|
-
|
78
|
-
# Construct an instance from the given hash.
|
79
|
-
#
|
80
|
-
# If the given argument is nil or is not a Hash, nil is returned.
|
81
|
-
# Otherwise, AuthorizationFailRequest.new(hash) is returned.
|
82
|
-
def self.parse(hash)
|
83
|
-
if hash.nil? or (hash.kind_of?(Hash) == false)
|
84
|
-
return nil
|
85
|
-
end
|
86
|
-
|
87
|
-
return AuthorizationFailRequest.new(hash)
|
88
|
-
end
|
89
|
-
|
90
|
-
# Convert this object into a hash.
|
91
|
-
def to_hash
|
92
|
-
hash = {}
|
93
|
-
|
94
|
-
instance_variables.each do |var|
|
95
|
-
key = var.to_s.delete("@").to_sym
|
96
|
-
val = instance_variable_get(var)
|
97
|
-
|
98
|
-
if authlete_model_simple_attribute?(key) or val.nil?
|
99
|
-
hash[key] = val
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
hash
|
39
|
+
def set_params(hash)
|
40
|
+
@ticket = hash[:ticket]
|
41
|
+
@reason = hash[:reason]
|
42
|
+
@description = hash[:description]
|
104
43
|
end
|
105
44
|
end
|
106
45
|
end
|
107
46
|
end
|
108
|
-
end
|
47
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# :nodoc:
|
2
2
|
#
|
3
|
-
# Copyright (C) 2014-
|
3
|
+
# Copyright (C) 2014-2020 Authlete, Inc.
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -15,154 +15,73 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
|
18
|
-
require 'set'
|
19
|
-
|
20
|
-
|
21
18
|
module Authlete
|
22
19
|
module Model
|
23
20
|
module Request
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
class AuthorizationIssueRequest < Authlete::Model::Hashable
|
28
|
-
# The ticket issued by Authlete's /api/auth/authorization API. (String)
|
21
|
+
class AuthorizationIssueRequest < Authlete::Model::Request::Base
|
22
|
+
include Authlete::Utility
|
23
|
+
|
29
24
|
attr_accessor :ticket
|
30
25
|
|
31
|
-
# The subject (end-user) managed by the service. (String)
|
32
26
|
attr_accessor :subject
|
33
27
|
|
34
|
-
# The time when the end-user was authenticated. (Integer)
|
35
28
|
attr_accessor :authTime
|
36
29
|
alias_method :auth_time, :authTime
|
37
30
|
alias_method :auth_time=, :authTime=
|
38
31
|
|
39
|
-
# The authentication context class reference. (String)
|
40
32
|
attr_accessor :acr
|
41
33
|
|
42
|
-
# Claims in JSON format. (String)
|
43
34
|
attr_accessor :claims
|
44
35
|
|
45
|
-
# Extra properties to associate with an access token and/or an
|
46
|
-
# authorization code. (String)
|
47
36
|
attr_accessor :properties
|
48
37
|
|
49
|
-
# Scopes to associate with an access token and/or an authorization code.
|
50
|
-
# If a non-empty string array is given, it replaces the scopes specified
|
51
|
-
# by the original authorization request. (String array)
|
52
38
|
attr_accessor :scopes
|
53
39
|
|
54
|
-
# The value of the "sub" claim to embed in an ID token. If this request
|
55
|
-
# parameter is "nil" or empty, the value of the subject request parameter
|
56
|
-
# is used as the value of the "sub" claim. (String)
|
57
40
|
attr_accessor :sub
|
58
41
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
INTEGER_ATTRIBUTES = ::Set.new([ :authTime ])
|
63
|
-
|
64
|
-
# String attributes.
|
65
|
-
STRING_ATTRIBUTES = ::Set.new([ :ticket, :subject, :acr, :claims, :sub ])
|
66
|
-
|
67
|
-
# String array attributes.
|
68
|
-
STRING_ARRAY_ATTRIBUTES = ::Set.new([ :scopes ])
|
69
|
-
|
70
|
-
# Mapping from snake cases to camel cases.
|
71
|
-
SNAKE_TO_CAMEL = {
|
72
|
-
:auth_time => :authTime
|
73
|
-
}
|
74
|
-
|
75
|
-
# The constructor which takes a hash that represents a JSON request to
|
76
|
-
# Authlete's /api/auth/authorization/issue API.
|
77
|
-
def initialize(hash = nil)
|
78
|
-
# Set default values to integer attributes.
|
79
|
-
INTEGER_ATTRIBUTES.each do |attr|
|
80
|
-
send("#{attr}=", 0)
|
81
|
-
end
|
82
|
-
|
83
|
-
# Set default values to string attributes.
|
84
|
-
STRING_ATTRIBUTES.each do |attr|
|
85
|
-
send("#{attr}=", nil)
|
86
|
-
end
|
87
|
-
|
88
|
-
# Set default values to string array attributes.
|
89
|
-
STRING_ARRAY_ATTRIBUTES.each do |attr|
|
90
|
-
send("#{attr}=", nil)
|
91
|
-
end
|
92
|
-
|
93
|
-
@properties = nil
|
94
|
-
|
95
|
-
# Set attribute values using the given hash.
|
96
|
-
authlete_model_update(hash)
|
97
|
-
end
|
42
|
+
attr_accessor :idtHeaderParams
|
43
|
+
alias_method :idt_header_params, :idtHeaderParams
|
44
|
+
alias_method :idt_header_params=, :idtHeaderParams=
|
98
45
|
|
99
|
-
|
100
|
-
key = key.to_sym
|
101
|
-
|
102
|
-
# Convert snakecase to camelcase, if necessary.
|
103
|
-
if SNAKE_TO_CAMEL.has_key?(key)
|
104
|
-
key = SNAKE_TO_CAMEL[key]
|
105
|
-
end
|
106
|
-
|
107
|
-
key
|
108
|
-
end
|
109
|
-
|
110
|
-
def authlete_model_simple_attribute?(key)
|
111
|
-
INTEGER_ATTRIBUTES.include?(key) or
|
112
|
-
STRING_ATTRIBUTES.include?(key) or
|
113
|
-
STRING_ARRAY_ATTRIBUTES.include?(key)
|
114
|
-
end
|
115
|
-
|
116
|
-
def authlete_model_update(hash)
|
117
|
-
return if hash.nil?
|
118
|
-
|
119
|
-
hash.each do |key, value|
|
120
|
-
key = authlete_model_convert_key(key)
|
121
|
-
|
122
|
-
if authlete_model_simple_attribute?(key)
|
123
|
-
send("#{key}=", value)
|
124
|
-
elsif key == :properties
|
125
|
-
@properties = get_parsed_array(value) do |element|
|
126
|
-
Authlete::Model::Property.parse(element)
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
46
|
+
private
|
130
47
|
|
131
|
-
|
48
|
+
def defaults
|
49
|
+
{
|
50
|
+
ticket: nil,
|
51
|
+
subject: nil,
|
52
|
+
authTime: 0,
|
53
|
+
acr: nil,
|
54
|
+
claims: nil,
|
55
|
+
properties: nil,
|
56
|
+
scopes: nil,
|
57
|
+
sub: nil,
|
58
|
+
idtHeaderParams: nil
|
59
|
+
}
|
132
60
|
end
|
133
61
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
return AuthorizationIssueRequest.new(hash)
|
62
|
+
def set_params(hash)
|
63
|
+
@ticket = hash[:ticket]
|
64
|
+
@subject = hash[:subject]
|
65
|
+
@authTime = hash[:authTime]
|
66
|
+
@acr = hash[:acr]
|
67
|
+
@claims = hash[:claims]
|
68
|
+
@properties = get_parsed_array(hash[:properties]) { |e| Authlete::Model::Property.parse(e) }
|
69
|
+
@scopes = hash[:scopes]
|
70
|
+
@sub = hash[:sub]
|
71
|
+
@idtHeaderParams = hash[:idtHeaderParams]
|
146
72
|
end
|
147
73
|
|
148
|
-
|
149
|
-
|
150
|
-
hash = {}
|
74
|
+
def to_hash_value(key, var)
|
75
|
+
raw_val = instance_variable_get(var)
|
151
76
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
hash[key] = val
|
158
|
-
elsif key == :properties
|
159
|
-
hash[key] = val.map { |element| element.to_hash }
|
160
|
-
end
|
77
|
+
case key
|
78
|
+
when :properties
|
79
|
+
raw_val&.map { |e| e.to_hash }
|
80
|
+
else
|
81
|
+
raw_val
|
161
82
|
end
|
162
|
-
|
163
|
-
hash
|
164
83
|
end
|
165
84
|
end
|
166
85
|
end
|
167
86
|
end
|
168
|
-
end
|
87
|
+
end
|