Commit 625bd291 authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis

snf-cyclades-app: Use the new AstakosClient

Change AstakosClient to use ASTAKOS_AUTH_URL as entry point to the
Astakos service, instead of ASTAKOS_BASE_URL it was using until now.

Remove ASTAKOS_BASE_URL from Cyclades settings, replace it with
ASTAKOS_AUTH_URL. Modify Cyclades to determine ASTAKOS_ACCOUNT_URL and
ASTAKOS_UI_URL with calls to astakosclient.
parent f041ab50
......@@ -1858,9 +1858,6 @@ Edit ``/etc/synnefo/20-snf-cyclades-app-api.conf``:
CYCLADES_BASE_URL = 'https://node1.example.com/cyclades'
ASTAKOS_BASE_URL = 'https://node1.example.com/astakos'
# Set to False if astakos & cyclades are on the same host
CYCLADES_PROXY_USER_SERVICES = False
CYCLADES_SERVICE_TOKEN = 'cyclades_service_token22w'
The ``ASTAKOS_BASE_URL`` denotes the Astakos endpoint for Cyclades,
......
......@@ -56,10 +56,10 @@ else:
ASTAKOS_IM_MODULES = ['local', 'shibboleth']
CYCLADES_PROXY_USER_SERVICES = False
PITHOS_PROXY_USER_SERVICES = False
ASTAKOS_BASE_URL = 'http://accounts.example.synnefo.org/astakos/'
ASTAKOS_AUTH_URL = 'http://accounts.example.synnefo.org/astakos/identity/v2.0/'
COMPUTE_BASE_URL = 'http://compute.example.synnefo.org/cyclades/'
PITHOS_BASE_URL = 'http://storage.example.synnefo.org/pithos/'
......
......@@ -82,8 +82,8 @@
#MAX_PERSONALITY_SIZE = 10240
#
#
## Top-level URL of the astakos instance to be used for user management
#ASTAKOS_BASE_URL = 'https://accounts.example.synnefo.org/'
## Authentication URL of the astakos instance to be used for user management
#ASTAKOS_AUTH_URL = 'https://accounts.example.synnefo.org/identity/v2.0/'
#
## Key for password encryption-decryption. After changing this setting, synnefo
## will be unable to decrypt all existing Backend passwords. You will need to
......@@ -97,10 +97,8 @@
## using a user uuid)
#CYCLADES_SERVICE_TOKEN = ''
# Let cyclades proxy user specific api calls to astakos, via self served
# endpoints. Set this to False if you deploy cyclades-app/astakos-app on the
# same machine.
#CYCLADES_PROXY_USER_SERVICES = True
## PROXY Astakos services under the following path
#CYCLADES_PROXY_PREFIX = '_astakos'
# Tune the size of the http connection pool to astakos.
#CYCLADES_ASTAKOSCLIENT_POOLSIZE = 50
......
......@@ -36,7 +36,7 @@ from optparse import make_option
from snf_django.management.commands import ListCommand
from synnefo.db.models import Network
from synnefo.settings import (CYCLADES_SERVICE_TOKEN as ASTAKOS_TOKEN,
ASTAKOS_BASE_URL)
ASTAKOS_AUTH_URL)
from logging import getLogger
log = getLogger(__name__)
......@@ -63,7 +63,7 @@ class Command(ListCommand):
object_class = Network
deleted_field = "deleted"
user_uuid_field = "userid"
astakos_url = ASTAKOS_BASE_URL
astakos_auth_url = ASTAKOS_AUTH_URL
astakos_token = ASTAKOS_TOKEN
def get_machines(network):
......
......@@ -41,7 +41,7 @@ from synnefo.logic.rapi import GanetiApiError
from synnefo.management.common import Omit
from synnefo.management import common
from synnefo.settings import (CYCLADES_SERVICE_TOKEN as ASTAKOS_TOKEN,
ASTAKOS_BASE_URL)
ASTAKOS_AUTH_URL)
# Fields to print from a gnt-instance info
......@@ -82,7 +82,7 @@ class Command(BaseCommand):
displayname = options['displayname']
ucache = UserCache(ASTAKOS_BASE_URL, ASTAKOS_TOKEN)
ucache = UserCache(ASTAKOS_AUTH_URL, ASTAKOS_TOKEN)
try:
image = common.get_image(vm.imageid, vm.userid)['name']
......
......@@ -38,7 +38,7 @@ from synnefo.db.models import VirtualMachine
from synnefo.management.common import get_backend
from synnefo.api.util import get_image
from synnefo.settings import (CYCLADES_SERVICE_TOKEN as ASTAKOS_TOKEN,
ASTAKOS_BASE_URL)
ASTAKOS_AUTH_URL)
from logging import getLogger
log = getLogger(__name__)
......@@ -74,7 +74,7 @@ class Command(ListCommand):
object_class = VirtualMachine
deleted_field = "deleted"
user_uuid_field = "userid"
astakos_url = ASTAKOS_BASE_URL
astakos_auth_url = ASTAKOS_AUTH_URL
astakos_token = ASTAKOS_TOKEN
def get_public_ip(vm):
......
......@@ -37,7 +37,7 @@ from synnefo.management.common import (format_vm_state, get_vm,
get_image)
from snf_django.lib.astakos import UserCache
from synnefo.settings import (CYCLADES_SERVICE_TOKEN as ASTAKOS_TOKEN,
ASTAKOS_BASE_URL)
ASTAKOS_AUTH_URL)
from snf_django.management import utils
......@@ -61,7 +61,7 @@ class Command(SynnefoCommand):
image_name = "None"
image = '%s (%s)' % (imageid, image_name)
usercache = UserCache(ASTAKOS_BASE_URL, ASTAKOS_TOKEN)
usercache = UserCache(ASTAKOS_AUTH_URL, ASTAKOS_TOKEN)
kv = {
'id': server.id,
'name': server.name,
......
......@@ -81,8 +81,8 @@ MAX_PERSONALITY = 5
MAX_PERSONALITY_SIZE = 10240
# Top-level URL of the astakos instance to be used for user management
ASTAKOS_BASE_URL = 'https://accounts.example.synnefo.org/'
# Authentication URL of the astakos instance to be used for user management
ASTAKOS_AUTH_URL = 'https://accounts.example.synnefo.org/identity/v2.0'
# Tune the size of the Astakos http client connection pool
# This limit the number of concurrent requests to Astakos.
......@@ -100,11 +100,6 @@ SECRET_ENCRYPTION_KEY = "Password Encryption Key"
# using a user uuid)
CYCLADES_SERVICE_TOKEN = ''
# Let cyclades proxy user specific api calls to astakos, via self served
# endpoints. Set this to False if you deploy cyclades-app/astakos-app on the
# same machine.
CYCLADES_PROXY_USER_SERVICES = True
# Template to use to build the FQDN of VMs. The setting will be formated with
# the id of the VM. If set to 'None' the first public IPv4 or IPv6 address
# of the VM will be used.
......
......@@ -40,9 +40,11 @@ from snf_django.utils.urls import \
from snf_django.lib.api.urls import api_patterns
from synnefo.cyclades_settings import (
BASE_PATH, COMPUTE_PREFIX, VMAPI_PREFIX,
PLANKTON_PREFIX, HELPDESK_PREFIX, UI_PREFIX, ASTAKOS_BASE_URL,
USERDATA_PREFIX, ADMIN_PREFIX, BASE_ASTAKOS_PROXY_PATH,
ASTAKOS_ACCOUNTS_PREFIX, ASTAKOS_VIEWS_PREFIX, PROXY_USER_SERVICES,
PLANKTON_PREFIX, HELPDESK_PREFIX, UI_PREFIX,
USERDATA_PREFIX, ADMIN_PREFIX,
ASTAKOS_AUTH_PROXY_PATH, ASTAKOS_AUTH_URL,
ASTAKOS_ACCOUNT_PROXY_PATH, ASTAKOS_ACCOUNT_URL,
ASTAKOS_UI_PROXY_PATH, ASTAKOS_UI_URL,
cyclades_services)
from functools import partial
......@@ -56,9 +58,6 @@ extend_endpoint_with_slash(urlpatterns, cyclades_services, 'cyclades_helpdesk')
extend_endpoint_with_slash(urlpatterns, cyclades_services, 'admin')
extend_endpoint_with_slash(urlpatterns, cyclades_services, 'cyclades_userdata')
astakos_proxy = partial(proxy, proxy_base=BASE_ASTAKOS_PROXY_PATH,
target_base=ASTAKOS_BASE_URL)
cyclades_patterns = api_patterns(
'',
(prefix_pattern(VMAPI_PREFIX), include('synnefo.vmapi.urls')),
......@@ -79,27 +78,30 @@ urlpatterns += patterns(
(prefix_pattern(BASE_PATH), include(cyclades_patterns)),
)
if PROXY_USER_SERVICES:
astakos_proxy = partial(proxy, proxy_base=BASE_ASTAKOS_PROXY_PATH,
target_base=ASTAKOS_BASE_URL)
proxy_patterns = patterns(
'',
(prefix_pattern(ASTAKOS_VIEWS_PREFIX), astakos_proxy),
)
proxy_patterns += api_patterns(
'',
(r'^login/?$', astakos_proxy),
(r'^feedback/?$', astakos_proxy),
(r'^user_catalogs/?$', astakos_proxy),
(prefix_pattern(ASTAKOS_ACCOUNTS_PREFIX), astakos_proxy),
)
# --------------------------------------
# PROXY settings
astakos_auth_proxy = \
partial(proxy, proxy_base=ASTAKOS_AUTH_PROXY_PATH,
target_base=ASTAKOS_AUTH_URL)
astakos_account_proxy = \
partial(proxy, proxy_base=ASTAKOS_ACCOUNT_PROXY_PATH,
target_base=ASTAKOS_ACCOUNT_URL)
astakos_ui_proxy = \
partial(proxy, proxy_base=ASTAKOS_UI_PROXY_PATH,
target_base=ASTAKOS_UI_URL)
urlpatterns += patterns(
'',
(prefix_pattern(BASE_ASTAKOS_PROXY_PATH), include(proxy_patterns)),
)
urlpatterns += api_patterns(
'',
(prefix_pattern(ASTAKOS_AUTH_PROXY_PATH), astakos_auth_proxy),
(prefix_pattern(ASTAKOS_ACCOUNT_PROXY_PATH), astakos_account_proxy),
)
urlpatterns += patterns(
'',
(prefix_pattern(ASTAKOS_UI_PROXY_PATH), astakos_ui_proxy),
)
# --------------------------------------
# set utility redirects
extend_with_root_redirects(urlpatterns, cyclades_services, 'cyclades_ui',
BASE_PATH)
......@@ -36,16 +36,18 @@ from synnefo.lib import join_urls, parse_base_url
from synnefo.util.keypath import get_path, set_path
from synnefo.api.services import cyclades_services as vanilla_cyclades_services
from synnefo.lib.services import fill_endpoints
from astakosclient import astakos_services as vanilla_astakos_services
from astakosclient import AstakosClient
from copy import deepcopy
# --------------------------------------------------------------------
# Process Cyclades settings
BASE_URL = getattr(settings, 'CYCLADES_BASE_URL',
'https://compute.example.synnefo.org/compute/')
BASE_HOST, BASE_PATH = parse_base_url(BASE_URL)
SERVICE_TOKEN = getattr(settings, 'CYCLADES_SERVICE_TOKEN', "")
CUSTOMIZE_SERVICES = getattr(settings, 'CYCLADES_CUSTOMIZE_SERVICES', ())
cyclades_services = deepcopy(vanilla_cyclades_services)
......@@ -64,33 +66,44 @@ ADMIN_PREFIX = get_path(cyclades_services, 'cyclades_admin.prefix')
COMPUTE_ROOT_URL = join_urls(BASE_URL, COMPUTE_PREFIX)
# --------------------------------------------------------------------
# Process Astakos settings
ASTAKOS_BASE_URL = getattr(settings, 'ASTAKOS_BASE_URL',
'https://accounts.example.synnefo.org/astakos/')
ASTAKOS_BASE_HOST, ASTAKOS_BASE_PATH = parse_base_url(ASTAKOS_BASE_URL)
# Patch astakosclient directly, otherwise it will not see any customization
#astakos_services = deepcopy(vanilla_astakos_services)
CUSTOMIZE_ASTAKOS_SERVICES = \
getattr(settings, 'CYCLADES_CUSTOMIZE_ASTAKOS_SERVICES', ())
astakos_services = deepcopy(vanilla_astakos_services)
fill_endpoints(astakos_services, ASTAKOS_BASE_URL)
for path, value in CUSTOMIZE_ASTAKOS_SERVICES:
set_path(astakos_services, path, value, createpath=True)
ASTAKOS_ACCOUNTS_PREFIX = get_path(astakos_services, 'astakos_account.prefix')
ASTAKOS_VIEWS_PREFIX = get_path(astakos_services, 'astakos_ui.prefix')
ASTAKOS_KEYSTONE_PREFIX = get_path(astakos_services, 'astakos_identity.prefix')
# Proxy Astakos settings
BASE_ASTAKOS_PROXY_PATH = getattr(settings,
'CYCLADES_BASE_ASTAKOS_PROXY_PATH',
ASTAKOS_BASE_PATH)
BASE_ASTAKOS_PROXY_PATH = join_urls(BASE_PATH, BASE_ASTAKOS_PROXY_PATH)
BASE_ASTAKOS_PROXY_PATH = BASE_ASTAKOS_PROXY_PATH.strip('/')
PROXY_USER_SERVICES = getattr(settings, 'CYCLADES_PROXY_USER_SERVICES', True)
ASTAKOS_AUTH_URL = getattr(
settings, 'ASTAKOS_AUTH_URL',
'https://accounts.example.synnefo.org/astakos/identity/v2.0/')
# --------------------------------------
# Define a LazyAstakosUrl
class LazyAstakosUrl(object):
def __init__(self, endpoints_name):
self.endpoints_name = endpoints_name
def __str__(self):
if not hasattr(self, 'str'):
try:
astakos_client = \
AstakosClient(SERVICE_TOKEN, ASTAKOS_AUTH_URL)
self.str = getattr(astakos_client, self.endpoints_name)
except:
return None
return self.str
# --------------------------------------
# Define ASTAKOS_UI_URL and ASTAKOS_ACCOUNT_URL as LazyAstakosUrl
ASTAKOS_ACCOUNT_URL = LazyAstakosUrl('account_url')
ASTAKOS_UI_URL = LazyAstakosUrl('ui_url')
# --------------------------------------
# Define Astakos prefixes
ASTAKOS_PROXY_PREFIX = getattr(settings, 'CYCLADES_PROXY_PREFIX', '_astakos')
ASTAKOS_AUTH_PREFIX = join_urls('/', ASTAKOS_PROXY_PREFIX, 'identity')
ASTAKOS_ACCOUNT_PREFIX = join_urls('/', ASTAKOS_PROXY_PREFIX, 'account')
ASTAKOS_UI_PREFIX = join_urls('/', ASTAKOS_PROXY_PREFIX, 'ui')
# --------------------------------------
# Define Astakos proxy paths
ASTAKOS_AUTH_PROXY_PATH = join_urls(BASE_PATH, ASTAKOS_AUTH_PREFIX)
ASTAKOS_ACCOUNT_PROXY_PATH = join_urls(BASE_PATH, ASTAKOS_ACCOUNT_PREFIX)
ASTAKOS_UI_PROXY_PATH = join_urls(BASE_PATH, ASTAKOS_UI_PREFIX)
......@@ -56,13 +56,13 @@ class AstakosClientMock():
def __init__(*args, **kwargs):
pass
def get_username(self, token, uuid):
def get_username(self, uuid):
try:
return USERS_UUIDS.get(uuid)['displayname']
except TypeError:
return None
def get_uuid(self, token, display_name):
def get_uuid(self, display_name):
try:
return USERS_DISPLAYNAMES.get(display_name)['uuid']
except TypeError:
......
......@@ -114,7 +114,7 @@ def helpdesk_user_required(func, permitted_groups=PERMITTED_GROUPS):
raise Http404
token = get_token_from_cookie(request, AUTH_COOKIE_NAME)
astakos.get_user(request, settings.ASTAKOS_BASE_URL,
astakos.get_user(request, settings.ASTAKOS_AUTH_URL,
fallback_token=token, logger=logger)
if hasattr(request, 'user') and request.user:
groups = request.user.get('groups', [])
......@@ -204,22 +204,22 @@ def account(request, search_query):
account = None
search_query = vmid
astakos_client = astakosclient.AstakosClient(settings.ASTAKOS_BASE_URL,
retry=2, use_pool=True,
logger=logger)
astakos_client = astakosclient.AstakosClient(
auth_token, settings.ASTAKOS_AUTH_URL,
retry=2, use_pool=True, logger=logger)
account = None
if is_uuid:
account = search_query
try:
account_name = astakos_client.get_username(auth_token, account)
account_name = astakos_client.get_username(account)
except:
logger.info("Failed to resolve '%s' into account" % account)
if account_exists and not is_uuid:
account_name = search_query
try:
account = astakos_client.get_uuid(auth_token, account_name)
account = astakos_client.get_uuid(account_name)
except:
logger.info("Failed to resolve '%s' into account" % account_name)
......
......@@ -33,7 +33,7 @@
from synnefo.db.models import FloatingIP
from snf_django.management.commands import ListCommand
from synnefo.settings import CYCLADES_SERVICE_TOKEN, ASTAKOS_BASE_URL
from synnefo.settings import CYCLADES_SERVICE_TOKEN, ASTAKOS_AUTH_URL
from logging import getLogger
log = getLogger(__name__)
......@@ -43,7 +43,7 @@ class Command(ListCommand):
object_class = FloatingIP
deleted_field = "deleted"
user_uuid_field = "userid"
astakos_url = ASTAKOS_BASE_URL
astakos_auth_url = ASTAKOS_AUTH_URL
astakos_token = CYCLADES_SERVICE_TOKEN
FIELDS = {
......
......@@ -43,7 +43,7 @@ from synnefo.db.models import (Backend, BackendNetwork,
from synnefo.logic.rapi import GanetiApiError
from snf_django.lib.astakos import UserCache
from synnefo.settings import (CYCLADES_SERVICE_TOKEN as ASTAKOS_TOKEN,
ASTAKOS_BASE_URL)
ASTAKOS_AUTH_URL)
from util import pool_map_chunks
......@@ -66,7 +66,7 @@ class Command(BaseCommand):
net = get_network(args[0])
ucache = UserCache(ASTAKOS_BASE_URL, ASTAKOS_TOKEN)
ucache = UserCache(ASTAKOS_AUTH_URL, ASTAKOS_TOKEN)
displayname = options['displayname']
......
......@@ -220,7 +220,7 @@ class ServerCommandTest(TransactionTestCase):
mrapi().StartupInstance.return_value = 1
with mocked_quotaholder() as m:
servers.start(vm)
m.resolve_commissions.assert_called_once_with('', [],
m.resolve_commissions.assert_called_once_with([],
[serial.serial])
self.assertTrue(m.issue_one_commission.called)
# Not pending, rejct
......@@ -233,7 +233,7 @@ class ServerCommandTest(TransactionTestCase):
mrapi().StartupInstance.return_value = 1
with mocked_quotaholder() as m:
servers.start(vm)
m.resolve_commissions.assert_called_once_with('', [],
m.resolve_commissions.assert_called_once_with([],
[serial.serial])
self.assertTrue(m.issue_one_commission.called)
# Not pending, accept
......@@ -246,7 +246,7 @@ class ServerCommandTest(TransactionTestCase):
mrapi().StartupInstance.return_value = 1
with mocked_quotaholder() as m:
servers.start(vm)
m.resolve_commissions.assert_called_once_with('', [serial.serial],
m.resolve_commissions.assert_called_once_with([serial.serial],
[])
self.assertTrue(m.issue_one_commission.called)
......@@ -259,7 +259,7 @@ class ServerCommandTest(TransactionTestCase):
servers.start(vm)
except:
m.resolve_commissions\
.assert_called_once_with('', [], [vm.serial.serial])
.assert_called_once_with([], [vm.serial.serial])
def test_task_after(self, mrapi):
return
......
......@@ -78,7 +78,7 @@ from pithos.backends.util import PithosBackendPool
_pithos_backend_pool = \
PithosBackendPool(
settings.PITHOS_BACKEND_POOL_SIZE,
astakos_url=settings.ASTAKOS_BASE_URL,
astakos_auth_url=settings.ASTAKOS_AUTH_URL,
service_token=settings.CYCLADES_SERVICE_TOKEN,
astakosclient_poolsize=settings.CYCLADES_ASTAKOSCLIENT_POOLSIZE,
db_connection=settings.BACKEND_DB_CONNECTION,
......
......@@ -35,7 +35,7 @@ from synnefo.db.models import (QuotaHolderSerial, VirtualMachine, Network,
FloatingIP)
from synnefo.settings import (CYCLADES_SERVICE_TOKEN as ASTAKOS_TOKEN,
ASTAKOS_BASE_URL)
ASTAKOS_AUTH_URL)
from astakosclient import AstakosClient
from astakosclient.errors import AstakosClientException, QuotaLimit
from functools import wraps
......@@ -43,6 +43,7 @@ from functools import wraps
import logging
log = logging.getLogger(__name__)
DEFAULT_SOURCE = 'system'
RESOURCES = [
"cyclades.vm",
......@@ -63,7 +64,8 @@ class Quotaholder(object):
def get(cls):
if cls._object is None:
cls._object = AstakosClient(
ASTAKOS_BASE_URL,
ASTAKOS_TOKEN,
ASTAKOS_AUTH_URL,
use_pool=True,
retry=3,
logger=log)
......@@ -94,9 +96,9 @@ def issue_commission(user, source, provisions, name="",
qh = Quotaholder.get()
try:
serial = qh.issue_one_commission(ASTAKOS_TOKEN,
user, source, provisions, name=name,
force=force, auto_accept=auto_accept)
serial = qh.issue_one_commission(
user, source, provisions, name=name,
force=force, auto_accept=auto_accept)
except QuotaLimit as e:
msg, details = render_overlimit_exception(e)
raise faults.OverLimit(msg, details=details)
......@@ -143,7 +145,7 @@ def resolve_commissions(accept=None, reject=None, strict=True):
reject = []
qh = Quotaholder.get()
response = qh.resolve_commissions(ASTAKOS_TOKEN, accept, reject)
response = qh.resolve_commissions(accept, reject)
if strict:
failed = response["failed"]
......@@ -188,7 +190,7 @@ def resolve_pending_commissions():
def get_quotaholder_pending():
qh = Quotaholder.get()
pending_serials = qh.get_pending_commissions(ASTAKOS_TOKEN)
pending_serials = qh.get_pending_commissions()
return pending_serials
......
......@@ -40,7 +40,6 @@ from synnefo import quotas
from synnefo.quotas.util import (get_db_holdings, get_quotaholder_holdings,
transform_quotas)
from snf_django.management.utils import pprint_table
from synnefo.settings import CYCLADES_SERVICE_TOKEN as ASTAKOS_TOKEN
class Command(BaseCommand):
......@@ -129,7 +128,7 @@ class Command(BaseCommand):
% datetime.now())
request["provisions"] = map(create_provision, unsynced)
try:
qh.issue_commission(ASTAKOS_TOKEN, request)
qh.issue_commission(request)
except quotas.QuotaLimit:
write("Reconciling failed because a limit has been "
"reached. Use --force to ignore the check.\n")
......
......@@ -34,7 +34,7 @@
from django.db.models import Sum, Count, Q
from synnefo.db.models import VirtualMachine, Network, FloatingIP
from synnefo.quotas import Quotaholder, ASTAKOS_TOKEN
from synnefo.quotas import Quotaholder
def get_db_holdings(user=None):
......@@ -99,7 +99,7 @@ def get_quotaholder_holdings(user=None):
Returns quotas for all users, unless a single user is specified.
"""
qh = Quotaholder.get()
return qh.service_get_quotas(ASTAKOS_TOKEN, user)
return qh.service_get_quotas(user)
def transform_quotas(quotas):
......
......@@ -33,12 +33,11 @@
#
import synnefo.cyclades_settings as cyclades
from synnefo.cyclades_settings import cyclades_services, astakos_services
from synnefo.cyclades_settings import cyclades_services
from synnefo.lib import join_urls
from synnefo.lib.services import get_public_endpoint as endpoint
from django.conf import settings
BASE_PATH = cyclades.BASE_PATH
if not BASE_PATH.startswith("/"):
......@@ -47,18 +46,11 @@ if not BASE_PATH.startswith("/"):
GLANCE_URL = endpoint(cyclades_services, 'image', 'v1.0').rstrip('/')
COMPUTE_URL = endpoint(cyclades_services, 'compute', 'v2.0').rstrip('/')
USERDATA_URL = endpoint(cyclades_services, 'cyclades_userdata', '').rstrip('/')
ASTAKOS_UI_URL = endpoint(astakos_services, 'astakos_ui', '').rstrip('/')
if cyclades.PROXY_USER_SERVICES:
ACCOUNT_URL = join_urls('/', cyclades.BASE_ASTAKOS_PROXY_PATH,
cyclades.ASTAKOS_ACCOUNTS_PREFIX, 'v1.0')
else:
ACCOUNT_URL = endpoint(astakos_services, 'account', 'v1.0')
ACCOUNT_URL = join_urls('/', cyclades.ASTAKOS_ACCOUNT_PROXY_PATH)
USER_CATALOG_URL = join_urls(ACCOUNT_URL, 'user_catalogs')
FEEDBACK_URL = join_urls(ACCOUNT_URL, 'feedback')
LOGIN_URL = join_urls(ASTAKOS_UI_URL, 'login')
LOGIN_URL = join_urls('/', cyclades.ASTAKOS_UI_PROXY_PATH, 'login')
LOGOUT_REDIRECT = LOGIN_URL
......@@ -77,7 +77,7 @@ class View(object):
Main entry point for a request-response process.
"""
def view(request, *args, **kwargs):
get_user(request, settings.ASTAKOS_BASE_URL)
get_user(request, settings.ASTAKOS_AUTH_URL)
if not request.user_uniq:
return HttpResponse(status=401)
self = cls(*initargs, **initkwargs)
......
......@@ -69,7 +69,7 @@ def generate_key_pair(request):
Response to generate private/public RSA key pair
"""
get_user(request, settings.ASTAKOS_BASE_URL)
get_user(request, settings.ASTAKOS_AUTH_URL)
if request.method != "POST":
return http.HttpResponseNotAllowed(["POST"])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment