def getConfigOption(config, property_name): """ This is a utility method that returns a CONFIGSECTION_AUTHN_CONNECT config section of a configuration file. """ return cspace.getConfigOptionWithSection(config, CONFIGSECTION_AUTHN_CONNECT, property_name)
def initialize_authn(cls, config, authNInstance): cls.should_reload_authn_config = cspace.getConfigOptionWithSection(cls.config, cspace.CONFIGSECTION_AUTHN_CONNECT, cspace.CSPACE_SHOULD_RELOAD_CONFIG) CSpaceAuthN.initialize(cls.handleAuthNRequest) if config and authNInstance: # # Read the required params from the config file # authNInstance.realm = cspace.getConfigOptionWithSection(config, cspace.CONFIGSECTION_AUTHN_CONNECT, cspace.CSPACE_REALM_PROPERTY) authNInstance.uri = cspace.getConfigOptionWithSection(config, cspace.CONFIGSECTION_AUTHN_CONNECT, cspace.CSPACE_URI_PROPERTY) authNInstance.hostname = cspace.getConfigOptionWithSection(config, cspace.CONFIGSECTION_AUTHN_CONNECT, cspace.CSPACE_HOSTNAME_PROPERTY) authNInstance.protocol = cspace.getConfigOptionWithSection(config, cspace.CONFIGSECTION_AUTHN_CONNECT, cspace.CSPACE_PROTOCOL_PROPERTY) authNInstance.port = cspace.getConfigOptionWithSection(config, cspace.CONFIGSECTION_AUTHN_CONNECT, cspace.CSPACE_PORT_PROPERTY) authNInstance.tenant = cspace.getConfigOptionWithSection(config, cspace.CONFIGSECTION_AUTHN_CONNECT, cspace.CSPACE_TENANT_PROPERTY) logger.info('AuthN initialized')
def initialize_authn(cls, config, authNInstance): cls.should_reload_authn_config = cspace.getConfigOptionWithSection( cls.config, cspace.CONFIGSECTION_AUTHN_CONNECT, cspace.CSPACE_SHOULD_RELOAD_CONFIG ) CSpaceAuthN.initialize(cls.handleAuthNRequest) if config and authNInstance: # # Read the required params from the config file # authNInstance.realm = cspace.getConfigOptionWithSection( config, cspace.CONFIGSECTION_AUTHN_CONNECT, cspace.CSPACE_REALM_PROPERTY ) authNInstance.uri = cspace.getConfigOptionWithSection( config, cspace.CONFIGSECTION_AUTHN_CONNECT, cspace.CSPACE_URI_PROPERTY ) authNInstance.hostname = cspace.getConfigOptionWithSection( config, cspace.CONFIGSECTION_AUTHN_CONNECT, cspace.CSPACE_HOSTNAME_PROPERTY ) authNInstance.protocol = cspace.getConfigOptionWithSection( config, cspace.CONFIGSECTION_AUTHN_CONNECT, cspace.CSPACE_PROTOCOL_PROPERTY ) authNInstance.port = cspace.getConfigOptionWithSection( config, cspace.CONFIGSECTION_AUTHN_CONNECT, cspace.CSPACE_PORT_PROPERTY ) authNInstance.tenant = cspace.getConfigOptionWithSection( config, cspace.CONFIGSECTION_AUTHN_CONNECT, cspace.CSPACE_TENANT_PROPERTY ) logger.info("AuthN initialized")
def initialize(cls, handleAuthNRequest, clearPasswordCache=False): if handleAuthNRequest: cls.handleAuthNRequest = handleAuthNRequest # this is a delegate method that gets called by our AuthN method if clearPasswordCache: cls.resetPasswordCache() cls.config = cspace.getConfig(path.dirname(__file__), CSPACE_AUTHN_CONFIG_FILENAME) if cspace.getConfigOptionWithSection(cls.config, CONFIGSECTION_AUTHN_INFO, CSPACE_AUTHN_OVERRIDE_PROPERTY) == "True": cls.overrideWithConfig = True else: cls.overrideWithConfig = False
def initialize(cls): """ Initializes our site. """ if cspace_django_site.shouldInitialize() is False: logger.warning('Reinitializing the site.') cls.config = cls.loadConfig() cls.should_reload_config = cspace.getConfigOptionWithSection(cls.config, cspace.CONFIGSECTION_INFO, cspace.CSPACE_SHOULD_RELOAD_CONFIG) cls.initialize_authn(None, None) cls.is_initialized = True
def initialize(cls): """ Initializes our site. """ if ucb_deployment_site.shouldInitialize() is False: print "Warning. Reinitializing the site." cls.config = cls.loadConfig() cls.should_reload_config = cspace.getConfigOptionWithSection( cls.config, cspace.CONFIGSECTION_INFO, cspace.CSPACE_SHOULD_RELOAD_CONFIG ) cls.initialize_authn(None, None) cls.is_initialized = True
def initialize(cls, handleAuthNRequest, clearPasswordCache=False): if handleAuthNRequest: cls.handleAuthNRequest = handleAuthNRequest # a delegate method that gets called by our AuthN method if clearPasswordCache: cls.resetPasswordCache() cls.config = cspace.getConfig(path.dirname(__file__), CSPACE_AUTHN_CONFIG_FILENAME) if cspace.getConfigOptionWithSection(cls.config, CONFIGSECTION_AUTHN_INFO, CSPACE_AUTHN_OVERRIDE_PROPERTY) \ == "True": cls.overrideWithConfig = True else: cls.overrideWithConfig = False
__author__ = 'jblowe' from django.shortcuts import render, HttpResponse import json from django.conf import settings from os import path import time from cspace_django_site.main import cspace_django_site from common import cspace from common import appconfig from common.utils import devicetype config = cspace_django_site.getConfig() hostname = cspace.getConfigOptionWithSection(config, cspace.CONFIGSECTION_AUTHN_CONNECT, cspace.CSPACE_HOSTNAME_PROPERTY) TITLE = 'Applications Available' landingConfig = cspace.getConfig(path.join(settings.BASE_PARENT_DIR, 'config'), 'landing') hiddenApps = landingConfig.get('landing', 'hiddenApps').split(',') publicApps = landingConfig.get('landing', 'publicApps').split(',') def getapplist(request): appList = [app for app in settings.INSTALLED_APPS if not "django" in app and not app in hiddenApps] appList.sort() appList = [(app,path.join(settings.WSGI_BASE, app)) for app in appList] return appList
__author__ = 'jblowe' from django.contrib.auth.decorators import login_required from django.shortcuts import render from django.conf import settings from cspace_django_site.main import cspace_django_site from common import cspace config = cspace_django_site.getConfig() hostname = cspace.getConfigOptionWithSection(config, cspace.CONFIGSECTION_AUTHN_CONNECT, cspace.CSPACE_HOSTNAME_PROPERTY) TITLE = 'Applications Available' hiddenApps = 'hello service suggest suggestsolr suggestpostgres solarapi imageserver'.split(' ') #@login_required() def index(request): config = cspace_django_site.getConfig() appList = [app for app in settings.INSTALLED_APPS if not "django" in app and not app in hiddenApps] appList.sort() return render(request, 'listApps.html', {'appList': appList, 'labels': 'name file'.split(' '), 'title': TITLE, 'hostname': hostname})
def getConfigOption(config, property_name): """ """ return cspace.getConfigOptionWithSection(config, CONFIGSECTION_AUTHN_CONNECT, property_name)