feat(api): changed SAML helper

feat(api): changed helper
feat(api): changed EE /signup response
This commit is contained in:
Taha Yassine Kraiem 2021-12-02 12:49:45 +01:00
parent 354f091aae
commit 1ce1203e04
5 changed files with 24 additions and 17 deletions

View file

@ -1,8 +1,8 @@
import math
import random
import re
import string
import math
import requests
local_prefix = 'local-'
@ -367,3 +367,7 @@ def get_internal_project_id(project_id64):
def has_smtp():
return environ["EMAIL_HOST"] is not None and len(environ["EMAIL_HOST"]) > 0
def get_edition():
return "foss" if is_free_open_source_edition() else "ee"

View file

@ -1,24 +1,22 @@
from chalice import Blueprint, Response
from chalicelib import _overrides
from chalicelib.core import metadata, errors_favorite_viewed, slack, alerts, sessions, integration_github, \
integrations_manager
from chalicelib.core import assist
from chalicelib.core import boarding
from chalicelib.core import errors
from chalicelib.core import license
from chalicelib.core import metadata, errors_favorite_viewed, slack, alerts, sessions, integrations_manager
from chalicelib.core import notifications
from chalicelib.core import projects
from chalicelib.core import signup
from chalicelib.core import tenants
from chalicelib.core import users
from chalicelib.core import webhook
from chalicelib.core.collaboration_slack import Slack
from chalicelib.utils import captcha, SAML2_helper
from chalicelib.utils import helper
from chalicelib.utils.helper import environ
from chalicelib.core import tenants
from chalicelib.core import signup
from chalicelib.core import users
from chalicelib.core import projects
from chalicelib.core import errors
from chalicelib.core import notifications
from chalicelib.core import boarding
from chalicelib.core import webhook
from chalicelib.core import license
from chalicelib.core import assist
from chalicelib.core.collaboration_slack import Slack
app = Blueprint(__name__)
_overrides.chalice_app(app)
@ -148,7 +146,10 @@ def put_client(context):
@app.route('/signup', methods=['GET'], authorizer=None)
def get_all_signup():
return {"data": tenants.tenants_exists()}
return {"data": {"tenants": tenants.tenants_exists(),
"sso": SAML2_helper.is_saml2_available(),
"ssoProvider": SAML2_helper.get_saml2_provider(),
"edition": helper.get_edition()}}
@app.route('/signup', methods=['POST', 'PUT'], authorizer=None)

View file

@ -22,7 +22,6 @@ def start_sso():
auth = init_saml_auth(req)
sso_built_url = auth.login()
return Response(
# status_code=301,
status_code=307,
body='',
headers={'Location': sso_built_url, 'Content-Type': 'text/plain'})

View file

@ -102,3 +102,6 @@ def prepare_request(request):
def is_saml2_available():
return idp is not None
def get_saml2_provider():
return "Okta"