riddl 0.99.213 → 0.99.214
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 327de3f2646080a6f91f901abbc02cdc60397c5c
|
4
|
+
data.tar.gz: 0c5ec7bf74dbfa4e0d3870db9c9086ebfda91a5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 361ac4490ae77ed21010205b350e51c16ddfae03a3a09f6ae96ab2d92ebedac52db4eb325a6eedb47ee4bc1e0b5fd2864627195bb6dd7201bdc6a5be1c4fa325
|
7
|
+
data.tar.gz: fb85cecb2795fb1e50eb90caa03d4ac03a7ac9cb0c1accb02317d605e6ce3f5a0227f475007e25bd3bc1520011cc2823739d8c8f40cabd7f98377f9f8da95252
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<description datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://riddl.org/ns/description/1.0" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:doc="http://riddl.org/ns/documentation/1.0">
|
2
|
+
|
3
|
+
<resource>
|
4
|
+
<get pass="*"/>
|
5
|
+
</resource>
|
6
|
+
|
7
|
+
</description>
|
@@ -3,6 +3,68 @@ require File.expand_path(File.dirname(__FILE__) + '/oauth2-helper')
|
|
3
3
|
module Riddl
|
4
4
|
module Utils
|
5
5
|
module OAuth2
|
6
|
+
|
7
|
+
module UnivieBearer
|
8
|
+
def self::implementation(client_id, client_secret, access_tokens)
|
9
|
+
unless access_tokens.is_a?(Riddl::Utils::OAuth2::Helper::Tokens) client_id.is_a?(String) && client_secret.is_a?(String)
|
10
|
+
raise "client_id, client_secret or token storage not available."
|
11
|
+
end
|
12
|
+
Proc.new do
|
13
|
+
run CheckAuth, client_id, client_secret, access_tokens if get
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class CheckAuth < Riddl::Implementation
|
18
|
+
def response
|
19
|
+
client_id = @a[0]
|
20
|
+
client_secret = @a[1]
|
21
|
+
access_tokens = @a[2]
|
22
|
+
if @h['AUTHORIZATION']
|
23
|
+
token = @h['AUTHORIZATION'].sub(/^Bearer /, '')
|
24
|
+
|
25
|
+
data, _, signature = token.rpartition '.'
|
26
|
+
expected_sign = Riddl::Utils::OAuth2::Helper::sign(client_id + ':' + client_secret, data)
|
27
|
+
|
28
|
+
if !access_tokens.key? token
|
29
|
+
@status = 403
|
30
|
+
return Riddl::Parameter::Complex.new('data', 'application/json', {
|
31
|
+
:error => 'Unknown token'
|
32
|
+
}.to_json)
|
33
|
+
elsif signature != expected_sign
|
34
|
+
@status = 403
|
35
|
+
return Riddl::Parameter::Complex.new('data', 'application/json', {
|
36
|
+
:error => 'Invalid token, you bad boy'
|
37
|
+
}.to_json)
|
38
|
+
end
|
39
|
+
|
40
|
+
header_claims, payload_claims = data.split('.').map { |v| Base64::urlsafe_decode64 v }
|
41
|
+
payload_claims = JSON::parse payload_claims
|
42
|
+
|
43
|
+
if header_claims != Riddl::Utils::OAuth2::Helper::header
|
44
|
+
@status = 401
|
45
|
+
return Riddl::Parameter::Complex.new('data', 'application/json', {
|
46
|
+
:error => 'Invalid header claims'
|
47
|
+
}.to_json)
|
48
|
+
elsif payload_claims['exp'] <= Time.now.to_i
|
49
|
+
@status = 403
|
50
|
+
return Riddl::Parameter::Complex.new('data', 'application/json', {
|
51
|
+
:error => 'Expired token'
|
52
|
+
}.to_json)
|
53
|
+
elsif !payload_claims['aud'].split(',').map(&:strip).include? client_id
|
54
|
+
# XXX: ein token für mehrere clients gültig? lookup?
|
55
|
+
@status = 403
|
56
|
+
return Riddl::Parameter::Complex.new('data', 'application/json', {
|
57
|
+
:error => 'Token is not valid for this application'
|
58
|
+
}.to_json)
|
59
|
+
end
|
60
|
+
|
61
|
+
@headers << Riddl::Header.new('AUTHORIZATION_BEARER', access_tokens[token])
|
62
|
+
end
|
63
|
+
|
64
|
+
@p
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
6
68
|
|
7
69
|
module UnivieApp
|
8
70
|
def self::implementation(client_id, client_secret, access_tokens, refresh_tokens)
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<description datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://riddl.org/ns/description/1.0" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:doc="http://riddl.org/ns/documentation/1.0">
|
2
|
+
|
3
|
+
<resource>
|
4
|
+
<get pass="*"/>
|
5
|
+
</resource>
|
6
|
+
|
7
|
+
</description>
|
data/riddl.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riddl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.99.
|
4
|
+
version: 0.99.214
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen 'eTM' Mangler
|
@@ -401,6 +401,7 @@ files:
|
|
401
401
|
- lib/ruby/riddl/ns/common-patterns/notifications-consumer/1.0/consumer.xml
|
402
402
|
- lib/ruby/riddl/ns/common-patterns/notifications-producer/1.0/producer.xml
|
403
403
|
- lib/ruby/riddl/ns/common-patterns/oauth2-univie-app/1.0/app.xml
|
404
|
+
- lib/ruby/riddl/ns/common-patterns/oauth2-univie-app/1.0/bearer.xml
|
404
405
|
- lib/ruby/riddl/ns/common-patterns/properties/1.0/properties.schema.schema
|
405
406
|
- lib/ruby/riddl/ns/common-patterns/properties/1.0/properties.schema.xsl
|
406
407
|
- lib/ruby/riddl/ns/common-patterns/properties/1.0/properties.xml
|
@@ -434,7 +435,7 @@ files:
|
|
434
435
|
- lib/ruby/riddl/utils/fileserve.rb
|
435
436
|
- lib/ruby/riddl/utils/notifications_producer.rb
|
436
437
|
- lib/ruby/riddl/utils/oauth2-helper.rb
|
437
|
-
- lib/ruby/riddl/utils/oauth2-univie
|
438
|
+
- lib/ruby/riddl/utils/oauth2-univie.rb
|
438
439
|
- lib/ruby/riddl/utils/properties.rb
|
439
440
|
- lib/ruby/riddl/utils/turtle.rb
|
440
441
|
- lib/ruby/riddl/utils/xmlserve.rb
|
@@ -457,6 +458,7 @@ files:
|
|
457
458
|
- ns/common-patterns/notifications-consumer/1.0/consumer.xml
|
458
459
|
- ns/common-patterns/notifications-producer/1.0/producer.xml
|
459
460
|
- ns/common-patterns/oauth2-univie-app/1.0/app.xml
|
461
|
+
- ns/common-patterns/oauth2-univie-app/1.0/bearer.xml
|
460
462
|
- ns/common-patterns/properties/1.0/properties.schema.schema
|
461
463
|
- ns/common-patterns/properties/1.0/properties.schema.xsl
|
462
464
|
- ns/common-patterns/properties/1.0/properties.xml
|