Skip to content

Commit

Permalink
feat: Allow specifying nonce and ttl for ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
azul committed Feb 4, 2017
1 parent cdf5d4b commit 19d0433
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/rbsso/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 19d0433

Please sign in to comment.