Sha256: a8c2427525e4710c0cdf3bd0f762983c26a239c7010bd5d8df10696ef205c705

Contents?: true

Size: 555 Bytes

Versions: 3

Compression:

Stored size: 555 Bytes

Contents

require "omniauth-oauth2"
require "json"

class OmniAuth::Strategies::Gds < OmniAuth::Strategies::OAuth2
  uid { user["uid"] }

  info do
    {
      name: user["name"],
      email: user["email"],
    }
  end

  extra do
    {
      user: user,
      permissions: user["permissions"],
      organisation_slug: user["organisation_slug"],
      organisation_content_id: user["organisation_content_id"],
    }
  end

  def user
    @user ||= JSON.parse(access_token.get("/user.json?client_id=#{CGI.escape(options.client_id)}").body).fetch("user")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gds-sso-18.0.0 lib/omniauth/strategies/gds.rb
gds-sso-17.1.1 lib/omniauth/strategies/gds.rb
gds-sso-17.1.0 lib/omniauth/strategies/gds.rb