Skip to content

Commit

Permalink
Merge pull request #36 from uw-it-aca/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ezturner authored Jan 22, 2020
2 parents 773de00 + 0fd5417 commit aed97ae
Showing 1 changed file with 36 additions and 16 deletions.
52 changes: 36 additions & 16 deletions project/base_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,12 @@
}
}

if os.getenv('CACHE', 'none') == 'memcached':
if os.getenv('CACHE', '') == 'memcached':
RESTCLIENTS_DAO_CACHE_CLASS = 'myuw.util.cache_implementation.MyUWMemcachedCache'
RESTCLIENTS_MEMCACHED_SERVERS = (os.getenv('CACHE_NODE_0', '') + ':' + os.getenv('CACHE_PORT', '11211'), os.getenv('CACHE_NODE_1', '') + ':' + os.getenv('CACHE_PORT', '11211'),)


RESTCLIENTS_MEMCACHED_SERVERS = (
os.getenv('CACHE_NODE_0', '') + ':' + os.getenv('CACHE_PORT', '11211'),
os.getenv('CACHE_NODE_1', '') + ':' + os.getenv('CACHE_PORT', '11211'),
)

STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
Expand Down Expand Up @@ -115,13 +116,13 @@
},
'handlers': {
'stdout': {
'level':'INFO',
'class':'logging.StreamHandler',
'level': 'INFO',
'class': 'logging.StreamHandler',
'stream': sys.stdout
},
'stderr': {
'level':'ERROR',
'class':'logging.StreamHandler',
'level': 'ERROR',
'class': 'logging.StreamHandler',
'stream': sys.stderr
},
},
Expand All @@ -139,22 +140,39 @@
}
}

if os.getenv('AUTH', '') == 'SAML_MOCK' or os.getenv('AUTH', '') == 'SAML':
if os.getenv('AUTH', '').startswith('SAML'):
INSTALLED_APPS += ['uw_saml']
LOGIN_URL = reverse_lazy('saml_login')
LOGOUT_URL = reverse_lazy('saml_logout')
SAML_USER_ATTRIBUTE = os.getenv('SAML_USER_ATTRIBUTE', 'uwnetid')
SAML_FORCE_AUTHN = os.getenv('SAML_FORCE_AUTHN', False)

if os.getenv('AUTH', '') == 'SAML_MOCK':
MOCK_SAML_ATTRIBUTES = {
if os.getenv('AUTH', '') == 'SAML_MOCK' or os.getenv('AUTH', '') == 'SAML_DJANGO_LOGIN':
DEFAULT_SAML_ATTRIBUTES = {
'uwnetid': ['javerage'],
'affiliations': ['student', 'member', 'alum', 'staff', 'employee'],
'eppn': ['[email protected]'],
'scopedAffiliations': ['[email protected]', '[email protected]'],
'isMemberOf': ['u_test_group', 'u_test_another_group',
'u_astratest_myuw_test-support-admin'],
'scopedAffiliations': [
'[email protected]', '[email protected]',
'[email protected]', '[email protected]',
'[email protected]'],
'isMemberOf': ['u_test_group', 'u_test_another_group']
}
if os.getenv('AUTH', '') == 'SAML_MOCK':
MOCK_SAML_ATTRIBUTES = DEFAULT_SAML_ATTRIBUTES

else:
AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',)
DJANGO_LOGIN_MOCK_SAML = {
'NAME_ID': 'mock-nameid',
'SESSION_INDEX': 'mock-session',
'SAML_USERS': [{
'username': os.getenv('DJANGO_LOGIN_USERNAME', 'javerage'),
'password': os.getenv('DJANGO_LOGIN_PASSWORD', ''),
'email': os.getenv('DJANGO_LOGIN_EMAIL', '[email protected]'),
'MOCK_ATTRIBUTES': DEFAULT_SAML_ATTRIBUTES,
}]
}

elif os.getenv('AUTH', '') == 'SAML':
CLUSTER_CNAME = os.getenv('CLUSTER_CNAME', 'localhost')
Expand Down Expand Up @@ -192,7 +210,9 @@
'wantMessagesSigned': os.getenv('SP_WANT_MESSAGES_SIGNED', True),
'wantAssertionsSigned': os.getenv('SP_WANT_ASSERTIONS_SIGNED', False),
'wantAssertionsEncrypted': os.getenv('SP_WANT_ASSERTIONS_ENCRYPTED', False),
'requestedAuthnContext': ['urn:oasis:names:tc:SAML:2.0:ac:classes:TimeSyncToken'] if os.getenv('SP_USE_2FA', False) else False,
'requestedAuthnContext': [
'urn:oasis:names:tc:SAML:2.0:ac:classes:TimeSyncToken'
] if os.getenv('SP_USE_2FA', False) else False,
'failOnAuthnContextMismatch': os.getenv('SP_USE_2FA', False),
}
}
Expand Down Expand Up @@ -379,7 +399,7 @@
RESTCLIENTS_CALENDAR_HOST = 'https://www.trumba.com'

if os.getenv('SDBMYUW_ENV') == 'PROD' or os.getenv('SDBMYUW_ENV') == 'EVAL':
RESTCLIENTS_SDBMYUW_DAO_CLASS='Live'
RESTCLIENTS_SDBMYUW_DAO_CLASS = 'Live'
RESTCLIENTS_SDBMYUW_TIMEOUT = RESTCLIENTS_DEFAULT_TIMEOUT
RESTCLIENTS_SDBMYUW_POOL_SIZE = RESTCLIENTS_DEFAULT_POOL_SIZE
if os.getenv('SDBMYUW_ENV') == 'PROD':
Expand Down

0 comments on commit aed97ae

Please sign in to comment.