msidp-endpoint 0.0.1 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da9217f4c3e53be7d57aea0a021671939445d7abe2aeac645948935900b8a289
4
- data.tar.gz: 01f12f461ef866dbd079c15fc504973d0aa83795e9ecf4d763bf5d3d758d4866
3
+ metadata.gz: 1c3063389a5690ccaabdb90a88d5b829e4d679c75535e557abcd2894b5b7423e
4
+ data.tar.gz: 496d1e0b37bd567c2c955f716360e451b8ce768454095a3746364a423c1ee2ec
5
5
  SHA512:
6
- metadata.gz: 42f07a9e6127d52203e646df3fc071e9e88ee9be8436eb04118762cc0756678a9d1918f56bb179dbd73a5d23c724a9139d27a1bf6b681cefe8633cbc791b88cf
7
- data.tar.gz: 7a5e4fd84a032765c5bf05556e08e43d3f63a29cce450d09343cb64aaeb11b2bbcc412f221541f55944a09a69e11be27d2c47086bc62b425398367e69bca3933
6
+ metadata.gz: 7f70b2959ca814ec3d3c967b46183b5f79d3c9ccf642a30929b741d6321f22da91b918b5937ec943086c94cf8647108916b515674c44e27213d35d6cf3f9d93b
7
+ data.tar.gz: c6f5d2f9e19039707aad84c62f7b863d4b93b2c03ea21a4a4208ec6571ecddd825b8659eccec51aff3b7ad137b3357b9e2f49dd641781bf96318679175737897
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 TODO: Write your name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # MSIDP::Endpoint
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/msidp-endpoint.svg)](https://badge.fury.io/rb/msidp-endpoint)
4
+ ![Ruby](https://github.com/simayosi/rb-msidp-endpoint/actions/workflows/test.yml/badge.svg)
5
+
6
+
7
+ A simple library for authentication endpoints of Microsoft identity platform.
8
+
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'msidp-endpoint'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle install
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install msidp-endpoint
25
+
26
+
27
+ ## Getting started
28
+
29
+ ### Preparation
30
+
31
+ Register your application.
32
+ See MS documents for details.
33
+
34
+ ### Usage example
35
+ Client using OAuth 2.0 authorization code grant.
36
+ ```ruby
37
+ require 'msidp/endpoint'
38
+
39
+ class Client
40
+ include MSIDP::Endpoint
41
+
42
+ def initialize
43
+ @tenant = 'tentant.example.com'
44
+ @auth_uri = authorize_uri(tenant)
45
+ @token_uri = token_uri(tenant)
46
+ @client_id = 'CLIENT-ID'
47
+ @client_secret = 'CLIENT-SECRET'
48
+ @redirect_uri = 'http://localhost/'
49
+ @scope = 'https://graph.microsoft.com/.default'
50
+ end
51
+
52
+ def access_authorize_page
53
+ params = {
54
+ client_id: @client_id, response_type: 'code',
55
+ redirect_uri: @redirect_uri, scope: @scope,
56
+ }
57
+ authorize(@auth_uri, params)
58
+ end
59
+
60
+ def get_token(code)
61
+ @params = {
62
+ code: code, client_id: @client_id, redirect_uri: @redirect_uri,
63
+ grant_type: 'authorization_code', client_secret: @client_secret
64
+ }
65
+ call_token(@uri, @params)
66
+ end
67
+ end
68
+
69
+ client = Client.new
70
+ response = client.access_authorize_page
71
+ # Get the code parameter of the query in the callback somehow.
72
+ token = client.get_token(code)
73
+
74
+ if token.valid? in: 3
75
+ auth_header = { 'Authorization' => "Bearer #{token}" }
76
+
77
+ # Request to a resource with the auth_header.
78
+ end
79
+ ```
80
+
81
+
82
+ ## API Reference
83
+ [RubyDoc.info](https://rubydoc.info/gems/msidp-endpoint)
84
+
85
+
86
+ ## License
87
+
88
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -2,6 +2,6 @@
2
2
 
3
3
  module MSIDP
4
4
  module Endpoint
5
- VERSION = '0.0.1'
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msidp-endpoint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - SHIMAYOSHI, Takao
@@ -17,6 +17,8 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - LICENSE.txt
21
+ - README.md
20
22
  - lib/msidp/access_token.rb
21
23
  - lib/msidp/endpoint.rb
22
24
  - lib/msidp/endpoint/version.rb
@@ -30,6 +32,7 @@ licenses:
30
32
  metadata:
31
33
  homepage_uri: https://github.com/simayosi/rb-msidp-endpoint
32
34
  source_code_uri: https://github.com/simayosi/rb-msidp-endpoint
35
+ documentation_uri: https://rubydoc.info/gems/msidp-endpoint
33
36
  post_install_message:
34
37
  rdoc_options: []
35
38
  require_paths: