improving login flow.
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
{:db {:server "localhost"}}
|
{:db {:server "localhost"}
|
||||||
|
:scheme "http"}
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
{:db {:server "database"}}
|
{:db {:server "database"}
|
||||||
|
:scheme "https"}
|
||||||
|
|||||||
@@ -1,8 +1,27 @@
|
|||||||
version: '2'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
app:
|
nginx-proxy:
|
||||||
ports:
|
|
||||||
- 80:3000
|
|
||||||
restart: always
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/tmp/docker.sock:ro
|
||||||
|
- /opt/integreat/certs/:/etc/nginx/certs:ro
|
||||||
|
- /opt/integreat/etc/nginx/vhost.d:/etc/nginx/vhost.d
|
||||||
|
- /opt/integreat/usr/share/nginx/html:/usr/share/nginx/html
|
||||||
|
letsencrypt:
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
|
- /opt/integreat/certs/:/etc/nginx/certs
|
||||||
|
- /opt/integreat/etc/nginx/vhost.d:/etc/nginx/vhost.d
|
||||||
|
- /opt/integreat/usr/share/nginx/html:/usr/share/nginx/html
|
||||||
|
app:
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
config: /usr/local/config/prod.edn
|
||||||
|
VIRTUAL_HOST: integreat.aws.brycecovertoperations.com
|
||||||
|
LETSENCRYPT_HOST: integreat.aws.brycecovertoperations.com
|
||||||
|
LETSENCRYPT_EMAIL: le@brycecovertoperations.com
|
||||||
database:
|
database:
|
||||||
restart: always
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- /opt/integreat/var/lib/postgresql/data:/var/lib/postgresql/data
|
||||||
@@ -1,13 +1,33 @@
|
|||||||
version: '2'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
|
nginx-proxy:
|
||||||
|
image: jwilder/nginx-proxy:alpine
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
- "443:443"
|
||||||
|
labels:
|
||||||
|
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true"
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/tmp/docker.sock:ro
|
||||||
|
- ./data/certs/:/etc/nginx/certs:ro
|
||||||
|
- ./data/etc/nginx/vhost.d:/etc/nginx/vhost.d
|
||||||
|
- ./data/usr/share/nginx/html:/usr/share/nginx/html
|
||||||
|
letsencrypt:
|
||||||
|
image: jrcs/letsencrypt-nginx-proxy-companion:stable
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
|
- ./data/certs/:/etc/nginx/certs
|
||||||
|
- ./data/etc/nginx/vhost.d:/etc/nginx/vhost.d
|
||||||
|
- ./data/usr/share/nginx/html:/usr/share/nginx/html
|
||||||
app:
|
app:
|
||||||
build: .
|
build: .
|
||||||
ports:
|
expose:
|
||||||
- 3000:3000
|
- 3000
|
||||||
depends_on:
|
depends_on:
|
||||||
- database
|
- database
|
||||||
environment:
|
environment:
|
||||||
config: /usr/local/config/prod.edn
|
config: /usr/local/config/prod.edn
|
||||||
|
VIRTUAL_HOST: local.integreat.aws.brycecovertoperations.com
|
||||||
database:
|
database:
|
||||||
image: postgres:9-alpine
|
image: postgres:9-alpine
|
||||||
ports:
|
ports:
|
||||||
@@ -16,6 +36,8 @@ services:
|
|||||||
POSTGRES_USER: ap
|
POSTGRES_USER: ap
|
||||||
POSTGRES_PASSWORD: fifteen-invoices-imported!
|
POSTGRES_PASSWORD: fifteen-invoices-imported!
|
||||||
POSTGRES_DB: autoap
|
POSTGRES_DB: autoap
|
||||||
|
volumes:
|
||||||
|
- ./data/var/lib/postgresql/data:/var/lib/postgresql/data
|
||||||
migrator:
|
migrator:
|
||||||
build: ./migrator
|
build: ./migrator
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
[clj-fuzzy.metrics :as m]
|
[clj-fuzzy.metrics :as m]
|
||||||
[clj-http.client :as http]
|
[clj-http.client :as http]
|
||||||
[clj-time.core :as time]
|
[clj-time.core :as time]
|
||||||
|
[config.core :refer [env]]
|
||||||
|
|
||||||
[buddy.auth :refer [authenticated?]]
|
[buddy.auth :refer [authenticated?]]
|
||||||
|
|
||||||
@@ -42,16 +43,18 @@
|
|||||||
(GET "/" []
|
(GET "/" []
|
||||||
(response/resource-response "index.html" {:root "public"}))
|
(response/resource-response "index.html" {:root "public"}))
|
||||||
(GET "/api/oauth" {{:strs [code]} :query-params :keys [scheme] :as r {:strs [host]} :headers}
|
(GET "/api/oauth" {{:strs [code]} :query-params :keys [scheme] :as r {:strs [host]} :headers}
|
||||||
|
|
||||||
(try
|
(try
|
||||||
(let [auth (-> "https://accounts.google.com/o/oauth2/token"
|
(let [auth (-> "https://accounts.google.com/o/oauth2/token"
|
||||||
(http/post
|
(http/post
|
||||||
{:form-params {"client_id" google-client-id
|
{:form-params {"client_id" google-client-id
|
||||||
"client_secret" google-client-secret
|
"client_secret" google-client-secret
|
||||||
"code" code
|
"code" code
|
||||||
"redirect_uri" (str (name scheme) "://" host "/api/oauth")
|
"redirect_uri" (str (:scheme env) "://" host "/api/oauth")
|
||||||
"grant_type" "authorization_code"}
|
"grant_type" "authorization_code"}
|
||||||
:as :json})
|
:as :json})
|
||||||
:body)
|
:body)
|
||||||
|
_ (println auth)
|
||||||
token (:access_token auth)
|
token (:access_token auth)
|
||||||
profile (-> (http/get "https://www.googleapis.com/oauth2/v1/userinfo"
|
profile (-> (http/get "https://www.googleapis.com/oauth2/v1/userinfo"
|
||||||
{:headers {"Authorization" (str "Bearer " token)} :as :json})
|
{:headers {"Authorization" (str "Bearer " token)} :as :json})
|
||||||
@@ -74,7 +77,7 @@
|
|||||||
(catch Exception e
|
(catch Exception e
|
||||||
|
|
||||||
{:status 401
|
{:status 401
|
||||||
:body (str "Couldn't authenticate " (.toString e))})))
|
:body (str "Couldn't authenticate " (.toString e))})))
|
||||||
(route/resources "/")
|
(route/resources "/")
|
||||||
(routes (ANY "*" [] (response/resource-response "index.html" {:root "public"}))))
|
(routes (ANY "*" [] (response/resource-response "index.html" {:root "public"}))))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user