Sha256: a9b76292256c46922988a9a0e8e5f2254b1c40cac8427767bb95c2a511fc7637

Contents?: true

Size: 782 Bytes

Versions: 5

Compression:

Stored size: 782 Bytes

Contents

# frozen_string_literal: true

require 'graphql'

module Osso
  module GraphQL
    module Types
      class OauthClient < Types::BaseObject
        description 'An OAuth client used to consume Osso SAML users'
        implements ::GraphQL::Types::Relay::Node

        global_id_field :gid
        field :id, ID, null: false
        field :name, String, null: false
        field :client_id, String, null: false
        field :client_secret, String, null: false
        field :redirect_uris, [Types::RedirectUri], null: true

        def client_id
          object.identifier
        end

        def client_secret
          object.secret
        end

        def self.authorized?(object, context)
          super && context[:scope] == :admin
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
osso-0.0.3.16 lib/osso/graphql/types/oauth_client.rb
osso-0.0.3.15 lib/osso/graphql/types/oauth_client.rb
osso-0.0.3.14 lib/osso/graphql/types/oauth_client.rb
osso-0.0.3.13 lib/osso/graphql/types/oauth_client.rb
osso-0.0.3.12 lib/osso/graphql/types/oauth_client.rb