def validate_token(self, context): token_id = context.get('subject_token_id') self.check_token(context) token_ref = self.token_api.get_token(context, token_id) token_data = token_factory.recreate_token_data( context, token_ref.get('token_data'), token_ref['expires'], token_ref.get('user'), token_ref.get('tenant')) return token_factory.render_token_data_response(token_id, token_data)
def validate_token(self, context): token_id = context.get('subject_token_id') self.check_token(context) token_ref = self.token_api.get_token(token_id) token_data = token_factory.recreate_token_data( token_ref.get('token_data'), token_ref['expires'], token_ref.get('user'), token_ref.get('tenant')) return token_factory.render_token_data_response(token_id, token_data)
def authenticate_for_token(self, context, auth=None): """Authenticate user and issue a token.""" try: auth_info = AuthInfo(context, auth=auth) auth_context = {'extras': {}, 'method_names': []} self.authenticate(context, auth_info, auth_context) self._check_and_set_default_scoping(auth_info, auth_context) (token_id, token_data) = token_factory.create_token( auth_context, auth_info) return token_factory.render_token_data_response( token_id, token_data, created=True) except exception.SecurityError: raise except Exception as e: LOG.exception(e) raise exception.Unauthorized(e)
def authenticate_for_token(self, context, auth=None): """ Authenticate user and issue a token. """ try: auth_info = AuthInfo(context, auth=auth) auth_context = {'extras': {}, 'method_names': []} self.authenticate(context, auth_info, auth_context) self._check_and_set_default_scoping(context, auth_info, auth_context) (token_id, token_data) = token_factory.create_token( context, auth_context, auth_info) return token_factory.render_token_data_response( token_id, token_data, created=True) except exception.SecurityError: raise except Exception as e: LOG.exception(e) raise exception.Unauthorized(e)
def authenticate_for_token(self, context, auth=None): """ Authenticate user and issue a token. """ try: auth_info = AuthInfo(context, auth=auth) auth_context = {'extras': {}, 'method_names': []} self.authenticate(context, auth_info, auth_context) self._check_and_set_default_scoping(context, auth_info, auth_context) (token_id, token_data) = token_factory.create_token( context, auth_context, auth_info) return token_factory.render_token_data_response(token_id, token_data) except (exception.Unauthorized, exception.AuthMethodNotSupported, exception.AdditionalAuthRequired) as e: raise e except Exception as e: LOG.exception(e) raise exception.Unauthorized(e)