Embed omniauth-ultraauth

This commit is contained in:
Pirate Praveen 2019-08-03 10:13:22 +05:30
parent 3b48cd06ea
commit def209a37b
16 changed files with 336 additions and 0 deletions

View file

@ -0,0 +1,11 @@
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
# rspec failure tracking
.rspec_status

View file

@ -0,0 +1,3 @@
--format documentation
--color
--require spec_helper

View file

@ -0,0 +1,7 @@
---
sudo: false
language: ruby
cache: bundler
rvm:
- 2.5.3
before_install: gem install bundler -v 1.17.3

View file

@ -0,0 +1,6 @@
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
# Specify your gem's dependencies in omniauth-ultraauth.gemspec
gemspec

View file

@ -0,0 +1,101 @@
PATH
remote: .
specs:
omniauth-ultraauth (0.0.1)
omniauth_openid_connect (~> 0.3.0)
GEM
remote: https://rubygems.org/
specs:
activemodel (5.2.2)
activesupport (= 5.2.2)
activesupport (5.2.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
aes_key_wrap (1.0.1)
attr_required (1.0.1)
bindata (2.4.4)
concurrent-ruby (1.1.4)
diff-lcs (1.3)
hashie (3.6.0)
httpclient (2.8.3)
i18n (1.5.3)
concurrent-ruby (~> 1.0)
json-jwt (1.10.0)
activesupport (>= 4.2)
aes_key_wrap
bindata
mail (2.7.1)
mini_mime (>= 0.1.1)
mini_mime (1.0.1)
minitest (5.11.3)
omniauth (1.9.0)
hashie (>= 3.4.6, < 3.7.0)
rack (>= 1.6.2, < 3)
omniauth_openid_connect (0.3.0)
addressable (~> 2.5)
omniauth (~> 1.3)
openid_connect (~> 1.1)
openid_connect (1.1.6)
activemodel
attr_required (>= 1.0.0)
json-jwt (>= 1.5.0)
rack-oauth2 (>= 1.6.1)
swd (>= 1.0.0)
tzinfo
validate_email
validate_url
webfinger (>= 1.0.1)
public_suffix (3.0.3)
rack (2.0.6)
rack-oauth2 (1.9.3)
activesupport
attr_required
httpclient
json-jwt (>= 1.9.0)
rack
rake (10.5.0)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
swd (1.1.2)
activesupport (>= 3)
attr_required (>= 0.0.5)
httpclient (>= 2.4)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
validate_email (0.1.6)
activemodel (>= 3.0)
mail (>= 2.2.5)
validate_url (1.0.4)
activemodel (>= 3.0.0)
webfinger (1.1.0)
activesupport
httpclient (>= 2.4)
PLATFORMS
ruby
DEPENDENCIES
bundler (~> 1.17)
omniauth-ultraauth!
rake (~> 10.0)
rspec (~> 3.0)
BUNDLED WITH
1.17.3

View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2019 Kartikey Tanna
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:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
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.

View file

@ -0,0 +1,78 @@
# OmniAuth::UltraAuth
## Installation
Add the following to Gemfile:
gem 'omniauth-ultraauth'
Install it using Bundler:
$ bundle
## Before You Begin
You will require to create an application on https://ultraauth.com
1. Create an account and login to https://ultraauth.com
2. Go to "Create an App" and select "Ruby on Rails"
3. Click on "Edit Callback URL". The URL should be your host followed by `/auth/ultraauth/callback`. For example, http://localhost:3000/auth/ultraauth/callback
## Usage
Example configuration:
If you are using Rails, your `config/intializers/omniauth.rb` file should look like this:
```ruby
Rails.application.config.middleware.use OmniAuth::Builder do
provider :ultraauth, "CLIENT_ID", "CLIENT_SECRET", client_options: {
redirect_uri: "CALLBACK_URI" # i.e. http://localhost:3000/auth/ultraauth/callback
}
end
```
Replace "CLIENT_ID", "CLIENT_SECRET", "CALLBACK_URI" with the values from the application you created on https://ultraauth.com
## Authentication Hash
An example of auth hash returned from the server available under `request.env['omniauth.auth']`:
```
{
"provider": "ultraauth",
"uid": "abcd1234...",
"info": {
"name": null,
"email": null,
"nickname": null,
"first_name": null,
"last_name": null,
"gender": null,
"image": null,
"phone": null,
"urls": {
"website": null
}
},
"credentials": {
"id_token": "abcd1234...",
"token": "abcd1234...",
"refresh_token": null,
"expires_in": 3600,
"scope": "openid"
},
"extra": {
"raw_info": {
"sub": "abcd1234...."
}
}
}
```
## Contributing
1. Fork it ( http://github.com/ultraauth/omniauth-ultraauth/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

View file

@ -0,0 +1,6 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task :default => :spec

View file

@ -0,0 +1,14 @@
#!/usr/bin/env ruby
require "bundler/setup"
require "omniauth-ultraauth"
# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start
require "irb"
IRB.start(__FILE__)

View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx
bundle install
# Do any other automated setup that you need to do here

View file

@ -0,0 +1,2 @@
require 'omniauth-ultraauth/version'
require 'omniauth/strategies/ultraauth'

View file

@ -0,0 +1,5 @@
module OmniAuth
module UltraAuth
VERSION = "0.0.2"
end
end

View file

@ -0,0 +1,33 @@
require 'omniauth'
require 'omniauth_openid_connect'
module OmniAuth
module Strategies
class UltraAuth < OmniAuth::Strategies::OpenIDConnect
args %i[identifier secret]
option :identifier, nil
option :secret, nil
option :name, 'ultraauth'
option :scope, [:openid]
option :discovery, "true"
option :response_type, :code
option :issuer, "https://srv.qryp.to/op"
option :client_auth_method, :basic
info do
{
username: uid
}
end
private
def client_options
options.client_options.merge!(identifier: options.identifier, secret: options.secret)
end
end
end
end
OmniAuth.config.add_camelization('ultraauth', 'UltraAuth')

View file

@ -0,0 +1,29 @@
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "omniauth-ultraauth/version"
Gem::Specification.new do |spec|
spec.name = "omniauth-ultraauth"
spec.version = OmniAuth::UltraAuth::VERSION
spec.authors = ["Kartikey Tanna"]
spec.email = ["tannakartikey@gmail.com"]
spec.summary = %q{Omniauth strategy for UltraAuth.}
spec.description = %q{Eliminate customer phishing / hijacking and increase user satisfaction with password-less authentication.}
spec.homepage = "https://ultraauth.com"
spec.license = "MIT"
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.add_runtime_dependency "omniauth_openid_connect", "~> 0.3.0"
spec.add_development_dependency "bundler", "~> 1.17"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
end

View file

@ -0,0 +1,11 @@
--- a/Gemfile
+++ b/Gemfile
@@ -53,7 +53,7 @@
gem 'omniauth_crowd', '~> 2.2'
gem 'omniauth-authentiq', '~> 0.3.3'
gem 'omniauth_openid_connect', '~> 0.3.0'
-gem "omniauth-ultraauth", '~> 0.0.2'
+gem "omniauth-ultraauth", '~> 0.0.2', path: 'vendor/gems/omniauth-ultraauth-0.0.2'
gem 'omniauth-salesforce', '~> 1.0', '>= 1.0.5'
gem 'rack-oauth2', '~> 1.9', '>= 1.9.3'
gem 'jwt', '2.1', path: 'vendor/gems/jwt-2.1.0'

View file

@ -29,3 +29,4 @@
0730-install-graphql-tag.patch 0730-install-graphql-tag.patch
0740-use-packaged-modules.patch 0740-use-packaged-modules.patch
bump-devise-to-4-6.patch bump-devise-to-4-6.patch
0800-embed-omniauth0ultraauth.patch