-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added tests, changed the way how
%Info{}
is created, coverage added
- Loading branch information
Showing
16 changed files
with
379 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,3 +94,4 @@ erl_crash.dump | |
|
||
#####=== Custom ===##### | ||
doc/ | ||
cover/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,20 @@ | ||
# This file is responsible for configuring your application | ||
# and its dependencies with the aid of the Mix.Config module. | ||
use Mix.Config | ||
|
||
# This configuration is loaded before any dependency and is restricted | ||
# to this project. If another project depends on this project, this | ||
# file won't be loaded nor affect the parent project. For this reason, | ||
# if you want to provide default values for your application for | ||
# 3rd-party users, it should be done in your "mix.exs" file. | ||
|
||
# It is also possible to import configuration files, relative to this | ||
# directory. For example, you can emulate configuration per environment | ||
# by uncommenting the line below and defining dev.exs, test.exs and such. | ||
# Configuration from the imported file will override the ones defined | ||
# here (which is why it is important to import them last). | ||
# | ||
# import_config "#{Mix.env}.exs" | ||
# import_config "#{Mix.env}.exs" | ||
|
||
if Mix.env == :test, do: import_config "test.exs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use Mix.Config | ||
|
||
config :ueberauth, Ueberauth, | ||
providers: [ | ||
vk: { Ueberauth.Strategy.VK, [] }, | ||
] | ||
|
||
config :ueberauth, Ueberauth.Strategy.VK.OAuth, | ||
client_id: "appid", | ||
client_secret: "secret", | ||
redirect_uri: "/callback" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,72 @@ | ||
defmodule UeberauthVK.Mixfile do | ||
use Mix.Project | ||
|
||
@version "0.1.2" | ||
@version "0.1.1" | ||
@url "https://github.com/sobolevn/ueberauth_vk" | ||
|
||
def project do | ||
[app: :ueberauth_vk, | ||
version: @version, | ||
name: "Ueberauth VK Strategy", | ||
package: package, | ||
elixir: "~> 1.1", | ||
build_embedded: Mix.env == :prod, | ||
start_permanent: Mix.env == :prod, | ||
source_url: @url, | ||
homepage_url: @url, | ||
description: description, | ||
deps: deps, | ||
docs: docs] | ||
[ | ||
app: :ueberauth_vk, | ||
version: @version, | ||
name: "Ueberauth VK Strategy", | ||
package: package, | ||
elixir: "~> 1.1", | ||
build_embedded: Mix.env == :prod, | ||
start_permanent: Mix.env == :prod, | ||
source_url: @url, | ||
homepage_url: @url, | ||
description: description, | ||
deps: deps, | ||
docs: docs, | ||
|
||
# Test coverage: | ||
test_coverage: [tool: ExCoveralls], | ||
preferred_cli_env: [ | ||
"coveralls": :test, | ||
"coveralls.detail": :test, | ||
"coveralls.post": :test, | ||
"coveralls.html": :test, | ||
], | ||
] | ||
end | ||
|
||
def application do | ||
[applications: [:logger, :oauth2, :ueberauth]] | ||
end | ||
|
||
defp deps do | ||
[{:ueberauth, "~> 0.2"}, | ||
[ | ||
# Auth: | ||
{:ueberauth, "~> 0.2"}, | ||
{:oauth2, "~> 0.5"}, | ||
|
||
# Tests: | ||
{:exvcr, "~> 0.7", only: :test}, | ||
{:excoveralls, "~> 0.5", only: :test}, | ||
|
||
# Docs: | ||
{:ex_doc, "~> 0.1", only: :dev}, | ||
{:earmark, ">= 0.0.0", only: :dev}, | ||
{:dogma, ">= 0.0.0", only: [:dev, :test]}] | ||
# {:foobar, path: "path/to/foobar"} | ||
end | ||
|
||
defp docs do | ||
[extras: docs_extras, main: "extra-readme"] | ||
# Lint: | ||
{:dogma, "~> 0.1", only: :dev}, | ||
] | ||
end | ||
|
||
defp docs_extras do | ||
["README.md"] | ||
defp docs do | ||
[extras: ["README.md"], main: "readme"] | ||
end | ||
|
||
defp description do | ||
"An Uberauth strategy for VK authentication." | ||
end | ||
|
||
defp package do | ||
[files: ["lib", "mix.exs", "README.md", "LICENSE"], | ||
[ | ||
files: ["lib", "mix.exs", "README.md", "LICENSE"], | ||
maintainers: ["Sobolev Nikita"], | ||
licenses: ["MIT"], | ||
links: %{"GitHub": @url}] | ||
links: %{"GitHub": @url}, | ||
] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
%{"certifi": {:hex, :certifi, "0.1.1"}, | ||
"dogma": {:hex, :dogma, "0.0.11"}, | ||
"earmark": {:hex, :earmark, "0.1.19"}, | ||
"ex_doc": {:hex, :ex_doc, "0.10.0"}, | ||
"hackney": {:hex, :hackney, "1.4.4"}, | ||
"httpoison": {:hex, :httpoison, "0.8.0"}, | ||
"idna": {:hex, :idna, "1.0.2"}, | ||
"mimerl": {:hex, :mimerl, "1.0.0"}, | ||
"mimetype_parser": {:hex, :mimetype_parser, "0.1.0"}, | ||
"oauth2": {:hex, :oauth2, "0.5.0"}, | ||
"plug": {:hex, :plug, "1.1.0"}, | ||
"poison": {:hex, :poison, "1.5.0"}, | ||
"ssl_verify_hostname": {:hex, :ssl_verify_hostname, "1.0.5"}, | ||
"ueberauth": {:hex, :ueberauth, "0.2.0"}} | ||
%{"certifi": {:hex, :certifi, "0.1.1", "7fd287d0fea2d65e99f5bef3b8573fa46f4310078709be969adcbc93a580ee73", [:rebar], []}, | ||
"dogma": {:hex, :dogma, "0.1.7", "927f76a89a809db96e0983b922fc899f601352690aefa123529b8aa0c45123b2", [:mix], [{:poison, ">= 1.0.0", [hex: :poison, optional: false]}]}, | ||
"earmark": {:hex, :earmark, "0.1.19", "ffec54f520a11b711532c23d8a52b75a74c09697062d10613fa2dbdf8a9db36e", [:mix], []}, | ||
"ex_doc": {:hex, :ex_doc, "0.10.0", "f49c237250b829df986486b38f043e6f8e19d19b41101987f7214543f75947ec", [:mix], [{:earmark, "~> 0.1.17 or ~> 0.2", [hex: :earmark, optional: true]}]}, | ||
"exactor": {:hex, :exactor, "2.2.0", "2a7418b82d974fe8276edd62c1facf4a9dc06339cdf11b5dcd10359e107fe5c3", [:mix], []}, | ||
"excoveralls": {:hex, :excoveralls, "0.5.5", "d97b6fc7aa59c5f04f2fa7ec40fc0b7555ceea2a5f7e7c442aad98ddd7f79002", [:mix], [{:hackney, ">= 0.12.0", [hex: :hackney, optional: false]}, {:exjsx, "~> 3.0", [hex: :exjsx, optional: false]}]}, | ||
"exjsx": {:hex, :exjsx, "3.2.0", "7136cc739ace295fc74c378f33699e5145bead4fdc1b4799822d0287489136fb", [:mix], [{:jsx, "~> 2.6.2", [hex: :jsx, optional: false]}]}, | ||
"exvcr": {:hex, :exvcr, "0.7.4", "9e7b4cf5f91ecfabdac7a375610633b28288795503bdff0eb8763c275d367657", [:mix], [{:meck, "~> 0.8.3", [hex: :meck, optional: false]}, {:httpotion, "~> 2.1", [hex: :httpotion, optional: true]}, {:httpoison, "~> 0.8", [hex: :httpoison, optional: true]}, {:exjsx, "~> 3.2", [hex: :exjsx, optional: false]}, {:exactor, "~> 2.2", [hex: :exactor, optional: false]}]}, | ||
"hackney": {:hex, :hackney, "1.4.4", "c4e9fd8d77c79f03c09712500780077aeb6cdfe7bab3f4c56cb87d337a7526d7", [:rebar3], [{:ssl_verify_hostname, "1.0.5", [hex: :ssl_verify_hostname, optional: false]}, {:mimerl, "1.0.0", [hex: :mimerl, optional: false]}, {:idna, "1.0.2", [hex: :idna, optional: false]}, {:certifi, "0.1.1", [hex: :certifi, optional: false]}]}, | ||
"httpoison": {:hex, :httpoison, "0.8.0", "52a958d40b2aa46da418cdf6d8dfd82ba83e94d5e60920dfa5f40c05b34fe073", [:mix], [{:hackney, "~> 1.4.4", [hex: :hackney, optional: false]}]}, | ||
"idna": {:hex, :idna, "1.0.2", "397e3d001c002319da75759b0a81156bf11849c71d565162436d50020cb7265e", [:make], []}, | ||
"jsx": {:hex, :jsx, "2.6.2", "213721e058da0587a4bce3cc8a00ff6684ced229c8f9223245c6ff2c88fbaa5a", [:mix, :rebar], []}, | ||
"meck": {:hex, :meck, "0.8.4", "59ca1cd971372aa223138efcf9b29475bde299e1953046a0c727184790ab1520", [:rebar, :make], []}, | ||
"mimerl": {:hex, :mimerl, "1.0.0", "b9813e0fa1019420da8c8001748d7c34791fd49464cb28762bc22638b1ff6198", [:rebar3], []}, | ||
"mimetype_parser": {:hex, :mimetype_parser, "0.1.0", "069fcf6aa98b1eb90d879b3035f3392acecef1ee212ddc59fa930a6cc15d85e3", [:mix], []}, | ||
"oauth2": {:hex, :oauth2, "0.5.0", "bb46ad20f060540c2726c993b4661a9f89b7acec5568ceae7009560358fbc765", [:mix], [{:poison, "~> 1.3", [hex: :poison, optional: false]}, {:mimetype_parser, "~> 0.1", [hex: :mimetype_parser, optional: false]}, {:httpoison, "~> 0.7", [hex: :httpoison, optional: false]}]}, | ||
"plug": {:hex, :plug, "1.1.0", "69078a481549b81e879e169fbe099a509baf8d6a793db757f39f86258f91db07", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, optional: true]}]}, | ||
"poison": {:hex, :poison, "1.5.2", "560bdfb7449e3ddd23a096929fb9fc2122f709bcc758b2d5d5a5c7d0ea848910", [:mix], []}, | ||
"ssl_verify_hostname": {:hex, :ssl_verify_hostname, "1.0.5", "2e73e068cd6393526f9fa6d399353d7c9477d6886ba005f323b592d389fb47be", [:make], []}, | ||
"ueberauth": {:hex, :ueberauth, "0.2.0", "9160c601b468c6692462a56be7ad8890d1a2d84519d7d9c4541da5b07d6495e1", [:mix], [{:plug, "~> 1.0", [hex: :plug, optional: false]}]}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
[ | ||
{ | ||
"request": { | ||
"body": "client_id=appid&client_secret=secret&code=code_abc&grant_type=authorization_code&redirect_uri=http%3A%2F%2Fwww.example.com%2Fauth%2Fvk%2Fcallback", | ||
"headers": { | ||
"Accept": "application/x-www-form-urlencoded", | ||
"Content-Type": "application/x-www-form-urlencoded" | ||
}, | ||
"method": "post", | ||
"options": [], | ||
"request_body": "", | ||
"url": "https://oauth.vk.com/access_token" | ||
}, | ||
"response": { | ||
"body": "{\"access_token\": \"x\", \"user_ids\": 210700286, \"fields\": \"photo_50,city,verified\"}", | ||
"headers": { | ||
"Server": "Apache", | ||
"Date": "Sun, 03 Jul 2016 19:28:36 GMT", | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Content-Length": "69", | ||
"Connection": "keep-alive", | ||
"X-Powered-By": "PHP/3.2508", | ||
"Set-Cookie": "remixlang=0; expires=Mon, 26 Jun 2017 04:09:35 GMT; path=/; domain=.vk.com", | ||
"Pragma": "no-cache", | ||
"Cache-control": "no-store" | ||
}, | ||
"status_code": 200, | ||
"type": "ok" | ||
} | ||
}, | ||
{ | ||
"request": { | ||
"body": "", | ||
"headers": { | ||
"Accept": "application/json", | ||
"Authorization": "Bearer 2.xxx" | ||
}, | ||
"method": "get", | ||
"options": [], | ||
"request_body": "", | ||
"url": "https://api.vk.com/method/users.get?access_token=x&fields=photo_50,city,verified&user_ids=210700286" | ||
}, | ||
"response": { | ||
"body": "{\"response\":[{\"uid\":210700286,\"first_name\":\"Lindsey\",\"last_name\":\"Stirling\",\"city\":5331,\"photo_50\":\"http:\\\/\\\/cs631329.vk.me\\\/v631329286\\\/23f6e\\\/4-funfNRMwg.jpg\",\"verified\":1}]}", | ||
"headers": { | ||
"Server": "nginx/1.6.1", | ||
"Date": "Sat, 09 Apr 2016 04:05:30 GMT", | ||
"Transfer-Encoding": "chunked", | ||
"Connection": "keep-alive", | ||
"Pragma": "No-cache", | ||
"Cache-Control": "no-cache", | ||
"Expires": "Thu, 01 Jan 1970 00:00:00 GMT", | ||
"Api-Server-IP": "10.75.25.86", | ||
"SINA-LB": "aGEuMTY5LmcxLmh5ZHMubGIuc2luYW5vZGUuY29t", | ||
"SINA-TS": "NGI2ZWMzNjggMCAzNiAzNiA1IDYwCg==" | ||
}, | ||
"status_code": 200, | ||
"type": "ok" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
[ | ||
{ | ||
"request": { | ||
"body": "client_id=appid&client_secret=secret&code=code_abc&grant_type=authorization_code&redirect_uri=http%3A%2F%2Fwww.example.com%2Fauth%2Fvk%2Fcallback", | ||
"headers": { | ||
"Accept": "application/x-www-form-urlencoded", | ||
"Content-Type": "application/x-www-form-urlencoded" | ||
}, | ||
"method": "post", | ||
"options": [], | ||
"request_body": "", | ||
"url": "https://oauth.vk.com/access_token" | ||
}, | ||
"response": { | ||
"body": "{\"access_token\": \"x\", \"user_ids\": 210700286, \"fields\": \"photo_50,city,verified\"}", | ||
"headers": { | ||
"Server": "Apache", | ||
"Date": "Sun, 03 Jul 2016 19:28:36 GMT", | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Content-Length": "69", | ||
"Connection": "keep-alive", | ||
"X-Powered-By": "PHP/3.2508", | ||
"Set-Cookie": "remixlang=0; expires=Mon, 26 Jun 2017 04:09:35 GMT; path=/; domain=.vk.com", | ||
"Pragma": "no-cache", | ||
"Cache-control": "no-store" | ||
}, | ||
"status_code": 200, | ||
"type": "ok" | ||
} | ||
}, | ||
{ | ||
"request": { | ||
"body": "", | ||
"headers": { | ||
"Accept": "application/json", | ||
"Authorization": "Bearer 2.xxx" | ||
}, | ||
"method": "get", | ||
"options": [], | ||
"request_body": "", | ||
"url": "https://api.vk.com/method/users.get?access_token=x&fields=photo_50,city,verified&user_ids=210700286" | ||
}, | ||
"response": { | ||
"body": "{\"response\":[{\"uid\":210700286,\"first_name\":\"Lindsey\",\"last_name\":\"Stirling\",\"city\":5331,\"photo_50\":\"http:\\\/\\\/cs631329.vk.me\\\/v631329286\\\/23f6e\\\/4-funfNRMwg.jpg\",\"verified\":1}]}", | ||
"headers": { | ||
"Server": "nginx/1.6.1", | ||
"Date": "Sat, 09 Apr 2016 04:05:30 GMT", | ||
"Transfer-Encoding": "chunked", | ||
"Connection": "keep-alive", | ||
"Pragma": "No-cache", | ||
"Cache-Control": "no-cache", | ||
"Expires": "Thu, 01 Jan 1970 00:00:00 GMT", | ||
"Api-Server-IP": "10.75.25.86", | ||
"SINA-LB": "aGEuMTY5LmcxLmh5ZHMubGIuc2luYW5vZGUuY29t", | ||
"SINA-TS": "NGI2ZWMzNjggMCAzNiAzNiA1IDYwCg==" | ||
}, | ||
"status_code": 200, | ||
"type": "ok" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"uid": 210700286, | ||
"first_name": "Lindsey", | ||
"last_name": "Stirling", | ||
"city": 5331, | ||
"photo_50": "50.jpg", | ||
"photo_100": "100.jpg", | ||
"verified": 1, | ||
"about": "some info" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<html><body>You are being <a href="https://oauth.vk.com/authorize?client_id=appid&display=page&redirect_uri=http%3A%2F%2Fwww.example.com%2Fauth%2Fvk%2Fcallback&response_type=code&scope=">redirected</a>.</body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,20 @@ | ||
defmodule SpecRouter do | ||
# Credit goes to: | ||
# https://github.com/he9qi/ueberauth_weibo/blob/master/test/test_helper.exs | ||
|
||
require Ueberauth | ||
use Plug.Router | ||
|
||
plug :fetch_query_params | ||
|
||
plug Ueberauth, base_path: "/auth" | ||
|
||
plug :match | ||
plug :dispatch | ||
|
||
get "/auth/vk", do: send_resp(conn, 200, "vk request") | ||
|
||
get "/auth/vk/callback", do: send_resp(conn, 200, "vk callback") | ||
end | ||
|
||
ExUnit.start() |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.