kth_omniauth 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +17 -0
- data/LICENSE +19 -0
- data/README.md +165 -0
- data/Rakefile +6 -0
- data/kth_omniauth.gemspec +17 -0
- data/lib/kth_omniauth.rb +5 -0
- data/lib/kth_omniauth/version.rb +3 -0
- metadata +63 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'growl'
|
4
|
+
gem 'guard'
|
5
|
+
gem 'guard-bundler'
|
6
|
+
gem 'guard-rspec'
|
7
|
+
gem 'rack', '~> 1.4'
|
8
|
+
gem 'rb-fsevent'
|
9
|
+
#gem 'plymouth'
|
10
|
+
#gem 'pry'
|
11
|
+
#gem 'pry-nav'
|
12
|
+
|
13
|
+
platforms :jruby do
|
14
|
+
gem 'jruby-openssl'
|
15
|
+
end
|
16
|
+
|
17
|
+
gemspec
|
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2010-2011 Michael Bleigh and Intridea, Inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
# OmniAuth: Standardized Multi-Provider Authentication [![CI Build Status](https://secure.travis-ci.org/intridea/omniauth.png?branch=master)][travis] [![Dependency Status](https://gemnasium.com/intridea/omniauth.png?travis)][gemnasium]
|
2
|
+
|
3
|
+
[travis]: http://travis-ci.org/intridea/omniauth
|
4
|
+
[gemnasium]: https://gemnasium.com/intridea/omniauth
|
5
|
+
|
6
|
+
**OmniAuth 1.0 has several breaking changes from version 0.x. You can set
|
7
|
+
the dependency to `~> 0.3.2` if you do not wish to make the more difficult
|
8
|
+
upgrade. See [the wiki](https://github.com/intridea/omniauth/wiki/Upgrading-to-1.0)
|
9
|
+
for more information.**
|
10
|
+
|
11
|
+
## An Introduction
|
12
|
+
|
13
|
+
OmniAuth is a library that standardizes multi-provider authentication for
|
14
|
+
web applications. It was created to be powerful, flexible, and do as
|
15
|
+
little as possible. Any developer can create **strategies** for OmniAuth
|
16
|
+
that can authenticate users via disparate systems. OmniAuth strategies
|
17
|
+
have been created for everything from Facebook to LDAP.
|
18
|
+
|
19
|
+
In order to use OmniAuth in your applications, you will need to leverage
|
20
|
+
one or more strategies. These strategies are generally released
|
21
|
+
individually as RubyGems, and you can see a [community maintained list](https://github.com/intridea/omniauth/wiki/List-of-Strategies)
|
22
|
+
on the wiki for this project.
|
23
|
+
|
24
|
+
One strategy, called `Developer`, is included with OmniAuth and provides
|
25
|
+
a completely insecure, non-production-usable strategy that directly
|
26
|
+
prompts a user for authentication information and then passes it
|
27
|
+
straight through. You can use it as a placeholder when you start
|
28
|
+
development and easily swap in other strategies later.
|
29
|
+
|
30
|
+
## Getting Started
|
31
|
+
|
32
|
+
Each OmniAuth strategy is a Rack Middleware. That means that you can use
|
33
|
+
it the same way that you use any other Rack middleware. For example, to
|
34
|
+
use the built-in Developer strategy in a Sinatra application I might do
|
35
|
+
this:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
require 'sinatra'
|
39
|
+
require 'omniauth'
|
40
|
+
|
41
|
+
class MyApplication < Sinatra::Base
|
42
|
+
use Rack::Session::Cookie
|
43
|
+
use OmniAuth::Strategies::Developer
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
Because OmniAuth is built for *multi-provider* authentication, I may
|
48
|
+
want to leave room to run multiple strategies. For this, the built-in
|
49
|
+
`OmniAuth::Builder` class gives you an easy way to specify multiple
|
50
|
+
strategies. Note that there is **no difference** between the following
|
51
|
+
code and using each strategy individually as middleware. This is an
|
52
|
+
example that you might put into a Rails initializer at
|
53
|
+
`config/initializers/omniauth.rb`:
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
57
|
+
provider :developer unless Rails.env.production?
|
58
|
+
provider :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET']
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
62
|
+
You should look to the documentation for each provider you use for
|
63
|
+
specific initialization requirements.
|
64
|
+
|
65
|
+
## Integrating OmniAuth Into Your Application
|
66
|
+
|
67
|
+
OmniAuth is an extremely low-touch library. It is designed to be a
|
68
|
+
black box that you can send your application's users into when you need
|
69
|
+
authentication and then get information back. OmniAuth was intentionally
|
70
|
+
built not to automatically associate with a User model or make
|
71
|
+
assumptions about how many authentication methods you might want to use
|
72
|
+
or what you might want to do with the data once a user has
|
73
|
+
authenticated. This makes OmniAuth incredibly flexible. To use OmniAuth,
|
74
|
+
you need only to redirect users to `/auth/:provider`, where `:provider`
|
75
|
+
is the name of the strategy (for example, `developer` or `twitter`).
|
76
|
+
From there, OmniAuth will take over and take the user through the
|
77
|
+
necessary steps to authenticate them with the chosen strategy.
|
78
|
+
|
79
|
+
Once the user has authenticated, what do you do next? OmniAuth simply
|
80
|
+
sets a special hash called the Authentication Hash on the Rack
|
81
|
+
environment of a request to `/auth/:provider/callback`. This hash
|
82
|
+
contains as much information about the user as OmniAuth was able to
|
83
|
+
glean from the utilized strategy. You should set up an endpoint in your
|
84
|
+
application that matches to the callback URL and then performs whatever
|
85
|
+
steps are necessary for your application. For example, in a Rails app I
|
86
|
+
would add a line in my `routes.rb` file like this:
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
match '/auth/:provider/callback', to: 'sessions#create'
|
90
|
+
```
|
91
|
+
|
92
|
+
And I might then have a `SessionsController` with code that looks
|
93
|
+
something like this:
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
class SessionsController < ApplicationController
|
97
|
+
def create
|
98
|
+
@user = User.find_or_create_from_auth_hash(auth_hash)
|
99
|
+
self.current_user = @user
|
100
|
+
redirect_to '/'
|
101
|
+
end
|
102
|
+
|
103
|
+
protected
|
104
|
+
|
105
|
+
def auth_hash
|
106
|
+
request.env['omniauth.auth']
|
107
|
+
end
|
108
|
+
end
|
109
|
+
```
|
110
|
+
|
111
|
+
The `omniauth.auth` key in the environment hash gives me my
|
112
|
+
Authentication Hash which will contain information about the just
|
113
|
+
authenticated user including a unique id, the strategy they just used
|
114
|
+
for authentication, and personal details such as name and email address
|
115
|
+
as available. For an in-depth description of what the authentication
|
116
|
+
hash might contain, see the [Auth Hash Schema wiki page](https://github.com/intridea/omniauth/wiki/Auth-Hash-Schema).
|
117
|
+
|
118
|
+
Note that OmniAuth does not perform any actions beyond setting some
|
119
|
+
environment information on the callback request. It is entirely up to
|
120
|
+
you how you want to implement the particulars of your application's
|
121
|
+
authentication flow.
|
122
|
+
|
123
|
+
## Logging
|
124
|
+
|
125
|
+
OmniAuth supports a configurable logger. By default, OmniAuth will log
|
126
|
+
to `STDOUT` but you can configure this using `OmniAuth.config.logger`:
|
127
|
+
|
128
|
+
```ruby
|
129
|
+
# Rails application example
|
130
|
+
OmniAuth.config.logger = Rails.logger
|
131
|
+
```
|
132
|
+
|
133
|
+
## <a name="resources"></a>Resources
|
134
|
+
|
135
|
+
The [OmniAuth Wiki](https://github.com/intridea/omniauth/wiki) has
|
136
|
+
actively maintained in-depth documentation for OmniAuth. It should be
|
137
|
+
your first stop if you are wondering about a more in-depth look at
|
138
|
+
OmniAuth, how it works, and how to use it.
|
139
|
+
|
140
|
+
## <a name="versions"></a>Supported Ruby Versions
|
141
|
+
|
142
|
+
OmniAuth is tested under 1.8.7, 1.9.2, 1.9.3, JRuby (1.8 mode), and Rubinius
|
143
|
+
(1.8 and 1.9 modes).
|
144
|
+
|
145
|
+
## <a name="license"></a>License
|
146
|
+
|
147
|
+
Copyright (c) 2011 Intridea, Inc.
|
148
|
+
|
149
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
150
|
+
copy of this software and associated documentation files (the "Software"),
|
151
|
+
to deal in the Software without restriction, including without limitation
|
152
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
153
|
+
and/or sell copies of the Software, and to permit persons to whom the
|
154
|
+
Software is furnished to do so, subject to the following conditions:
|
155
|
+
|
156
|
+
The above copyright notice and this permission notice shall be included
|
157
|
+
in all copies or substantial portions of the Software.
|
158
|
+
|
159
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
160
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
161
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
162
|
+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
163
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
164
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
165
|
+
DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/kth_omniauth/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["SeongSik Kim"]
|
6
|
+
gem.email = ["kssminus@gmail.com"]
|
7
|
+
gem.description = %q{omniauth-ldap cutomized for kth inc }
|
8
|
+
gem.summary = %q{omniauth-ldap cutomized for kth inc}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "kth_omniauth"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = KthOmniauth::VERSION
|
17
|
+
end
|
data/lib/kth_omniauth.rb
ADDED
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kth_omniauth
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- SeongSik Kim
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2012-09-04 00:00:00 Z
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: "omniauth-ldap cutomized for kth inc "
|
17
|
+
email:
|
18
|
+
- kssminus@gmail.com
|
19
|
+
executables: []
|
20
|
+
|
21
|
+
extensions: []
|
22
|
+
|
23
|
+
extra_rdoc_files: []
|
24
|
+
|
25
|
+
files:
|
26
|
+
- .gitignore
|
27
|
+
- Gemfile
|
28
|
+
- LICENSE
|
29
|
+
- README.md
|
30
|
+
- Rakefile
|
31
|
+
- kth_omniauth.gemspec
|
32
|
+
- lib/kth_omniauth.rb
|
33
|
+
- lib/kth_omniauth/version.rb
|
34
|
+
homepage: ""
|
35
|
+
licenses: []
|
36
|
+
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: "0"
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0"
|
54
|
+
requirements: []
|
55
|
+
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 1.8.24
|
58
|
+
signing_key:
|
59
|
+
specification_version: 3
|
60
|
+
summary: omniauth-ldap cutomized for kth inc
|
61
|
+
test_files: []
|
62
|
+
|
63
|
+
has_rdoc:
|