def __call__(self): if is_cas_auth_enabled(): # Single-Logout via CAS server return '{}/logout'.format(get_cas_server_url()) else: # Logout via Plone PAS return '{}/logout'.format(api.portal.get().absolute_url())
def redirect_url(self): if is_cas_auth_enabled(): # Single-Logout via CAS server return '{}/logout'.format(get_cas_server_url()) else: # Logout via Plone PAS portal_url_tool = getToolByName(self.context, 'portal_url') return '{}/logout'.format(portal_url_tool())
def get_config(self): config = self.get_info() # Only expose essential configuration for unauthenticated requests if getSecurityManager().getUser() != nobody: config.update(self.get_settings()) config['features'] = self.get_features() config['root_url'] = api.portal.get().absolute_url() config['cas_url'] = get_cas_server_url() return config
def cas_server_url(self): return get_cas_server_url()
def test_trailing_slashes_are_stripped(self): get_current_admin_unit().public_url = 'http://example.com/' applyProfile(self.layer['portal'], 'opengever.setup:casauth') self.assertEquals('http://example.com/portal', get_cas_server_url())
def test_cas_server_url_is_fetched_from_plugin(self): applyProfile(self.layer['portal'], 'opengever.setup:casauth') cas_plugin = self.portal.acl_users.cas_auth cas_plugin.cas_server_url = 'http://cas.example.org' self.assertEquals('http://cas.example.org', get_cas_server_url())
def test_cas_server_url_is_none_if_cas_plugin_is_missing(self): self.assertEquals(None, get_cas_server_url())