Sha256: 37a83b7a41bc7b5b36684818866a524bb6ce550b7b9ba9743101f33a05dc8886

Contents?: true

Size: 1.75 KB

Versions: 4

Compression:

Stored size: 1.75 KB

Contents

# 管理模块
require_relative './ManagementTokenProvider.rb'
require_relative './UsersManagementClient.rb'
require_relative './ApplicationsManagementClient.rb'
require_relative './AclManagementClient.rb'
require_relative './UserpoolManagementClient.rb'
require_relative './RolesManagementClient.rb'

module AuthingRuby
  class ManagementClient
    
    def initialize(options = {})
      @userPoolId = options.fetch(:userPoolId, nil)
      @secret = options.fetch(:secret, nil)
      @appId = options.fetch(:appId, nil)
      @host = options.fetch(:host, 'https://core.authing.cn')
      @accessToken = options.fetch(:accessToken, nil)
      
      if @userPoolId == nil && @appId == nil
        raise '请提供 userPoolId 或 appId!'
      end

      graphqlApiEndpointV2 = "#{@host}/graphql/v2"
      @graphqlClient = AuthingRuby::Common::GraphqlClient.new(graphqlApiEndpointV2, options)
      @tokenProvider = AuthingRuby::ManagementTokenProvider.new(options, @graphqlClient)
      @httpClient = AuthingRuby::Common::HttpClient.new(options, @tokenProvider)
      @publicKeyManager = AuthingRuby::Common::PublicKeyManager.new(options)

      @users = AuthingRuby::UsersManagementClient.new(
        options,
        @graphqlClient,
        @httpClient,
        @tokenProvider,
        @publicKeyManager
      );

      @applications = AuthingRuby::ApplicationsManagementClient.new(
        options,
        @httpClient,
        @graphqlClient,
        @tokenProvider,
      );

      @acl = AuthingRuby::AclManagementClient.new(
        options,
        @httpClient,
        @graphqlClient,
        @tokenProvider,
      );

    end

    def users
      return @users
    end

    def applications
      return @applications
    end

    def acl
      return @acl
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
authing_ruby-1.1.6 lib/authing_ruby/management/ManagementClient.rb
authing_ruby-1.1.5 lib/authing_ruby/management/ManagementClient.rb
authing_ruby-1.1.4 lib/authing_ruby/management/ManagementClient.rb
authing_ruby-1.1.3 lib/authing_ruby/management/ManagementClient.rb