Class: Masks::OpenID::UserInfoController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/masks/openid/userinfo_controller.rb

Instance Method Summary collapse

Methods included from Controller

#current_access, #current_actor, #current_mask, #masked_session

Instance Method Details

#showObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/masks/openid/userinfo_controller.rb', line 5

def show
  claims = { sub: openid_client.subject(current_actor) }

  if access_token.scope?("email")
    claims[:email] = current_actor.primary_email&.email
  end

  if access_token.scope?("phone")
    claims[:phone] = current_actor.phone_number
  end

  render json: OpenIDConnect::ResponseObject::UserInfo.new(claims)
end