auth 0.0.3 → 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.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ *0.0.4*
2
+
3
+ * Fixed some problems related to exception handling
4
+ * Fixed a bug in the validation of redirect_uri
5
+ * Removed the possibility to run the server stand-alone
6
+
1
7
  *0.0.3*
2
8
 
3
9
  * Added json gem dependency
data/README.md CHANGED
@@ -2,5 +2,4 @@ Auth
2
2
  ====
3
3
 
4
4
  A high performance OAuth2 authorization server using Sinatra and Redis,
5
- inspired by Resque. Can be run both as a standalone server or as a rack
6
- middleware.
5
+ inspired by Resque.
@@ -14,13 +14,13 @@ module Auth
14
14
  when :client
15
15
  @client = Auth.authenticate_client(@request.params['client_id'], @request.params['client_secret'])
16
16
  unless @client
17
- raise AuthException, 'Invalid client'
17
+ raise UnauthorizedClient, 'Invalid client'
18
18
  end
19
19
  else
20
20
  if Auth.authenticate_account(@request.params['username'], @request.params['password'])
21
- @user_id = @request.params['username']
21
+ @user = User.new(@request.params['username'])
22
22
  else
23
- raise AuthException, 'Invalid username or password'
23
+ raise AccessDenied, 'Invalid username or password'
24
24
  end
25
25
  end
26
26
  end
@@ -30,7 +30,7 @@ module Auth
30
30
  when :client
31
31
  @client ? @client : nil
32
32
  else
33
- @user_id ? User.new(@user_id) : nil
33
+ @user ? @user : nil
34
34
  end
35
35
  end
36
36
  end
@@ -12,6 +12,8 @@ module Auth
12
12
  set :views, "#{dir}/server/views"
13
13
  set :public, "#{dir}/server/public"
14
14
  set :static, true
15
+ set :raise_errors, true
16
+ set :show_exceptions, true if development?
15
17
 
16
18
  helpers do
17
19
  include Rack::Utils
@@ -64,7 +66,7 @@ module Auth
64
66
 
65
67
  def validate_redirect_uri!
66
68
  params[:redirect_uri] ||= sentry.user(:client).redirect_uri
67
- if URI(params[:redirect_uri]).host.downcase != URI(sentry.user(:client).redirect_uri).host.downcase
69
+ if URI(params[:redirect_uri]).host.to_s.downcase != URI(sentry.user(:client).redirect_uri).host.to_s.downcase
68
70
  halt(400, 'Invalid redirect URI')
69
71
  end
70
72
  rescue URI::InvalidURIError
@@ -1,3 +1,3 @@
1
1
  module Auth
2
- Version = VERSION = '0.0.3'
2
+ Version = VERSION = '0.0.5'
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Niklas Holmgren
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-08-31 00:00:00 +02:00
17
+ date: 2011-10-16 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -107,7 +107,7 @@ dependencies:
107
107
  version: 0.5.6
108
108
  type: :development
109
109
  version_requirements: *id006
110
- description: A high performance OAuth2 authorization server using Sinatra and Redis, inspired by Resque. Can be run both as a standalone server or as a rack middleware.
110
+ description: A high performance OAuth2 authorization server using Sinatra and Redis, inspired by Resque.
111
111
  email: niklas@sutajio.se
112
112
  executables: []
113
113