Browse Source

Disabled fake BCeID login for OpenShift deployments (will use real BCeID now)

pull/160/head
Mike Olund 8 years ago
parent
commit
4d29aa262b
7 changed files with 56 additions and 13 deletions
  1. +13
    -7
      edivorce/apps/core/middleware/bceid_middleware.py
  2. +19
    -0
      edivorce/apps/core/migrations/0008_auto_20170227_2125.py
  3. +15
    -0
      edivorce/apps/core/migrations/0009_merge.py
  4. +1
    -1
      edivorce/apps/core/models.py
  5. +2
    -1
      edivorce/apps/core/views/main.py
  6. +2
    -0
      edivorce/settings/local.py
  7. +4
    -4
      edivorce/settings/openshift.py

+ 13
- 7
edivorce/apps/core/middleware/bceid_middleware.py View File

@ -18,15 +18,22 @@ class BceidMiddleware(object):
# make the FORCE_SCRIPT_NAME available in templates
request.proxy_root_path = settings.FORCE_SCRIPT_NAME
# todo: Make sure the request is coming from the justice proxy (via IP/host check)
if settings.DEPLOYMENT_TYPE != 'localdev' and not request.META.get('HTTP_SM_USERDN', False):
# 1. Real BCeID user
# 1. Real BCeID user / logged in
# todo: parse the siteminder headers and stick them into a dictionary request.bceid_user
# todo: Make sure the request is coming from the justice proxy (via IP/host check)
if request.session.get('fake-bceid-guid', False):
request.bceid_user = BceidUser(
guid=request.META.get('HTTP_SM_USERDN', ''),
is_authenticated=True,
type='BCEID',
first_name='Bud',
last_name='Bundy'
)
elif request.session.get('fake-bceid-guid', False):
# 2. Fake BCeID user
# 2. Fake BCeID user / logged in
request.bceid_user = BceidUser(
guid=request.session.get('fake-bceid-guid', ''),
is_authenticated=True,
@ -36,8 +43,7 @@ class BceidMiddleware(object):
)
else:
# 3. Anonymous User
# 3. Anonymous User / not logged in
if request.session.get('anon-guid', False):
request.session['anon-guid'] = uuid.uuid4().urn[9:]


+ 19
- 0
edivorce/apps/core/migrations/0008_auto_20170227_2125.py View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0007_auto_20170210_1702'),
]
operations = [
migrations.AlterField(
model_name='bceiduser',
name='user_guid',
field=models.CharField(max_length=50, unique=True, db_index=True),
),
]

+ 15
- 0
edivorce/apps/core/migrations/0009_merge.py View File

@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0008_auto_20170227_2125'),
('core', '0008_auto_20170224_0259'),
]
operations = [
]

+ 1
- 1
edivorce/apps/core/models.py View File

@ -11,7 +11,7 @@ class BceidUser(models.Model):
BCeID user table
"""
user_guid = models.CharField(db_index=True, max_length=36, unique=True, blank=False)
user_guid = models.CharField(db_index=True, max_length=50, unique=True, blank=False)
""" BCEID identifier for user """
date_joined = models.DateTimeField(default=timezone.now)


+ 2
- 1
edivorce/apps/core/views/main.py View File

@ -22,7 +22,8 @@ def intro(request):
def login(request):
if not request.session.get('fake-bceid-guid'):
if settings.DEPLOYMENT_TYPE == 'localdev' and not request.session.get('fake-bceid-guid'):
return redirect(settings.FORCE_SCRIPT_NAME[:-1] + '/bceid')
else:
guid = request.bceid_user.guid


+ 2
- 0
edivorce/settings/local.py View File

@ -16,3 +16,5 @@ TEMPLATES[0]["OPTIONS"]["debug"] = True
WEASYPRINT_URL = 'http://localhost:5005'
WEASYPRINT_CSS_LOOPBACK = 'http://10.200.10.1:8000'
DEPLOYMENT_TYPE = 'localdev'

+ 4
- 4
edivorce/settings/openshift.py View File

@ -48,19 +48,19 @@ COMPRESS_OFFLINE = True
#
# See nginx-proxy/conf.d/server.conf for related settings
#
OPENSHIFT_ENVIRONMENT_TYPE = os.getenv('ENVIRONMENT_TYPE')
DEPLOYMENT_TYPE = os.getenv('ENVIRONMENT_TYPE')
PROXY_URL_PREFIX = ''
if OPENSHIFT_ENVIRONMENT_TYPE == 'dev':
if DEPLOYMENT_TYPE == 'dev':
PROXY_URL_PREFIX = "/divorce-dev"
DEBUG = True
if OPENSHIFT_ENVIRONMENT_TYPE == 'test':
if DEPLOYMENT_TYPE == 'test':
PROXY_URL_PREFIX = "/divorce-test"
if OPENSHIFT_ENVIRONMENT_TYPE == 'prod':
if DEPLOYMENT_TYPE == 'prod':
PROXY_URL_PREFIX = "/divorce"


Loading…
Cancel
Save