Beispiel #1
0
    def process_request(self, request):
        # NOTE(kiall): This makes the assumption that disabling authentication
        #              means you wish to allow full access to everyone.
        context = MonikerContext(is_admin=True)

        # Store the context where oslo-log exepcts to find it.
        local.store.context = context

        # Attach the context to the request environment
        request.environ['context'] = context
Beispiel #2
0
    def process_request(self, request):
        headers = request.headers

        roles = headers.get('X-Roles').split(',')

        context = MonikerContext(auth_tok=headers.get('X-Auth-Token'),
                                 user=headers.get('X-User-ID'),
                                 tenant=headers.get('X-Tenant-ID'),
                                 roles=roles)

        # Store the context where oslo-log exepcts to find it.
        local.store.context = context

        # Attempt to sudo, if requested.
        sudo_tenant_id = headers.get('X-Moniker-Sudo-Tenant-ID', None)

        if sudo_tenant_id and (uuidutils.is_uuid_like(sudo_tenant_id)
                               or sudo_tenant_id.isdigit()):
            context.sudo(sudo_tenant_id)

        # Attach the context to the request environment
        request.environ['context'] = context
Beispiel #3
0
 def get_context(self, **kwargs):
     return MonikerContext(**kwargs)