Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/representers/api/v1/sso_cookie_representer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Api::V1
class SsoCookieRepresenter < Roar::Decorator
include Roar::JSON

property :name,
type: String,
readable: true,
writeable: false

property :uuid,
type: String,
readable: true,
writeable: false
end
end
2 changes: 1 addition & 1 deletion lib/sso_cookie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module SsoCookie
@encryption_method = secrets[:encryption_method]

def self.user_hash(user)
Api::V1::UserRepresenter.new(user).to_hash
Api::V1::SsoCookieRepresenter.new(user).to_hash
end

# This method is used in 2 different ways:
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/api/v1/users_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@

sso_cookie = parsed_response['sso']
sso_hash = SsoCookie.read sso_cookie
expect(sso_hash['sub']).to eq Api::V1::UserRepresenter.new(new_user).to_hash
expect(sso_hash['sub']).to eq Api::V1::SsoCookieRepresenter.new(new_user).to_hash
expect(sso_hash['exp']).to be <= (
Time.current + Api::V1::UsersController::SSO_TOKEN_INITIAL_DURATION
).to_i
Expand Down
Loading