Renaming social endpoint classes
parent
af52de4d70
commit
d434492325
|
@ -4,9 +4,9 @@ from flask_restful import Api
|
|||
from .endpoints import (
|
||||
AuthenticateAntisocialEndpoint,
|
||||
AuthenticateSocialEndpoint,
|
||||
AuthorizeFacebookView,
|
||||
AuthorizeGithubView,
|
||||
AuthorizeGoogleView,
|
||||
AuthorizeFacebookEndpoint,
|
||||
AuthorizeGithubEndpoint,
|
||||
AuthorizeGoogleEndpoint,
|
||||
LogoutEndpoint
|
||||
)
|
||||
from .config import get_config_location
|
||||
|
@ -17,9 +17,9 @@ login_api = Api(login, catch_all_404s=True)
|
|||
|
||||
# Define the endpoints
|
||||
login_api.add_resource(AuthenticateAntisocialEndpoint, '/api/antisocial')
|
||||
login_api.add_resource(AuthorizeFacebookView, '/api/social/facebook')
|
||||
login_api.add_resource(AuthorizeGithubView, '/api/social/github')
|
||||
login_api.add_resource(AuthorizeGoogleView, '/api/social/google')
|
||||
login_api.add_resource(AuthorizeFacebookEndpoint, '/api/social/facebook')
|
||||
login_api.add_resource(AuthorizeGithubEndpoint, '/api/social/github')
|
||||
login_api.add_resource(AuthorizeGoogleEndpoint, '/api/social/google')
|
||||
login_api.add_resource(AuthenticateSocialEndpoint, '/api/social')
|
||||
login_api.add_resource(LogoutEndpoint, '/api/logout')
|
||||
|
||||
|
@ -38,4 +38,4 @@ def add_cors_headers(response):
|
|||
return response
|
||||
|
||||
|
||||
login.after_request(add_cors_headers)
|
||||
#login.after_request(add_cors_headers)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from .authenticate_antisocial import AuthenticateAntisocialEndpoint
|
||||
from .authenticate_social import AuthenticateSocialEndpoint
|
||||
from .facebook import AuthorizeFacebookView
|
||||
from .github import AuthorizeGithubView
|
||||
from .google import AuthorizeGoogleView
|
||||
from .facebook import AuthorizeFacebookEndpoint
|
||||
from .github import AuthorizeGithubEndpoint
|
||||
from .google import AuthorizeGoogleEndpoint
|
||||
from .logout import LogoutEndpoint
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from flask import current_app, redirect
|
||||
from flask_restful import Resource
|
||||
from selene_util.api import SeleneEndpoint
|
||||
|
||||
THIRTY_DAYS = 2592000
|
||||
|
||||
|
||||
class AuthorizeFacebookView(Resource):
|
||||
class AuthorizeFacebookEndpoint(SeleneEndpoint):
|
||||
|
||||
def get(self):
|
||||
return self._validate_token()
|
||||
|
@ -13,5 +13,5 @@ class AuthorizeFacebookView(Resource):
|
|||
def _validate_token(self):
|
||||
tartarus = current_app.config['TARTARUS_BASE_URL']
|
||||
selene = current_app.config['SELENE_BASE_URL']
|
||||
auth_endpoint = f'{tartarus}/social/auth/facebook?clientUri={selene}/api/auth/social&path=/social/login'
|
||||
auth_endpoint = f'{tartarus}/social/auth/facebook?clientUri={selene}/api/social&path=/social/login'
|
||||
return redirect(auth_endpoint)
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
from flask import current_app, redirect
|
||||
from flask_restful import Resource
|
||||
from selene_util.api import SeleneEndpoint
|
||||
|
||||
|
||||
class AuthorizeGithubView(Resource):
|
||||
class AuthorizeGithubEndpoint(SeleneEndpoint):
|
||||
|
||||
def get(self):
|
||||
return self._validate_token()
|
||||
#return "ok"
|
||||
|
||||
def _validate_token(self):
|
||||
tartarus = current_app.config['TARTARUS_BASE_URL']
|
||||
selene = current_app.config['SELENE_BASE_URL']
|
||||
auth_endpoint = f'{tartarus}/social/auth/github?clientUri={selene}/api/auth/social&path=/social/login'
|
||||
auth_endpoint = f'{tartarus}/social/auth/github?clientUri={selene}/api/social&path=/social/login'
|
||||
return redirect(auth_endpoint)
|
|
@ -1,8 +1,8 @@
|
|||
from flask import current_app, redirect
|
||||
from flask_restful import Resource
|
||||
from selene_util.api import SeleneEndpoint
|
||||
|
||||
|
||||
class AuthorizeGoogleView(Resource):
|
||||
class AuthorizeGoogleEndpoint(SeleneEndpoint):
|
||||
|
||||
def get(self):
|
||||
return self._validate_token()
|
||||
|
@ -10,5 +10,5 @@ class AuthorizeGoogleView(Resource):
|
|||
def _validate_token(self):
|
||||
tartarus = current_app.config['TARTARUS_BASE_URL']
|
||||
selene = current_app.config['SELENE_BASE_URL']
|
||||
auth_endpoint = f'{tartarus}/social/auth/google?clientUri={selene}/api/auth/social&path=/social/login'
|
||||
auth_endpoint = f'{tartarus}/social/auth/google?clientUri={selene}/api/social&path=/social/login'
|
||||
return redirect(auth_endpoint)
|
Loading…
Reference in New Issue