Decouple oauth methods from app with a namedtuple
This commit is contained in:
parent
d45b925155
commit
e967fde3ae
7 changed files with 20 additions and 7 deletions
|
@ -1,4 +1,5 @@
|
|||
from oauth.services.gitlab import GitLabOAuthService
|
||||
from util.config import URLSchemeAndHostname
|
||||
from util.config.validators import BaseValidator, ConfigValidationException
|
||||
|
||||
class GitLabTriggerValidator(BaseValidator):
|
||||
|
@ -24,6 +25,7 @@ class GitLabTriggerValidator(BaseValidator):
|
|||
|
||||
client = app.config['HTTPCLIENT']
|
||||
oauth = GitLabOAuthService(config, 'GITLAB_TRIGGER_CONFIG')
|
||||
result = oauth.validate_client_id_and_secret(client, app.config)
|
||||
url_scheme_and_hostname = URLSchemeAndHostname(app.config['PREFERRED_URL_SCHEME'], app.config['SERVER_HOSTNAME'])
|
||||
result = oauth.validate_client_id_and_secret(client, url_scheme_and_hostname)
|
||||
if not result:
|
||||
raise ConfigValidationException('Invalid client id or client secret')
|
||||
|
|
Reference in a new issue