Sha256: 504bc145be2babcd9bb88eaef695e5fef804efdfd07d27d822216c0749949c71

Contents?: true

Size: 719 Bytes

Versions: 2

Compression:

Stored size: 719 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

        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

2 entries across 2 versions & 1 rubygems

Version Path
osso-0.0.3.11 lib/osso/graphql/types/oauth_client.rb
osso-0.0.3.9 lib/osso/graphql/types/oauth_client.rb