omniauth-dataporten 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/omniauth-dataporten/version.rb +1 -1
- data/lib/omniauth/strategies/dataporten.rb +43 -43
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5436c83fdcb9a36ca03294e9b783590ec9add317
|
4
|
+
data.tar.gz: 593708760bc52e5c71c4837b9cf9a67bf33d735c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39efe818d3e962f0060485a8e217bced26c565908f1518180156729883311f0b1a433be4a0def49972386fe675b05d3da2af4cc046e274f193086bb9076f83cf
|
7
|
+
data.tar.gz: 1abb696c0e32dc2f8f8ae57900f66db5e7e7eaa5fada07c61663363a4caaa9dc340df653af5ae3353f1694903cdf4cf03c09c9e0efa90dc4a5b5760a0eec08c1
|
@@ -1,47 +1,47 @@
|
|
1
1
|
require 'omniauth-oauth2'
|
2
2
|
|
3
3
|
module OmniAuth
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
4
|
+
module Strategies
|
5
|
+
class Dataporten < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, "dataporten"
|
7
|
+
|
8
|
+
option :client_options, {
|
9
|
+
site: "https://auth.dataporten.no",
|
10
|
+
authorize_url: "/oauth/authorization",
|
11
|
+
token_url: "/oauth/token"
|
12
|
+
}
|
13
|
+
|
14
|
+
option :redirect_url
|
15
|
+
|
16
|
+
uid { raw_info['user']['userid'] }
|
17
|
+
|
18
|
+
info do
|
19
|
+
{
|
20
|
+
name: raw_info['user']['name'],
|
21
|
+
username: raw_info['user']['userid'],
|
22
|
+
email: raw_info['user']['email'],
|
23
|
+
image: raw_info['user']['profilepicture']
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
extra do
|
28
|
+
{ raw_info: raw_info }
|
29
|
+
end
|
30
|
+
|
31
|
+
def raw_info
|
32
|
+
@raw_info ||= access_token.get('/userinfo').parsed
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def callback_url
|
38
|
+
full_host + script_name + callback_path
|
39
|
+
end
|
40
|
+
|
41
|
+
#def request_phase
|
42
|
+
# options[:response_type] ||= 'code'
|
43
|
+
# super
|
44
|
+
#end
|
45
|
+
end
|
46
|
+
end
|
46
47
|
end
|
47
|
-
|