browserid-provider 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/browserid-provider/provider.rb +14 -13
- data/lib/browserid-provider/version.rb +1 -1
- metadata +2 -2
@@ -63,6 +63,18 @@ module BrowserID
|
|
63
63
|
#
|
64
64
|
# We're going to certify that public key for the currently logged in user.
|
65
65
|
#
|
66
|
+
# The resulting data has to be a JSON object with the following document structure:
|
67
|
+
#
|
68
|
+
# {
|
69
|
+
# "iss": "example.com",
|
70
|
+
# "exp": "1313971280961",
|
71
|
+
# "public-key": "pubkey" data from the request (see above)
|
72
|
+
# "principal": {
|
73
|
+
# "email": "john@example.com"
|
74
|
+
# }
|
75
|
+
# }
|
76
|
+
#
|
77
|
+
# See https://github.com/mozilla/id-specs/blob/prod/browserid/index.md#identity-certificate for further reference.
|
66
78
|
def certify
|
67
79
|
email = current_user_email
|
68
80
|
return err "No user is logged in." unless email
|
@@ -73,25 +85,14 @@ module BrowserID
|
|
73
85
|
|
74
86
|
expiration = (Time.now.strftime("%s").to_i + params["duration"].to_i) * 1000
|
75
87
|
|
76
|
-
# Old certificate structure, changed to fit with https://github.com/mozilla/browserid-certifier/blob/master/bin/certifier#L51
|
77
|
-
# issue = {
|
78
|
-
# "principal" => { "email"=> email }
|
79
|
-
# "hostname" => issuer(email),
|
80
|
-
# "exp" => expiration,
|
81
|
-
# "public-key" => params["pubkey"],
|
82
|
-
# }
|
83
|
-
# issue = {
|
84
|
-
# "email"=> email,
|
85
|
-
# "pubkey" => params["pubkey"],
|
86
|
-
# "duration" => expiration,
|
87
|
-
# "hostname" => issuer(email)
|
88
|
-
# }
|
89
88
|
issue = {
|
90
89
|
"iss" => issuer(email),
|
91
90
|
"exp" => expiration,
|
91
|
+
"iat" => (Time.now.strftime("%s").to_i) * 1000,
|
92
92
|
"public-key" => JSON.parse(params["pubkey"]),
|
93
93
|
"principal" => { "email"=> email }
|
94
94
|
}
|
95
|
+
|
95
96
|
jwt = JSON::JWT.new(issue)
|
96
97
|
jws = jwt.sign(@identity.private_key, :RS256)
|
97
98
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: browserid-provider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json-jwt
|