Last active
December 21, 2015 06:25
-
-
Save nov/d760b78c5cce8248b308 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json/jwt' | |
rsa_key = OpenSSL::PKey::RSA.new <<-PEM | |
: | |
PEM | |
claims = { | |
iss: 'https://auth.server.example.com', | |
sub: 'user-98765', | |
aud: [ | |
'client-12345#native-app', | |
'client-12345#backend-server' | |
], | |
azp: 'client-12345#native-app', | |
scopes: [ | |
'email', | |
'profile', | |
'status/read', | |
'status/write' | |
], | |
may_act: { | |
iss: 'https://auth.server.example.com', | |
sub: 'client-12345#backend-server' | |
}, | |
cnf: { | |
code_challange: 'E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM', | |
code_challange_method: :S256 | |
}, | |
exp: 1.hours.from_now, | |
iat: Time.now | |
} | |
id_token = JSON::JWT.new(claims).sign rsa_key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment