"Fossies" - the Fresh Open Source Software Archive

Member "keystone-17.0.0/keystone/application_credential/backends/base.py" (13 May 2020, 4607 Bytes) of package /linux/misc/openstack/keystone-17.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "base.py": 16.0.1_vs_17.0.0.

    1 # Copyright 2018 SUSE Linux GmbH
    2 #
    3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
    4 # not use this file except in compliance with the License. You may obtain
    5 # a copy of the License at
    6 #
    7 #      http://www.apache.org/licenses/LICENSE-2.0
    8 #
    9 # Unless required by applicable law or agreed to in writing, software
   10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   12 # License for the specific language governing permissions and limitations
   13 # under the License.
   14 
   15 import abc
   16 
   17 from keystone import exception
   18 
   19 
   20 class ApplicationCredentialDriverBase(object, metaclass=abc.ABCMeta):
   21 
   22     @abc.abstractmethod
   23     def authenticate(self, application_credential_id, secret):
   24         """Validate an application credential.
   25 
   26         :param str application_credential_id: Application Credential ID
   27         :param str secret: Secret
   28 
   29         :raises AssertionError: If id or secret is invalid.
   30         """
   31         raise exception.NotImplemented()  # pragma: no cover
   32 
   33     @abc.abstractmethod
   34     def create_application_credential(self, application_credential, roles):
   35         """Create a new application credential.
   36 
   37         :param dict application_credential: Application Credential data
   38         :param list roles: A list of roles that apply to the
   39                            application_credential.
   40         :returns: a new application credential
   41         """
   42         raise exception.NotImplemented()  # pragma: no cover
   43 
   44     @abc.abstractmethod
   45     def get_application_credential(self, application_credential_id):
   46         """Get an application credential by the credential id.
   47 
   48         :param str application_credential_id: Application Credential ID
   49         """
   50         raise exception.NotImplemented()  # pragma: no cover
   51 
   52     @abc.abstractmethod
   53     def list_application_credentials_for_user(self, user_id, hints):
   54         """List application credentials for a user.
   55 
   56         :param str user_id: User ID
   57         :param hints: contains the list of filters yet to be satisfied.
   58                       Any filters satisfied here will be removed so that
   59                       the caller will know if any filters remain.
   60         """
   61         raise exception.NotImplemented()  # pragma: no cover
   62 
   63     @abc.abstractmethod
   64     def delete_application_credential(self, application_credential_id):
   65         """Delete a single application credential.
   66 
   67         :param str application_credential_id: ID of the application credential
   68             to delete.
   69 
   70         """
   71         raise exception.NotImplemented()  # pragma: no cover
   72 
   73     @abc.abstractmethod
   74     def delete_application_credentials_for_user(self, user_id):
   75         """Delete all application credentials for a user.
   76 
   77         :param user_id: ID of a user to whose application credentials should
   78             be deleted.
   79 
   80         """
   81         raise exception.NotImplemented()  # pragma: no cover
   82 
   83     @abc.abstractmethod
   84     def delete_application_credentials_for_user_on_project(self, user_id,
   85                                                            project_id):
   86         """Delete all application credentials for a user on a given project.
   87 
   88         :param str user_id: ID of a user to whose application credentials
   89             should be deleted.
   90         :param str project_id: ID of a project on which to filter application
   91             credentials.
   92 
   93         """
   94         raise exception.NotImplemented()  # pragma: no cover
   95 
   96     @abc.abstractmethod
   97     def get_access_rule(self, access_rule_id):
   98         """Get an access rule by its ID.
   99 
  100         :param str access_rule_id: Access Rule ID
  101         """
  102         raise exception.NotImplemented()  # pragma: no cover
  103 
  104     @abc.abstractmethod
  105     def list_access_rules_for_user(self, user_id):
  106         """List the access rules that a user has created.
  107 
  108         Access rules are only created as attributes of application credentials,
  109         they cannot be created independently.
  110 
  111         :param str user_id: User ID
  112         """
  113         raise exception.NotImplemented()  # pragma: no cover
  114 
  115     @abc.abstractmethod
  116     def delete_access_rule(self, access_rule_id):
  117         """Delete one access rule.
  118 
  119         :param str access_rule_id: Access Rule ID
  120         """
  121         raise exception.NotImplemented()  # pragma: no cover
  122 
  123     @abc.abstractmethod
  124     def delete_access_rules_for_user(self, user_id):
  125         """Delete all access rules for user.
  126 
  127         This is called when the user itself is deleted.
  128 
  129         :param str user_id: User ID
  130         """
  131         raise exception.NotImplemented()  # pragma: no cover