Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@nov
Last active December 21, 2015 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nov/d760b78c5cce8248b308 to your computer and use it in GitHub Desktop.
Save nov/d760b78c5cce8248b308 to your computer and use it in GitHub Desktop.
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