changed to use new library config code and changed internal endpoint naming
parent
5b2d65d546
commit
1b4574a367
|
@ -1,22 +1,27 @@
|
||||||
|
import os
|
||||||
|
|
||||||
from flask import Flask, request
|
from flask import Flask, request
|
||||||
from flask_restful import Api
|
from flask_restful import Api
|
||||||
|
|
||||||
|
from selene.api.base_config import get_base_config
|
||||||
|
|
||||||
from .endpoints import (
|
from .endpoints import (
|
||||||
AuthenticateAntisocialEndpoint,
|
AuthenticateInternalEndpoint,
|
||||||
SocialLoginTokensEndpoint,
|
SocialLoginTokensEndpoint,
|
||||||
AuthorizeFacebookEndpoint,
|
AuthorizeFacebookEndpoint,
|
||||||
AuthorizeGithubEndpoint,
|
AuthorizeGithubEndpoint,
|
||||||
AuthorizeGoogleEndpoint,
|
AuthorizeGoogleEndpoint,
|
||||||
LogoutEndpoint
|
LogoutEndpoint
|
||||||
)
|
)
|
||||||
from .config import get_config_location
|
|
||||||
# Initialize the Flask application and the Flask Restful API
|
# Initialize the Flask application and the Flask Restful API
|
||||||
sso = Flask(__name__)
|
sso = Flask(__name__)
|
||||||
sso.config.from_object(get_config_location())
|
sso.config.from_object(get_base_config())
|
||||||
sso_api = Api(sso, catch_all_404s=True)
|
sso.config['SSO_BASE_URL'] = os.environ['SSO_BASE_URL']
|
||||||
|
|
||||||
# Define the endpoints
|
# Initialize the REST API and define the endpoints
|
||||||
sso_api.add_resource(AuthenticateAntisocialEndpoint, '/api/antisocial')
|
sso_api = Api(sso, catch_all_404s=True)
|
||||||
|
sso_api.add_resource(AuthenticateInternalEndpoint, '/api/antisocial')
|
||||||
sso_api.add_resource(AuthorizeFacebookEndpoint, '/api/social/facebook')
|
sso_api.add_resource(AuthorizeFacebookEndpoint, '/api/social/facebook')
|
||||||
sso_api.add_resource(AuthorizeGithubEndpoint, '/api/social/github')
|
sso_api.add_resource(AuthorizeGithubEndpoint, '/api/social/github')
|
||||||
sso_api.add_resource(AuthorizeGoogleEndpoint, '/api/social/google')
|
sso_api.add_resource(AuthorizeGoogleEndpoint, '/api/social/google')
|
||||||
|
@ -39,3 +44,8 @@ def add_cors_headers(response):
|
||||||
|
|
||||||
|
|
||||||
sso.after_request(add_cors_headers)
|
sso.after_request(add_cors_headers)
|
||||||
|
|
||||||
|
|
||||||
|
@sso.teardown_appcontext
|
||||||
|
def close_db_connections():
|
||||||
|
sso.config['DB_CONNECTION_POOL'].close_all()
|
||||||
|
|
Loading…
Reference in New Issue