omniauth-rightsignature 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: 17dd9416e0a0bccc40e7373298766b6621eeb78d
4
- data.tar.gz: 74b7a1420dea61a72dafb86a1d04a92c80a36d72
3
+ metadata.gz: be51d780d2d1dbd57923e11be16c0c3ead2a753f
4
+ data.tar.gz: da07361b7e6f421a45a372693e7f573f82d47cbb
5
5
  SHA512:
6
- metadata.gz: b3d9406151a69be2666cb68aa335bca0b129989c9e308a826c1580e7d719b8bb11c52cd615934dfa30f323b949ff6a5b633dc23c100b466ff61c58921272281a
7
- data.tar.gz: 83a6fd3768202885317beb965aba2597741b81434fcb791a5af848f8b1593e53022f58912dfc48b43b1bba09ce42daf69d516e850adff8e22caa9832cb053075
6
+ metadata.gz: c4c0c32c3138f1adc19b5e5687607de50507907fc3aa8a29396dc5614e2b472274bb72c31642d49c62f21b34d0e1a33b45a3f475934ec0800c90556a0d84e942
7
+ data.tar.gz: 65c001e316d7fd109f4f5cc77f1492d6e952342d03aef7eaa9004e3a60366bc15be38e654947dae4f1e013fd26473370e28f92583800ee984e3df6b7d168b916
data/README.md CHANGED
@@ -1,167 +1,36 @@
1
- # OmniAuth-RightSignature: Standardized Multi-Provider Authentication
1
+ OmniAuth RightSignature
2
+ ================
2
3
 
3
- [![Gem Version](http://img.shields.io/gem/v/omniauth.svg)][gem]
4
- [![Build Status](http://img.shields.io/travis/intridea/omniauth.svg)][travis]
5
- [![Dependency Status](http://img.shields.io/gemnasium/intridea/omniauth.svg)][gemnasium]
6
- [![Code Climate](http://img.shields.io/codeclimate/github/intridea/omniauth.svg)][codeclimate]
7
- [![Coverage Status](http://img.shields.io/coveralls/intridea/omniauth.svg)][coveralls]
8
- [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/intridea/omniauth/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
4
+ This gem is an OmniAuth 1.0 Strategy for the [RightSignature API](https://rightsignature.com/api)
9
5
 
10
- [gem]: https://rubygems.org/gems/omniauth
11
- [travis]: http://travis-ci.org/intridea/omniauth
12
- [gemnasium]: https://gemnasium.com/intridea/omniauth
13
- [codeclimate]: https://codeclimate.com/github/intridea/omniauth
14
- [coveralls]: https://coveralls.io/r/intridea/omniauth
6
+ It supports RightSignature API which uses OAuth 1.0a.
15
7
 
16
- **OmniAuth 1.0 has several breaking changes from version 0.x. You can set
17
- the dependency to `~> 0.3.2` if you do not wish to make the more difficult
18
- upgrade. See [the wiki](https://github.com/intridea/omniauth/wiki/Upgrading-to-1.0)
19
- for more information.**
8
+ Usage
9
+ -----
20
10
 
21
- ## An Introduction
22
- OmniAuth is a library that standardizes multi-provider authentication for
23
- web applications. It was created to be powerful, flexible, and do as
24
- little as possible. Any developer can create **strategies** for OmniAuth
25
- that can authenticate users via disparate systems. OmniAuth strategies
26
- have been created for everything from Facebook to LDAP.
27
-
28
- In order to use OmniAuth in your applications, you will need to leverage
29
- one or more strategies. These strategies are generally released
30
- individually as RubyGems, and you can see a [community maintained list](https://github.com/intridea/omniauth/wiki/List-of-Strategies)
31
- on the wiki for this project.
32
-
33
- One strategy, called `Developer`, is included with OmniAuth and provides
34
- a completely insecure, non-production-usable strategy that directly
35
- prompts a user for authentication information and then passes it
36
- straight through. You can use it as a placeholder when you start
37
- development and easily swap in other strategies later.
38
-
39
- ## Getting Started
40
- Each OmniAuth strategy is a Rack Middleware. That means that you can use
41
- it the same way that you use any other Rack middleware. For example, to
42
- use the built-in Developer strategy in a Sinatra application I might do
43
- this:
11
+ Add the strategy to your `Gemfile` alongside OmniAuth:
44
12
 
45
13
  ```ruby
46
- require 'sinatra'
47
- require 'omniauth'
48
-
49
- class MyApplication < Sinatra::Base
50
- use Rack::Session::Cookie
51
- use OmniAuth::Strategies::Developer
52
- end
14
+ gem 'omniauth'
15
+ gem 'omniauth-rightsignature'
53
16
  ```
54
17
 
55
- Because OmniAuth is built for *multi-provider* authentication, I may
56
- want to leave room to run multiple strategies. For this, the built-in
57
- `OmniAuth::Builder` class gives you an easy way to specify multiple
58
- strategies. Note that there is **no difference** between the following
59
- code and using each strategy individually as middleware. This is an
60
- example that you might put into a Rails initializer at
61
- `config/initializers/omniauth.rb`:
18
+ Then integrate the strategy into your middleware:
62
19
 
63
20
  ```ruby
64
- Rails.application.config.middleware.use OmniAuth::Builder do
65
- provider :developer unless Rails.env.production?
66
- provider :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET']
21
+ use OmniAuth::Builder do
22
+ provider :rightsignature, 'oAuthKey', 'oAuth Secret'
67
23
  end
68
24
  ```
69
25
 
70
- You should look to the documentation for each provider you use for
71
- specific initialization requirements.
72
-
73
- ## Integrating OmniAuth Into Your Application
74
- OmniAuth is an extremely low-touch library. It is designed to be a
75
- black box that you can send your application's users into when you need
76
- authentication and then get information back. OmniAuth was intentionally
77
- built not to automatically associate with a User model or make
78
- assumptions about how many authentication methods you might want to use
79
- or what you might want to do with the data once a user has
80
- authenticated. This makes OmniAuth incredibly flexible. To use OmniAuth,
81
- you need only to redirect users to `/auth/:provider`, where `:provider`
82
- is the name of the strategy (for example, `developer` or `twitter`).
83
- From there, OmniAuth will take over and take the user through the
84
- necessary steps to authenticate them with the chosen strategy.
85
-
86
- Once the user has authenticated, what do you do next? OmniAuth simply
87
- sets a special hash called the Authentication Hash on the Rack
88
- environment of a request to `/auth/:provider/callback`. This hash
89
- contains as much information about the user as OmniAuth was able to
90
- glean from the utilized strategy. You should set up an endpoint in your
91
- application that matches to the callback URL and then performs whatever
92
- steps are necessary for your application. For example, in a Rails app I
93
- would add a line in my `routes.rb` file like this:
94
-
95
- ```ruby
96
- get '/auth/:provider/callback', to: 'sessions#create'
97
- ```
98
-
99
- And I might then have a `SessionsController` with code that looks
100
- something like this:
26
+ In Rails, you'll want to add to the middleware stack:
101
27
 
102
28
  ```ruby
103
- class SessionsController < ApplicationController
104
- def create
105
- @user = User.find_or_create_from_auth_hash(auth_hash)
106
- self.current_user = @user
107
- redirect_to '/'
108
- end
109
-
110
- protected
111
-
112
- def auth_hash
113
- request.env['omniauth.auth']
114
- end
29
+ Rails.application.config.middleware.use OmniAuth::Builder do
30
+ provider :rightsignature, 'oAuthKey', 'oAuth Secret'
115
31
  end
116
32
  ```
117
33
 
118
- The `omniauth.auth` key in the environment hash gives me my
119
- Authentication Hash which will contain information about the just
120
- authenticated user including a unique id, the strategy they just used
121
- for authentication, and personal details such as name and email address
122
- as available. For an in-depth description of what the authentication
123
- hash might contain, see the [Auth Hash Schema wiki page](https://github.com/intridea/omniauth/wiki/Auth-Hash-Schema).
124
-
125
- Note that OmniAuth does not perform any actions beyond setting some
126
- environment information on the callback request. It is entirely up to
127
- you how you want to implement the particulars of your application's
128
- authentication flow.
129
-
130
- ## Logging
131
- OmniAuth supports a configurable logger. By default, OmniAuth will log
132
- to `STDOUT` but you can configure this using `OmniAuth.config.logger`:
133
-
134
- ```ruby
135
- # Rails application example
136
- OmniAuth.config.logger = Rails.logger
137
- ```
138
-
139
- ## Resources
140
- The [OmniAuth Wiki](https://github.com/intridea/omniauth/wiki) has
141
- actively maintained in-depth documentation for OmniAuth. It should be
142
- your first stop if you are wondering about a more in-depth look at
143
- OmniAuth, how it works, and how to use it.
144
-
145
- ## Supported Ruby Versions
146
- OmniAuth is tested under 1.8.7, 1.9.3, 2.0.0, 2.1.0, JRuby, and Rubinius.
147
-
148
- ## Versioning
149
- This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations
150
- of this scheme should be reported as bugs. Specifically, if a minor or patch
151
- version is released that breaks backward compatibility, that version should be
152
- immediately yanked and/or a new version should be immediately released that
153
- restores compatibility. Breaking changes to the public API will only be
154
- introduced with new major versions. As a result of this policy, you can (and
155
- should) specify a dependency on this gem using the [Pessimistic Version
156
- Constraint][pvc] with two digits of precision. For example:
157
-
158
- spec.add_dependency 'omniauth', '~> 1.0'
159
-
160
- [semver]: http://semver.org/
161
- [pvc]: http://docs.rubygems.org/read/chapter/16#page74
162
-
163
- ## License
164
- Copyright (c) 2010-2013 Michael Bleigh and Intridea, Inc. See [LICENSE][] for
165
- details.
34
+ You will have to put in your consumer key and secret (RightSignature refers to them as oAuth Key and oAuth Secret in https://rightsignature.com/oauth_clients).
166
35
 
167
- [license]: LICENSE.md
36
+ For additional information, refer to the [OmniAuth wiki](https://github.com/intridea/omniauth/wiki).
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Rightsignature
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
@@ -19,7 +19,6 @@ module OmniAuth
19
19
  }
20
20
  option :name, 'rightsignature'
21
21
 
22
- #raise 'Error'
23
22
  uid {access_token.params['user_id']}
24
23
 
25
24
  info do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-rightsignature
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deepikaa Subramaniam
@@ -126,26 +126,9 @@ files:
126
126
  - README.md
127
127
  - Rakefile
128
128
  - lib/omniauth-rightsignature.rb
129
- - lib/omniauth.rb
130
- - lib/omniauth/auth_hash.rb
131
- - lib/omniauth/builder.rb
132
- - lib/omniauth/failure_endpoint.rb
133
- - lib/omniauth/form.css
134
- - lib/omniauth/form.rb
135
129
  - lib/omniauth/rightsignature/version.rb
136
130
  - lib/omniauth/strategies/rightsignature.rb
137
- - lib/omniauth/strategy.rb
138
- - lib/omniauth/test.rb
139
- - lib/omniauth/version.rb
140
131
  - omniauth-rightsignature.gemspec
141
- - spec/helper.rb
142
- - spec/omniauth/auth_hash_spec.rb
143
- - spec/omniauth/builder_spec.rb
144
- - spec/omniauth/failure_endpoint_spec.rb
145
- - spec/omniauth/form_spec.rb
146
- - spec/omniauth/strategies/developer_spec.rb
147
- - spec/omniauth/strategy_spec.rb
148
- - spec/omniauth_spec.rb
149
132
  homepage: https://github.com/DeepikaaSubramaniam21/omniauth-rightsignature/
150
133
  licenses: []
151
134
  metadata: {}
@@ -1,54 +0,0 @@
1
- require 'hashie/mash'
2
-
3
- module OmniAuth
4
- # The AuthHash is a normalized schema returned by all OmniAuth
5
- # strategies. It maps as much user information as the provider
6
- # is able to provide into the InfoHash (stored as the `'info'`
7
- # key).
8
- class AuthHash < Hashie::Mash
9
- def self.subkey_class
10
- Hashie::Mash
11
- end
12
-
13
- # Tells you if this is considered to be a valid
14
- # OmniAuth AuthHash. The requirements for that
15
- # are that it has a provider name, a uid, and a
16
- # valid info hash. See InfoHash#valid? for
17
- # more details there.
18
- def valid?
19
- uid? && provider? && info? && info.valid?
20
- end
21
-
22
- def regular_writer(key, value)
23
- if key.to_s == 'info' && !value.is_a?(InfoHash)
24
- value = InfoHash.new(value)
25
- end
26
- super
27
- end
28
-
29
- class InfoHash < Hashie::Mash
30
- def self.subkey_class
31
- Hashie::Mash
32
- end
33
-
34
- def name
35
- return self[:name] if self[:name]
36
- return "#{first_name} #{last_name}".strip if first_name? || last_name?
37
- return nickname if nickname?
38
- return email if email?
39
- nil
40
- end
41
-
42
- def name?
43
- !!name # rubocop:disable DoubleNegation
44
- end
45
- alias_method :valid?, :name?
46
-
47
- def to_hash
48
- hash = super
49
- hash['name'] ||= name
50
- hash
51
- end
52
- end
53
- end
54
- end
@@ -1,62 +0,0 @@
1
- module OmniAuth
2
- class Builder < ::Rack::Builder
3
- def initialize(app, &block)
4
- @options = nil
5
- if rack14?
6
- super
7
- else
8
- @app = app
9
- super(&block)
10
- @ins << @app
11
- end
12
- end
13
-
14
- def rack14?
15
- Rack.release.split('.')[1].to_i >= 4
16
- end
17
-
18
- def on_failure(&block)
19
- OmniAuth.config.on_failure = block
20
- end
21
-
22
- def before_options_phase(&block)
23
- OmniAuth.config.before_options_phase = block
24
- end
25
-
26
- def before_request_phase(&block)
27
- OmniAuth.config.before_request_phase = block
28
- end
29
-
30
- def before_callback_phase(&block)
31
- OmniAuth.config.before_callback_phase = block
32
- end
33
-
34
- def configure(&block)
35
- OmniAuth.configure(&block)
36
- end
37
-
38
- def options(options = false)
39
- return @options || {} if options == false
40
- @options = options
41
- end
42
-
43
- def provider(klass, *args, &block)
44
- if klass.is_a?(Class)
45
- middleware = klass
46
- else
47
- begin
48
- middleware = OmniAuth::Strategies.const_get("#{OmniAuth::Utils.camelize(klass.to_s)}")
49
- rescue NameError
50
- raise(LoadError.new("Could not find matching strategy for #{klass.inspect}. You may need to install an additional gem (such as omniauth-#{klass})."))
51
- end
52
- end
53
-
54
- args.last.is_a?(Hash) ? args.push(options.merge(args.pop)) : args.push(options)
55
- use middleware, *args, &block
56
- end
57
-
58
- def call(env)
59
- to_app.call(env)
60
- end
61
- end
62
- end
@@ -1,44 +0,0 @@
1
- module OmniAuth
2
- # This simple Rack endpoint that serves as the default
3
- # 'failure' mechanism for OmniAuth. If a strategy fails for
4
- # any reason this endpoint will be invoked. The default behavior
5
- # is to redirect to `/auth/failure` except in the case of
6
- # a development `RACK_ENV`, in which case an exception will
7
- # be raised.
8
- class FailureEndpoint
9
- attr_reader :env
10
-
11
- def self.call(env)
12
- new(env).call
13
- end
14
-
15
- def initialize(env)
16
- @env = env
17
- end
18
-
19
- def call
20
- raise_out! if OmniAuth.config.failure_raise_out_environments.include?(ENV['RACK_ENV'].to_s)
21
- redirect_to_failure
22
- end
23
-
24
- def raise_out!
25
- fail(env['omniauth.error'] || OmniAuth::Error.new(env['omniauth.error.type']))
26
- end
27
-
28
- def redirect_to_failure
29
- message_key = env['omniauth.error.type']
30
- new_path = "#{env['SCRIPT_NAME']}#{OmniAuth.config.path_prefix}/failure?message=#{message_key}#{origin_query_param}#{strategy_name_query_param}"
31
- Rack::Response.new(['302 Moved'], 302, 'Location' => new_path).finish
32
- end
33
-
34
- def strategy_name_query_param
35
- return '' unless env['omniauth.error.strategy']
36
- "&strategy=#{env['omniauth.error.strategy'].name}"
37
- end
38
-
39
- def origin_query_param
40
- return '' unless env['omniauth.origin']
41
- "&origin=#{Rack::Utils.escape(env['omniauth.origin'])}"
42
- end
43
- end
44
- end
@@ -1,81 +0,0 @@
1
- body {
2
- background: #ccc;
3
- font-family: "Lucida Grande", "Lucida Sans", Helvetica, Arial, sans-serif;
4
- }
5
-
6
- h1 {
7
- text-align: center;
8
- margin: 30px auto 0px;
9
- font-size: 18px;
10
- padding: 10px 10px 15px;
11
- background: #555;
12
- color: white;
13
- width: 320px;
14
- border: 10px solid #444;
15
- border-bottom: 0;
16
- -moz-border-radius-topleft: 10px;
17
- -moz-border-radius-topright: 10px;
18
- -webkit-border-top-left-radius: 10px;
19
- -webkit-border-top-right-radius: 10px;
20
- border-top-left-radius: 10px;
21
- border-top-right-radius: 10px;
22
- }
23
-
24
- h1, form {
25
- -moz-box-shadow: 2px 2px 7px rgba(0,0,0,0.3);
26
- -webkit-box-shadow: 2px 2px 7px rgba(0,0,0,0.3);
27
- }
28
-
29
- form {
30
- background: white;
31
- border: 10px solid #eee;
32
- border-top: 0;
33
- padding: 20px;
34
- margin: 0px auto 40px;
35
- width: 300px;
36
- -moz-border-radius-bottomleft: 10px;
37
- -moz-border-radius-bottomright: 10px;
38
- -webkit-border-bottom-left-radius: 10px;
39
- -webkit-border-bottom-right-radius: 10px;
40
- border-bottom-left-radius: 10px;
41
- border-bottom-right-radius: 10px;
42
- }
43
-
44
- label {
45
- display: block;
46
- font-weight: bold;
47
- margin-bottom: 5px;
48
- }
49
-
50
- input {
51
- font-size: 18px;
52
- padding: 4px 8px;
53
- display: block;
54
- margin-bottom: 10px;
55
- width: 280px;
56
- }
57
-
58
- input#identifier, input#openid_url {
59
- background: url(http://openid.net/login-bg.gif) no-repeat;
60
- background-position: 0 50%;
61
- padding-left: 18px;
62
- }
63
-
64
- button {
65
- font-size: 22px;
66
- padding: 4px 8px;
67
- display: block;
68
- margin: 20px auto 0;
69
- }
70
-
71
- fieldset {
72
- border: 1px solid #ccc;
73
- border-left: 0;
74
- border-right: 0;
75
- padding: 10px 0;
76
- }
77
-
78
- fieldset input {
79
- width: 260px;
80
- font-size: 16px;
81
- }