omniauth-authentiq 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +14 -0
- data/LICENSE +9 -0
- data/README.md +86 -0
- data/Rakefile +2 -0
- data/lib/omniauth-authentiq.rb +1 -0
- data/lib/omniauth/authentiq.rb +2 -0
- data/lib/omniauth/authentiq/version.rb +5 -0
- data/lib/omniauth/strategies/authentiq.rb +67 -0
- data/omniauth-authentiq.gemspec +23 -0
- metadata +76 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b28a91a7f6540ec06b1051da196b6413763ce990
|
4
|
+
data.tar.gz: 1d1830421c3acada67bf619a31150ce43b9f7fe6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cc16ad25d149ec3a1da94b0997f5db6186f1e5479f18c9febf586ada508c3d5ff87e1181909f4f67f1267201eeb5a59e1e32849d7136da7dbecef99a6d64ca9c
|
7
|
+
data.tar.gz: 963a03d4e6aff5d669c79da74c8c3d46a49dd27ab24c7c861fa8199a609df1119712c17977ed5e0243022020397c4c51fd175ef627cc6dcfbcbbb1c9d7640c98
|
data/.gitignore
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
/.bundle/
|
2
|
+
.idea/
|
3
|
+
/_yardoc/
|
4
|
+
/coverage/
|
5
|
+
/doc/
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/tmp/
|
9
|
+
/test/
|
10
|
+
/bin/
|
11
|
+
/.yardoc
|
12
|
+
/Gemfile.lock
|
13
|
+
*.rbc
|
14
|
+
.config
|
15
|
+
InstalledFiles
|
16
|
+
lib/bundler/man
|
17
|
+
rdoc
|
18
|
+
omniauth-authentiq-0.2.0.gem
|
19
|
+
omniauth-authentiq-0.2.1.gem
|
20
|
+
.ruby-version
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at dev.alexkeramidas@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2016 Authentiq BV
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# OmniAuth Authentiq
|
2
|
+
|
3
|
+
Official OmniAuth strategy for authenticating with AuthentiqID. Sign up for [Authentiq](https://www.authentiq.com/register/?utm_source=github&utm_medium=readme&utm_campaign=omniauth) to obtain your application credentials.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile (local path for now as it is not on rubygems repo):
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'omniauth-authentiq', '~> 0.2.0', :git => 'https://gitlab.com/authentiq/omniauth-authentiq.git'
|
11
|
+
```
|
12
|
+
|
13
|
+
Then bundle:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
# Basic Usage
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
use OmniAuth::Builder do
|
21
|
+
provider :authentiq, ENV['AUTHENTIQ_KEY'], ENV['AUTHENTIQ_SECRET']
|
22
|
+
end
|
23
|
+
```
|
24
|
+
|
25
|
+
# Scopes
|
26
|
+
|
27
|
+
Authentiq gives you the capability to request various data from the user. This is done by adding the scope parameters to the basic usage. If not added, the default scopes are Name, Email and Phone. Other available options are display and redirect uri. Also you can configure the endpoint the gem uses
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
use OmniAuth::Builder do
|
31
|
+
provider :authentiq, ENV['AUTHENTIQ_KEY'], ENV['AUTHENTIQ_SECRET'],
|
32
|
+
scope: 'aq:name email~r aq:push',
|
33
|
+
display: 'modal',
|
34
|
+
redirect_uri: 'redirect_uri',
|
35
|
+
client_options: {
|
36
|
+
site: 'authentiq endpoint'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
Available scopes are:
|
42
|
+
|
43
|
+
- `aq:name` for Name
|
44
|
+
- `email` for Email
|
45
|
+
- `phone` for Phone
|
46
|
+
- `address` for Address
|
47
|
+
- `aq:location` for Location
|
48
|
+
- `aq:push`
|
49
|
+
- `aq:link`
|
50
|
+
|
51
|
+
# Gitlab installation usage
|
52
|
+
|
53
|
+
After adding the gem to your gemfile.
|
54
|
+
|
55
|
+
## Development Installation
|
56
|
+
|
57
|
+
To use the gem in a GitLab development installation enable the omniauth functionality and add the configuration to you gitlab.rb.
|
58
|
+
|
59
|
+
```yaml
|
60
|
+
- {
|
61
|
+
name: 'authentiq',
|
62
|
+
app_id: ENV['AUTHENTIQ_KEY'],
|
63
|
+
app_secret: ENV['AUTHENTIQ_SECRET'],
|
64
|
+
args: {
|
65
|
+
scope: 'aq:name email~r aq:push',
|
66
|
+
display: 'modal',
|
67
|
+
redirect_uri: '<<your_redirect_uri>>',
|
68
|
+
client_options: {
|
69
|
+
site: 'https://connect.authentiq.io/'
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
```
|
74
|
+
|
75
|
+
## Omnibus Installation
|
76
|
+
|
77
|
+
To use the gem in a GitLab Omnibus installation follow this link for general omniauth instructions http://docs.gitlab.com/ce/integration/omniauth.html
|
78
|
+
|
79
|
+
## Tests
|
80
|
+
|
81
|
+
Tests are coming soon.
|
82
|
+
|
83
|
+
## Contributing
|
84
|
+
|
85
|
+
Bug reports and pull requests are welcome on GitHub at https://gitlab.com/authentiq/omniauth-authentiq.
|
86
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'omniauth/authentiq'
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Authentiq < OmniAuth::Strategies::OAuth2
|
6
|
+
#Set the base URL
|
7
|
+
BASE_URL = 'https://connect.authentiq.io/'
|
8
|
+
|
9
|
+
# Authentiq strategy name
|
10
|
+
option :name, 'authentiq'
|
11
|
+
|
12
|
+
# Build the basic client options (url, authorization url, token url)
|
13
|
+
option :client_options, {
|
14
|
+
:site => BASE_URL,
|
15
|
+
:authorize_url => '/authorize',
|
16
|
+
:token_url => '/token'
|
17
|
+
}
|
18
|
+
|
19
|
+
# Get options from parameters
|
20
|
+
option :authorize_options, [:scope, :display]
|
21
|
+
|
22
|
+
# These are called after authentication has succeeded. If
|
23
|
+
# possible, you should try to set the UID without making
|
24
|
+
# additional calls (if the user id is returned with the token
|
25
|
+
# or as a URI parameter). This may not be possible with all
|
26
|
+
# providers.
|
27
|
+
|
28
|
+
# Get the user id from raw info
|
29
|
+
uid { raw_info['sub'] }
|
30
|
+
|
31
|
+
info do
|
32
|
+
{
|
33
|
+
:name => (@raw_info['name'] unless @raw_info['name'].nil?),
|
34
|
+
:first_name => (@raw_info['given_name'] unless @raw_info['given_name'].nil?),
|
35
|
+
:last_name => (@raw_info['family_name'] unless @raw_info['family_name'].nil?),
|
36
|
+
:email => (@raw_info['email'] unless @raw_info['email'].nil?),
|
37
|
+
:phone => (@raw_info['phone_number'] unless @raw_info['phone_number'].nil?),
|
38
|
+
:location => (@raw_info['address'] unless @raw_info['address'].nil?),
|
39
|
+
:geolocation => (@raw_info['location'] unless @raw_info['location'].nil?)
|
40
|
+
}.reject { |k, v| v.nil? }
|
41
|
+
end
|
42
|
+
|
43
|
+
extra do
|
44
|
+
{
|
45
|
+
:middle_name => (@raw_info['middle_name'] unless @raw_info['middle_name'].nil?),
|
46
|
+
:email_verified => (@raw_info['email_verified'] unless @raw_info['email_verified'].nil?),
|
47
|
+
:phone_type => (@raw_info['phone_type'] unless @raw_info['phone_type'].nil?),
|
48
|
+
:phone_number_verified => (@raw_info['phone_number_verified'] unless @raw_info['phone_number_verified'].nil?),
|
49
|
+
:locale => (@raw_info['locale'] unless @raw_info['locale'].nil?)
|
50
|
+
}.reject { |k, v| v.nil? }
|
51
|
+
end
|
52
|
+
|
53
|
+
def raw_info
|
54
|
+
@raw_info ||= access_token.get('/userinfo').parsed
|
55
|
+
end
|
56
|
+
|
57
|
+
# Over-ride callback_url definition to maintain
|
58
|
+
# compatibility with omniauth-oauth2 >= 1.4.0
|
59
|
+
#
|
60
|
+
# See: https://github.com/intridea/omniauth-oauth2/issues/81
|
61
|
+
def callback_url
|
62
|
+
# Fixes regression in omniauth-oauth2 v1.4.0 by https://github.com/intridea/omniauth-oauth2/commit/85fdbe117c2a4400d001a6368cc359d88f40abc7
|
63
|
+
options[:callback_url] || (full_host + script_name + callback_path)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth/authentiq/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "omniauth-authentiq"
|
8
|
+
spec.version = OmniAuth::Authentiq::VERSION
|
9
|
+
spec.authors = ["Alexandros Keramidas"]
|
10
|
+
spec.email = ["alex@authentiq.com", "support@authentiq.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Authentiq strategy for OmniAuth}
|
13
|
+
spec.description = %q{Strategy to enable passwordless authentication in OmniAuth via Authentiq.}
|
14
|
+
spec.homepage = "https://github.com/AuthentiqID/omniauth-authentiq"
|
15
|
+
spec.licenses = %w(MIT)
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.3', '>= 1.3.1'
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-authentiq
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexandros Keramidas
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-12-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omniauth-oauth2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.3.1
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.3'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.3.1
|
33
|
+
description: Strategy to enable passwordless authentication in OmniAuth via Authentiq.
|
34
|
+
email:
|
35
|
+
- alex@authentiq.com
|
36
|
+
- support@authentiq.com
|
37
|
+
executables: []
|
38
|
+
extensions: []
|
39
|
+
extra_rdoc_files: []
|
40
|
+
files:
|
41
|
+
- ".gitignore"
|
42
|
+
- CODE_OF_CONDUCT.md
|
43
|
+
- Gemfile
|
44
|
+
- LICENSE
|
45
|
+
- README.md
|
46
|
+
- Rakefile
|
47
|
+
- lib/omniauth-authentiq.rb
|
48
|
+
- lib/omniauth/authentiq.rb
|
49
|
+
- lib/omniauth/authentiq/version.rb
|
50
|
+
- lib/omniauth/strategies/authentiq.rb
|
51
|
+
- omniauth-authentiq.gemspec
|
52
|
+
homepage: https://github.com/AuthentiqID/omniauth-authentiq
|
53
|
+
licenses:
|
54
|
+
- MIT
|
55
|
+
metadata: {}
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options: []
|
58
|
+
require_paths:
|
59
|
+
- lib
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
requirements: []
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 2.5.1
|
73
|
+
signing_key:
|
74
|
+
specification_version: 4
|
75
|
+
summary: Authentiq strategy for OmniAuth
|
76
|
+
test_files: []
|