Permalink
Browse files

Update deps and prepare 0.4.0

  • Loading branch information...
1 parent 1f1fef2 commit 7b64f19eef0c360408885cc6850f7aa88a860fc1 @bipthelin bipthelin committed Aug 19, 2013
Showing with 46 additions and 41 deletions.
  1. +3 −3 README.md
  2. BIN rebar
  3. +28 −23 rebar.test.config
  4. +1 −1 src/oauth2.app.src
  5. +13 −13 src/oauth2.erl
  6. +1 −1 src/oauth2_response.erl
View
6 README.md
@@ -1,4 +1,4 @@
-# OAuth2 (v0.3.0) [![BuildStatus](https://travis-ci.org/kivra/oauth2.png?branch=master)](https://travis-ci.org/kivra/oauth2)
+# OAuth2 (v0.4.0) [![BuildStatus](https://travis-ci.org/kivra/oauth2.png?branch=master)](https://travis-ci.org/kivra/oauth2)
This library is designed to simplify the implementation of the server side
of OAuth2 (http://tools.ietf.org/html/rfc6749). It provides
**no** support for developing clients. See
@@ -7,9 +7,9 @@ accessing Oauth2 enabled services.
oauth2 is released under the terms of the [MIT](http://en.wikipedia.org/wiki/MIT_License) license
-Current stable version: [0.3.0](https://github.com/kivra/oauth2/tree/0.3.0)
+Current stable version: [0.4.0](https://github.com/kivra/oauth2/tree/0.4.0)
-Current α alpha version: [0.4.0](https://github.com/kivra/oauth2)
+Current α alpha version: [0.5.0](https://github.com/kivra/oauth2)
copyright 2012-2013 Kivra
View
BIN rebar
Binary file not shown.
View
51 rebar.test.config
@@ -24,28 +24,33 @@
%%
%% ----------------------------------------------------------------------------
-{deps, [
- {meck, ".*", {git, "https://github.com/eproxus/meck.git", {tag, "0.7.2"}}}
- ,{proper, ".*", {git, "git://github.com/manopapad/proper.git", {tag, "v1.0"}}}
- ]}.
-{clean_files, [".eunit", "ebin/*.beam", "test/*.beam"]}.
+{lib_dirs, ["deps"]}.
+{deps_dir, ["deps"]}.
+{require_otp_vsn, "R1[456]"}.
+{erl_opts, [ debug_info
+ , warn_format
+ , warn_export_all
+ , warn_export_vars
+ , warn_obsolete_guard
+ , warn_bif_clash
+ , nowarn_shadow_vars
+ , warnings_as_errors
+ ]}.
+{xref_warnings, false}.
+{xref_checks, [undefined_function_calls]}.
+{eunit_opts, [verbose, {report, {eunit_surefire, [{dir, "."}]}}]}.
+{cover_enabled, true}.
+{cover_print_enabled, true}.
+{dialyzer_opts, [{warnings,
+ [ error_handling
+ , race_conditions
+ , behaviours
+ ]}
+ ]}.
+{clean_files, [".eunit", "ebin/*.beam", "test/*.beam"]}.
-{erl_opts, [
- %% bin_opt_info,
- warn_format,
- warn_export_all,
- warn_export_vars,
- warn_obsolete_guard,
- %% warn_unused_import,
- warn_bif_clash,
- warnings_as_errors,
- %% warn_missing_spec,
- warn_untyped_record,
- debug_info
-]}.
-%% EUnit options
-{eunit_opts, [verbose, {report,{eunit_surefire,[{dir,"."}]}}]}.
-
-%Proper won't behave w/ regards to includes if cover is enabled
-%{cover_enabled, true}.
+{deps,
+ [ {meck, ".*", {git, "https://github.com/eproxus/meck.git", {tag, "0.8"}}}
+ , {proper, ".*", {git, "git://github.com/manopapad/proper.git", {tag, "v1.1"}}}
+ ] }.
View
2 src/oauth2.app.src
@@ -27,7 +27,7 @@
{application, oauth2,
[
{description, "Erlang OAuth 2.0 implementation"},
- {vsn, "0.3.0"},
+ {vsn, "0.4.0"},
{registered, []},
{applications, [
kernel,
View
26 src/oauth2.erl
@@ -40,7 +40,7 @@
-export([refresh_access_token/5]).
%%% Exported types
--type context() :: proplists:proplist(binary(), term()).
+-type context() :: proplists:proplist().
-type token() :: binary().
-type lifetime() :: non_neg_integer().
-type scope() :: list(binary()) | binary().
@@ -73,7 +73,7 @@
%%% API functions
%%%===================================================================
-%% @doc Authorizes a resource owner's credentials. Useful for
+%% @doc Authorizes a resource owner's credentials. Useful for
%% Resource Owner Password Credentials Grant and Implicit Grant.
-spec authorize_password(Username, Password, Scope, AppContext)
-> {ok, Authorization} | {error, Reason} when
@@ -84,7 +84,7 @@
Authorization :: #authorization{},
Reason :: error().
authorize_password(Username, Password, Scope, AppContext) ->
- case ?BACKEND:authenticate_username_password(Username, Password,
+ case ?BACKEND:authenticate_username_password(Username, Password,
AppContext) of
{ok, ResOwner} ->
case ?BACKEND:verify_resowner_scope(ResOwner, Scope, AppContext) of
@@ -149,14 +149,14 @@ authorize_code_grant(ClientId, ClientSecret, AccessCode, RedirectionUri,
AppContext) ->
case ?BACKEND:authenticate_client(ClientId, ClientSecret, AppContext) of
{ok, Client} ->
- case ?BACKEND:verify_redirection_uri(Client, RedirectionUri,
+ case ?BACKEND:verify_redirection_uri(Client, RedirectionUri,
AppContext) of
ok ->
case verify_access_code(AccessCode, Client) of
{ok, GrantContext} ->
TTL = oauth2_config:expiry_time(
password_credentials),
- {_, Scope} = lists:keyfind(<<"scope">>, 1,
+ {_, Scope} = lists:keyfind(<<"scope">>, 1,
GrantContext),
{_, ResOwner} = lists:keyfind(<<"resource_owner">>,
1, GrantContext),
@@ -176,7 +176,7 @@ authorize_code_grant(ClientId, ClientSecret, AccessCode, RedirectionUri,
end.
%% @doc Issue a Code via Access Code Grant
--spec authorize_code_request(ClientId, RedirectionUri, Username, Password,
+-spec authorize_code_request(ClientId, RedirectionUri, Username, Password,
Scope, AppContext)
-> {ok, Authorization} | {error, Reason} when
ClientId :: binary(),
@@ -191,10 +191,10 @@ authorize_code_request(ClientId, RedirectionUri, Username, Password, Scope,
AppContext) ->
case ?BACKEND:get_client_identity(ClientId, AppContext) of
{ok, Client} ->
- case ?BACKEND:verify_redirection_uri(Client, RedirectionUri,
+ case ?BACKEND:verify_redirection_uri(Client, RedirectionUri,
AppContext) of
ok ->
- case ?BACKEND:verify_client_scope(Client, Scope,
+ case ?BACKEND:verify_client_scope(Client, Scope,
AppContext) of
{ok, VerifiedScope} ->
case ?BACKEND:authenticate_username_password(
@@ -326,19 +326,19 @@ refresh_access_token(ClientId, ClientSecret, RefreshToken, Scope, AppContext) ->
{ok, Client} ->
case ?BACKEND:resolve_refresh_token(RefreshToken, AppContext) of
{ok, GrantContext} ->
- {_, ExpiryAbsolute} = lists:keyfind(<<"expiry_time">>, 1,
+ {_, ExpiryAbsolute} = lists:keyfind(<<"expiry_time">>, 1,
GrantContext),
case ExpiryAbsolute > seconds_since_epoch(0) of
true ->
- {_, Client} = lists:keyfind(<<"client">>, 1,
+ {_, Client} = lists:keyfind(<<"client">>, 1,
GrantContext),
{_, RegisteredScope} = lists:keyfind(<<"scope">>, 1,
GrantContext),
- case ?BACKEND:verify_scope(RegisteredScope,
+ case ?BACKEND:verify_scope(RegisteredScope,
Scope, AppContext) of
{ok, VerifiedScope} ->
{_, ResOwner} = lists:keyfind(
- <<"resource_owner">>, 1,
+ <<"resource_owner">>, 1,
GrantContext),
TTL = oauth2_config:expiry_time(
password_credentials),
@@ -353,7 +353,7 @@ refresh_access_token(ClientId, ClientSecret, RefreshToken, Scope, AppContext) ->
{error, invalid_scope}
end;
false ->
- ?BACKEND:revoke_refresh_token(RefreshToken,
+ ?BACKEND:revoke_refresh_token(RefreshToken,
AppContext),
{error, invalid_grant}
end;
View
2 src/oauth2_response.erl
@@ -190,7 +190,7 @@ resource_owner(Response, NewResOwner) ->
token_type(#response{}) ->
{ok, ?TOKEN_TYPE}.
--spec to_proplist(response()) -> oauth2:proplist(binary(), binary()).
+-spec to_proplist(response()) -> proplists:proplist().
to_proplist(Response) ->
Keys = lists:map(fun to_binary/1, record_info(fields, response)),
Values = tl(tuple_to_list(Response)), %% Head is 'response'!

0 comments on commit 7b64f19

Please sign in to comment.