gs2-ruby-sdk-auth 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.buildpath +5 -0
- data/.gitignore +10 -0
- data/.project +17 -0
- data/Gemfile +5 -0
- data/README.md +2 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/gs2-ruby-sdk-auth.gemspec +25 -0
- data/lib/gs2/auth/Client.rb +75 -0
- data/lib/gs2/auth/version.rb +5 -0
- data/lib/gs2-auth.rb +1 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ec6bf5199204652bc78e1567424e82b6761941e4
|
4
|
+
data.tar.gz: a36a2f1a25d56d677d02fb40f05b0595f6c014cf
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 00f325dfabe9aef07325a2bd2469e5bd0466fb167ce3153dd29a1fd6d0c4228510489f261745848ff8cc18ea51ee260fa6b53fd329c1d025d3baa62cbfae1738
|
7
|
+
data.tar.gz: 994ca5248e0755e7df92368a21c60a524f44322e476e10bcd79094fed1150577f3fb9029f4b71c2b1360e10a9bb13205abe036b58330a3b5dd1a7365772959dc
|
data/.buildpath
ADDED
data/.gitignore
ADDED
data/.project
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<projectDescription>
|
3
|
+
<name>gs2-ruby-sdk-auth</name>
|
4
|
+
<comment></comment>
|
5
|
+
<projects>
|
6
|
+
</projects>
|
7
|
+
<buildSpec>
|
8
|
+
<buildCommand>
|
9
|
+
<name>org.eclipse.dltk.core.scriptbuilder</name>
|
10
|
+
<arguments>
|
11
|
+
</arguments>
|
12
|
+
</buildCommand>
|
13
|
+
</buildSpec>
|
14
|
+
<natures>
|
15
|
+
<nature>org.eclipse.dltk.ruby.core.nature</nature>
|
16
|
+
</natures>
|
17
|
+
</projectDescription>
|
data/Gemfile
ADDED
data/README.md
ADDED
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "gs2/sdk/for/ruby/auth"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gs2/auth/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "gs2-ruby-sdk-auth"
|
8
|
+
spec.version = Gs2::Auth::VERSION
|
9
|
+
spec.authors = ["Game Server Services, Inc."]
|
10
|
+
spec.email = ["contact@gs2.io"]
|
11
|
+
spec.licenses = "Apache-2.0"
|
12
|
+
|
13
|
+
spec.summary = %q{Game Server Services GS2-Auth Client Library}
|
14
|
+
spec.homepage = "https://gs2.io/"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "gs2-ruby-sdk-core", "~> 0.0.1"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'gs2/core/AbstractClient.rb'
|
2
|
+
|
3
|
+
module Gs2 module Auth
|
4
|
+
|
5
|
+
# GS2-Auth クライアント
|
6
|
+
#
|
7
|
+
# @author Game Server Services, Inc.
|
8
|
+
class Client < Gs2::Core::AbstractClient
|
9
|
+
|
10
|
+
@@ENDPOINT = 'auth'
|
11
|
+
|
12
|
+
# コンストラクタ
|
13
|
+
#
|
14
|
+
# @param region [String] リージョン名
|
15
|
+
# @param gs2_client_id [String] GSIクライアントID
|
16
|
+
# @param gs2_client_secret [String] GSIクライアントシークレット
|
17
|
+
def initialize(region, gs2_client_id, gs2_client_secret)
|
18
|
+
super(region, gs2_client_id, gs2_client_secret)
|
19
|
+
end
|
20
|
+
|
21
|
+
# デバッグ用。通常利用する必要はありません。
|
22
|
+
def self.ENDPOINT(v = nil)
|
23
|
+
if v
|
24
|
+
@@ENDPOINT = v
|
25
|
+
else
|
26
|
+
return @@ENDPOINT
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# ログイン。<br>
|
31
|
+
# <br>
|
32
|
+
# GS2のサービスを利用するにあたってユーザの認証に必要となるアクセストークンを発行します。<br>
|
33
|
+
# アクセストークンの発行には以下の情報が必要となります。<br>
|
34
|
+
#
|
35
|
+
# * ユーザID
|
36
|
+
# * サービスID
|
37
|
+
#
|
38
|
+
# ユーザID には ログインするユーザのIDを指定してください。<br>
|
39
|
+
# GS2 はアカウント管理機能を持ちませんので、ユーザID は別途アカウント管理システムで発行したIDを指定する必要があります。<br>
|
40
|
+
# アカウントIDの文字種などには制限はありません。<br>
|
41
|
+
# <br>
|
42
|
+
# サービスID には任意の文字列を指定できます。<br>
|
43
|
+
# ここで指定したサービスIDにもとづいて、その後アクセストークンで利用できるGSIを制限するのに利用します。<br>
|
44
|
+
# <br>
|
45
|
+
# サービスの制限は GSI(AWSのIAMのようなもの) のセキュリティポリシーで設定することができます。<br>
|
46
|
+
# 例えば、GSIに設定されたセキュリティポリシーが service-0001 によるアクセスを許可する。という設定の場合、<br>
|
47
|
+
# service-0002 というサービスIDで発行されたアクセストークンとGSIの組み合わせでリクエストを出してもリジェクトされるようになります。<br>
|
48
|
+
# <br>
|
49
|
+
# これによって、下記のようなアクセスコントロールを同一アカウント内で実現できます。<br>
|
50
|
+
#
|
51
|
+
# * GSI(A) 許可するアクション(GS2Inbox:*) 許可するサービス(service-0001)
|
52
|
+
# * GSI(B) 許可するアクション(GS2Stamina:*) 許可するサービス(service-0002)
|
53
|
+
#
|
54
|
+
# この場合、service-0001 向けに発行されたアクセストークンと GSI(B) の組み合わせではサービスを利用することはできません。<br>
|
55
|
+
# そのため、service-0001 向けのアクセストークンでは GS2-Stamina を利用することはできないことになります。<br>
|
56
|
+
#
|
57
|
+
# @param request [Array]
|
58
|
+
# * serviceId => サービスID
|
59
|
+
# * userId => ユーザID
|
60
|
+
def login(request)
|
61
|
+
if not request; raise ArgumentError.new(); end
|
62
|
+
body = {};
|
63
|
+
if request.has_key?('serviceId'); body['serviceId'] = request['serviceId']; end
|
64
|
+
if request.has_key?('userId'); body['userId'] = request['userId']; end
|
65
|
+
query = {};
|
66
|
+
return post(
|
67
|
+
'Gs2Auth',
|
68
|
+
'Login',
|
69
|
+
@@ENDPOINT,
|
70
|
+
'/login',
|
71
|
+
body,
|
72
|
+
query);
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end end
|
data/lib/gs2-auth.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'gs2/auth/Client.rb'
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gs2-ruby-sdk-auth
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Game Server Services, Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-10-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: gs2-ruby-sdk-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.0.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.0.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.12'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.12'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- contact@gs2.io
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".buildpath"
|
63
|
+
- ".gitignore"
|
64
|
+
- ".project"
|
65
|
+
- Gemfile
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/console
|
69
|
+
- bin/setup
|
70
|
+
- gs2-ruby-sdk-auth.gemspec
|
71
|
+
- lib/gs2-auth.rb
|
72
|
+
- lib/gs2/auth/Client.rb
|
73
|
+
- lib/gs2/auth/version.rb
|
74
|
+
homepage: https://gs2.io/
|
75
|
+
licenses:
|
76
|
+
- Apache-2.0
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.5.1
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Game Server Services GS2-Auth Client Library
|
98
|
+
test_files: []
|