[v0.0.2] Adds Google and Github OAuth2 Authentication
Adds to the API the feature of OAuth2 Authentication via two providers: Google and Github. For that the tests were updated.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
com:
|
||||
hideyoshi:
|
||||
frontEndPath: ${FRONTEND_PATH}
|
||||
frontendPath: ${FRONTEND_PATH}
|
||||
frontendConnectionType: ${FRONTEND_CONNECTION_TYPE}
|
||||
tokenSecret: ${TOKEN_SECRET}
|
||||
accessTokenDuration: ${ACCESS_TOKEN_DURATION}
|
||||
@@ -17,6 +17,26 @@ server:
|
||||
|
||||
spring:
|
||||
|
||||
security:
|
||||
oauth2:
|
||||
client:
|
||||
registration:
|
||||
|
||||
google:
|
||||
clientId: ${GOOGLE_CLIENT_ID}
|
||||
clientSecret: ${GOOGLE_CLIENT_SECRET}
|
||||
redirectUri: ${GOOGLE_REDIRECT_URL}
|
||||
scope:
|
||||
- email
|
||||
- profile
|
||||
|
||||
github:
|
||||
clientId: ${GITHUB_CLIENT_ID}
|
||||
clientSecret: ${GITHUB_CLIENT_SECRET}
|
||||
redirectUri: ${GITHUB_REDIRECT_URL}
|
||||
scope:
|
||||
- user
|
||||
|
||||
datasource:
|
||||
url: jdbc:${DATABASE_URL}
|
||||
username: ${DATABASE_USERNAME}
|
||||
|
||||
@@ -8,4 +8,14 @@ databaseChangeLog:
|
||||
encoding: utf8
|
||||
path: sqls/db-table-model-client.sql
|
||||
relativeToChangelogFile: true
|
||||
dbms: postgresql
|
||||
dbms: postgresql
|
||||
|
||||
- changeSet:
|
||||
id: adds-user-provider
|
||||
author: vitor.h.n.batista@gmail.com
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: sqls/adds-user-provider.sql
|
||||
relativeToChangelogFile: true
|
||||
dbms: postgresql
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
alter table if exists auth."user"
|
||||
rename column "full_name" to "name";
|
||||
|
||||
ALTER TABLE IF EXISTS auth.user
|
||||
ADD COLUMN IF NOT EXISTS provider VARCHAR
|
||||
CHECK ( provider IN ('google', 'github', 'local') ) DEFAULT 'local' NOT NULL;
|
||||
|
||||
ALTER TABLE auth."user"
|
||||
DROP CONSTRAINT IF EXISTS client_email_unique;
|
||||
|
||||
ALTER TABLE auth."user"
|
||||
DROP CONSTRAINT IF EXISTS user_email_provider_unique;
|
||||
ALTER TABLE auth."user"
|
||||
ADD CONSTRAINT user_email_provider_unique UNIQUE (email, provider);
|
||||
Reference in New Issue
Block a user