omniauth-musicbrainz 0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ed0cc06120797d80b0c978fab6a595acb4e2872963add13ef06af8515367664a
4
+ data.tar.gz: 5b352dd7811080266ad285e424c0b6e9f9d11401e6ee8a199df63762e382664a
5
+ SHA512:
6
+ metadata.gz: cb263922dbb931ab3e96a2e33213142832f7151e9ca80cb3368feedb1ba58cc1510ff5f2ed2e860f22b7ee6f250c6e3391e1a08cf770a94fffbbb3ef86cbe261
7
+ data.tar.gz: d4652cfa320609410cd18757760f1a674f6f3a4db35563f19b126235e955ed04144045b48376410e09831465a44522ceac41a3095dc556c68e9bccca625ba753
@@ -0,0 +1,67 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2023 Philipp Wolfer <ph.wolfer@gmail.com>
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
+ # The above copyright notice and this permission notice shall be included in
12
+ # all copies or substantial portions of the Software.
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require 'omniauth-oauth2'
22
+
23
+ module OmniAuth
24
+ module Strategies
25
+ class Musicbrainz < ::OmniAuth::Strategies::OAuth2
26
+ option :name, :musicbrainz
27
+
28
+ option :scope, "profile email"
29
+
30
+ option :client_options, {
31
+ :site => 'https://musicbrainz.org',
32
+ :authorize_url => '/oauth2/authorize',
33
+ :token_url => '/oauth2/token'
34
+ }
35
+
36
+ option :provider_ignores_state, true
37
+
38
+ option :user_info_url, '/oauth2/userinfo'
39
+
40
+ uid{ raw_info['metabrainz_user_id'] }
41
+
42
+ info do
43
+ {
44
+ :nickname => raw_info['sub'],
45
+ :name => raw_info['sub'],
46
+ :email => raw_info['email'],
47
+ :email_verified => raw_info['email_verified'],
48
+ }
49
+ end
50
+
51
+ extra do
52
+ {
53
+ 'raw_info' => raw_info
54
+ }
55
+ end
56
+
57
+ def raw_info
58
+ @raw_info ||= access_token.get(options.user_info_url).parsed
59
+ end
60
+
61
+ def callback_url
62
+ # Workaround for https://github.com/omniauth/omniauth-oauth2/issues/93
63
+ full_host + script_name + callback_path
64
+ end
65
+ end
66
+ end
67
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-musicbrainz
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Philipp Wolfer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-01-27 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: OmniAuth authentication provider to allow login with a MusicBrainz account
14
+ via OAuth 2
15
+ email:
16
+ - ph.wolfer@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/omniauth/strategies/omniauth-musicbrainz.rb
22
+ homepage: https://git.sr.ht/~phw/omniauth-musicbrainz
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubygems_version: 3.3.15
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: MusicBrainz authentication provider for OmniAuth
45
+ test_files: []