From 19d0433119e60f5abe22a9b530f84f5c7feb33b2 Mon Sep 17 00:00:00 2001 From: Azul Date: Sat, 4 Feb 2017 08:39:40 +0100 Subject: [PATCH] feat: Allow specifying nonce and ttl for ticket --- lib/rbsso/server.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/rbsso/server.rb b/lib/rbsso/server.rb index 69f11f2..9d1d6a6 100644 --- a/lib/rbsso/server.rb +++ b/lib/rbsso/server.rb @@ -13,11 +13,16 @@ def initialize(secret) @key = RbNaCl::SigningKey.new seed_binary end - def ticket(user:, service:, domain:, nonce: nil) - auth = RbSSO::Authentication.new user: user, - service: service, - domain: domain, - nonce: nonce + # Create a ticket based on the authentication options. + # + # minimal example: + # sso_server.ticket user: username, service: service, domain: domain + # + # Other options: + # nonce: nonce identifying the client session. Send to server in params. + # ttl: time to live - number of seconds until the ticket expires. + def ticket(auth_options = {}) + auth = RbSSO::Authentication.new auth_options ticket = RbSSO::Ticket.sign auth, key return ticket.to_base64 end