Last active
August 29, 2015 14:16
-
-
Save mneil/11c9d355ea8c39e186ba to your computer and use it in GitHub Desktop.
Muut Ruby Federated Identites Example
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
@user = { | |
:user => { | |
:id => 'johndoe', # required | |
:displayname => 'John Doe', # required | |
:email => '[email protected]', | |
:avatar => '//gravatar.com/avatar/e5fb96fe7ec4ac3d4fa675422f8d1fb9', | |
:is_admin => true | |
} | |
} | |
require 'digest/sha1' | |
require 'base64' | |
require 'json' | |
# timestamp (in seconds). Improves security. | |
@timestamp = Time.now.to_i | |
# Message (base64 encoded string) | |
@message = Base64.strict_encode64 @user.to_json | |
# Signature (signed with private key) | |
@signature = Digest::SHA1.hexdigest "ocUxp5e20qOb7hP5Dm7j5emH #{@message} #{@timestamp}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment