Commit Graph

193 Commits

Author SHA1 Message Date
Mikaël Ates bcb917c945 Scripts updated after integration of attribute_aggregator module 2011-09-26 14:28:20 +02:00
Mikaël Ates deb81fafd6 ACS now supports the attribute management on attribute_aggregator module. 2011-09-26 14:26:32 +02:00
Mikaël Ates ab15e93dac [abac] Use attribute aggregator module.
The core management of attributes of ACS now relies on the attribute_aggregator
  module.
2011-09-26 14:23:05 +02:00
Mikaël Ates 3a71afbbc2 [attribute_aggregator] Refine AttributeData and UserAliasInSource classes
* Define Meta and unicode of UserAliasInSource Class
    * AttributeData have methods that return empty dict, not None.
2011-09-26 14:18:15 +02:00
Mikaël Ates a9882bf0d8 [attribute aggregator] Enhancements
* Helper functions
    * In set_user_alias_in_source(), force_change parameter to allow to set an
      alias in a source already used by another user for the same source
2011-09-26 14:14:50 +02:00
Mikaël Ates aad109b9a4 [attribute_aggregator] application of attribute management extracted from acs 2011-09-21 18:44:19 +02:00
Mikaël Ates 4440d06315 [abac] Add function ot extract assertion data from profile 2011-09-20 17:33:54 +02:00
Mikaël Ates cdb69c7301 Script to request a decision 2011-09-14 23:27:06 +02:00
Mikaël Ates 9405e9a355 Tiny db stats script. 2011-09-09 09:13:10 +02:00
Mikaël Ates e1ea3e378e Bits of style 2011-09-08 21:43:09 +02:00
Mikaël Ates 6bbd246354 Enhance form management and display 2011-09-08 20:14:22 +02:00
Mikaël Ates 152a3c24af Bits of style for the UI 2011-09-08 14:50:04 +02:00
Mikaël Ates 1db7883e7a Enhance RBAC and ABAC support and update UI.
- The authorisation decision function now support regex object and first
      try to find an IBAC or RBAC permission. If not found try to find an ABAC
      permission.

    - The user inteface for ABAC permission creation propose the predicateRole

    - Single point of entry to add a permission with a page explaining the
      between RBAC and IBAC and inviting user to select a type or permission.

    - Review of navigation elements
2011-09-08 11:19:44 +02:00
Mikaël Ates bdcb85065d Bits of attribute namespace mapping 2011-09-07 14:09:17 +02:00
Mikaël Ates 6796211d01 Add support of LDAP sources of attributes
- New model for LDAP sources
    - LDAP attributes are provided with the attribute signal
    - Multiple sources supported
    - Add of a new source with the Web interface
    - User alias per source support added
    - Define alias per user per source with the Web interface
    - Accept that the aliases within a source are the User instances username
      attributes (will be usefull when the authentication on LDAP will be added)
2011-09-07 14:03:56 +02:00
Mikaël Ates ee505be1e7 Update abac test script. 2011-09-05 12:30:45 +02:00
Mikaël Ates 270f2b3582 Use profile management functions at authorization checking 2011-09-05 12:27:42 +02:00
Mikaël Ates 8ff4a7d42a [abac] Adding of the attribute profile management.
All attributes are stored in an object profile used at the treatement of
    the ABAC permissions.

    Some of these attributes may be used in more that a single single user
    session.

    Then, a profile is recorded for each user. At the beginning of the
    permission checking, the profile is loaded or created.

    If it is loaded, all outdated attributes are removed.

    The function to load dictionnary of attributes handle the expiration
    date if it is ISO 8601 formatted:

        attr = {}
        attr['name'] = 'certificate_type'
        attr['namespace'] = 'ACS-ABAC'
        attr['values'] = ('eID',)
        attr['expiration_date'] = 2011-09-05T11:48:24
2011-09-05 12:17:27 +02:00
Mikaël Ates 1dbc34accf [abac] AssertionData 2011-09-05 12:14:32 +02:00
Mikaël Ates d072eeb192 Signal to add attributes at permission checking 2011-09-02 19:02:43 +02:00
Mikaël Ates 48d06b7c48 New Abac permission model: Who is only a UserAlias object or None
An ABAC permission can now only be set on a user or on anybody.

  Axiom (unformal notation):
        p_RBAC(role, Y, Z)
            equiv.
        p_ABAC(None, Y, Z, abac_rule: PredicateRole(role))

  IBAC: p_ABAC(user, X, Y, no_rule)
  RBAC: p_ABAC(None, Y, Z, abac_rule: PredicateRole(role))
  ABAC: p_ABAC(None/user, Y, Z, abac_rule: what_you_want)

  p_ABAC(user, Y, Z, rule: PredicateRole(role)) means that user may be
  granted the access if it has the role.
2011-09-02 18:48:13 +02:00
Mikaël Ates 4abdb74719 New abac test script 2011-09-02 18:47:05 +02:00
Mikaël Ates bda42675e0 [core] Mainly, a core function for decisions based on ABAC permissions.
1- A core function for decisions based on ABAC permissions.

  2- Core functions to add and modify policy objects checking administration
     rights

A core function for decisions based on ABAC permissions
-------------------------------------------------------

    * Preface

    1- Reminder on aliases

    Requester is the user accessing ACS. The username is equal to the alias in
    default.

    Who is the subject of the request, it is described by the alias in a
    policy.

    Requester == who means that default_alias(requester) == default_alias(who)

    2- difference between ABAC and RBAC permissions

    An RBAC permission set with who is a role means that at the evaluation,
    the access is granted if who is that role, a subject (a user or a role)
    has that role (directly or by hierarchy)

    With an ABAC rule, a request with a role as subject can never be granted,
    but can only serve to obtain a new rule with that role has subject or
    other permissions with roles as who included in that role
    Note that an ABAC rule with who that is a role is strictly equivalent to
    a rule on anybody with in the ABAC rule a PredicateRole at the root with
    a AND statement with the rest of the logical expression.
    Then an ABAC permission set with who is a role is not a way to authorize a
    role (only possible with classic RABC rules) but a way to indicate that
    they are candidate permissions for users that have that role.

    In fact it is not very useful to ask if a role may have an access.
    It does not make to say "does the role/function can access what/how?".
    The right way to ask the question is "User lambda that eventually I don't
    but who has the role/function X can access what/how?".
    Then with ABAC rule we do not handle when the request is about a role.
    It explains why we have removed the possibility to set an ABAC rule on a
    role as who.

     - When who is None/Anybody and the rule is only a predicate of having a
    role, it is a classic RBAC permission.
     - Idem with a rule on attributes, a classic ABAC rule.
     - We can mix both. It is a way to give a logical expression on roles.
     - Who is a user and no rule, classic IBAC rule.
     - Who is a user and a rule, this user can have an access if the rule is
    satisfied

    * Requester != who
        Requester != None
        Who != None

    A requester different from who request the policy to know if who can do
    how on what.

    The requester must be authorized in that policy for administration on who,
    what and how.

    RBAC permissions are checked. Then ABAC permissions are checked.

    Attributes can be retreived from different sources. who has a default
    alias that is the username that is mapped with the user identifiers wihtin
    the different identity repositories (sources) configured.

    A signal is send to make external functions provide attributes.
    This is the preferred way the attributes should be provided from sources.
    An option allows to say to not send this signal
    no_attribute_signal = True, at False by default.

    Attributes can also be given in parameters of the functions.

    A validity period may be provided per attribute or per source. When it is
    the case, these attributes are cached to be reused in other session.
    These are stored is a special source called cached_attributes.
    This function always tries to load attributes from this source.

    Attributes are provided with dictionnaries as follows:

        data = []

        attr = {}
        attr['name'] = 'certificate_type'
        attr['namespace'] = 'ACS-ABAC'
        attr['values'] = ('eID',)

        data.append(attr)

        attr = {}
        attr['name'] = \
    'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth'
        attr['namespace'] = \
    'http://schemas.xmlsoap.org/ws/2005/05/identity/claims'
        attr['values'] = ('22', )

        data.append(attr)

        dic = {}
        dic[source_name] = data

    *All attributes are loaded in an object profile used for the evaluation.*

    If the access is granted, the function return un tuple containing 'True',
    the permission that allowed the positive answer and error code at 0.
    If the access is denied, the function return un tuple containing 'False',
    the ABAC rule necessary to grant the access and error code at 0.

    Obtaining a new ABAC rule can only be done with ABAC permissions.

    The rule returned can be build from any ABAC permission that is on what to
    do how.

    The process of building a new rule is ressource consuming, this process
    can be desactivated with the option no_rule_returned = True, at False by
    default.

    If who is a role. If there is a matching RBAC rule, the decision is True.
    If there is an ABAC rule set on anybody with a unique predicate role on
    that role, the decission is True.
    Else a new rule is returned made of permissions set on anybody.

    * Requester != who
        Requester == None
        Who != None

    Unauthorized access to request the policy on somebody is not authorized.
    This request is rejected with an error code

    * Requester != who
        Requester != None
        Who == None

    This is supported to only to make a requester authorized for
    administration on what and how to obtain a rule that anybody may satisfy
    to do how on what.

    This is not compatible with no_rule_returned = True

    * Requester == who != None

    This mode means that the user is currently using an application coupled
    with ACS. This application and ACS share the user session.

    Checking administration rights does not have sense here.

    Except this, this functions the same way as the first case.

    However, attributes are also check in the session:
    request.session['attributes']

    An option allows to say to not check attributes in the session
    no_session_attributes = True, at False by default.

    This mode also always try to load attributes from the cached_attributes
    source

    The rule returned can only contain predicates of ABAC rules set on
    anybody or on who or on a role that who has.
    Differently from when requester != who and the requester is checked for
    administration, new rule can not be set from any ABAC permission matching
    what and how. Indeed, since the administration rights are not check, the
    access to the policy is given on ABAC permissions that have as subject
    anybody, the requester or a role that the requester has.

    * Requester == who == None

    This mode means that the user is currently using an application coupled
    with ACS. This application and ACS share the user session.

    Checking administration rights does not have sense here neither.

    The requester/subject being 'anonymous', identity attributes can't be
    retreived from sources.
    Contextual attributes (time for instance) but it is not supported yet.

    Signals may be used for contextual attributes.
    Attributes in parameters and in the session can be used.

    Example of scenario:
    - The user is redirected on an IdP proxy with an access request from a SP.
    - The user is not able to authenticate against the proxy.
    - The proxy asks the policy in that mode with no attributes, a new rule from
    permissions set on anybody are returned.
    - The attributes can only come from external sources and be brought by
    the user, i.e. certificates.
    - The proxy make the user provide certificates to from the ABAC rule.
    - Then the proxy parse the certificates and builds a dictionnary. The proxy
    may also try to authenticate the user from certificates. if yes,
    previously provided certificates may be loaded from cached_attributes.
    - Either the dictionnary is put in the session, or given in parameter of
    this function.
    - The policy is requested.
    - If the access is not granted, a new rule is returned.
    - If the access is granted, before responding to the SP, the proxy may
    create an account giving authentication credentials to the user or using
    one of the certificates as an authentication credential.
    - Then the proxy associates the living-more-than-a-session certified
    attributes to this profile. The proxy is in charge to add by itself add
    attributes in the cached_attributes source.
    - Next time, the user will be able to authenticate and benefit from the
    cached_attributes source
2011-09-02 18:40:06 +02:00
Mikaël Ates 62c722654b [abac] logging instead of print in load_profile_by_dic() 2011-09-02 18:21:05 +02:00
Mikaël Ates ed3bdb6b6c Function to grab a user alias from a user and a namespace 2011-09-01 08:38:25 +02:00
Mikaël Ates e22746a608 [abac] Treatment of predicates PredicateRole 2011-09-01 08:35:43 +02:00
Mikaël Ates ecd590f463 [abac] Add a new predicate to couple RBAC and ABAC 2011-09-01 08:34:35 +02:00
Mikaël Ates 4759e8ccc3 [abac] Rewrite/remove cryptic comments 2011-08-28 20:15:46 +02:00
Mikaël Ates 8d921ba734 Use ABAC core functions to remove an ABAC permission from the GUI 2011-08-28 20:05:52 +02:00
Mikaël Ates 463ebc694c [abac] Add unicode functions to models of values 2011-08-28 20:04:46 +02:00
Mikaël Ates 4fa437246b [abac] Add core functions to remove an ABAC rule 2011-08-28 20:03:45 +02:00
Mikaël Ates 071bfa5cea Check logical expressions of ABAC permissions at form filling 2011-08-28 17:59:27 +02:00
Mikaël Ates 463985b73a Rewriting of a cryptic comment. 2011-08-26 11:43:45 +02:00
Mikaël Ates 1c7df14986 Rewriting of a cryptic comment. 2011-08-26 11:36:35 +02:00
Mikaël Ates 83fc3d5a36 [abac] An ABAC permission can be set for a user, a role, or anybody.
An ABAC permission can now be set on a user, a role or anybody.

    For a decision request about a user or a role, it works the same way has
    regular RBAC permissions execpt that moreover the ABAC rule must be
    satisfied.

    For permissions on anyone, it means that ACS is combined with a system
    able to maintain sessions without authentication. The owner of such a
    session must be able to bring (certified) attributes. It can then be granted
    the permissions that have ABAC rules that are satisfied.
2011-08-26 11:12:05 +02:00
Mikaël Ates 6ec65d84a3 Add a source of attributes from the main administration interface 2011-08-25 22:43:54 +02:00
Mikaël Ates 3fd4f8013f Modify the GUI of ABAC permissions to handle multivalued attributes 2011-08-25 20:03:01 +02:00
Mikaël Ates 495b3f9873 [xacml] add a dictionnary that gives operand data types from predicate type 2011-08-25 20:00:51 +02:00
Mikaël Ates b1a1825c1d [abac] Modify core functions to handle more precise multi-valued attributes
The following options for dealing with multivalued attributes in comparison are now supported:

        All:
            NO_MULTIVALUES
                Both operand are single valued attributes

        Equality:
            EQUAL_ONE_VALUE
                At least one value of the values of OP1 is equal to one value of the values of OP2
            EQUAL_OP1_SUBSET_OP2
                The values of OP1 is is a subset of the values of OP2
            EQUAL_EXACT_MATCH
                Equal set of values

        Diff strict:
            DIFF_ALL_OP1_WITH_UPPER_LIMIT_OP2
                ACS_XACML_COMPARISON_INTEGER_LT
                    All values of OP1 must be less than the highest value of OP2
                ACS_XACML_COMPARISON_INTEGER_GRT
                    All values of OP1 must be greater than the highest value of OP2
            DIFF_ALL_OP1_WITH_BOTTOM_LIMIT_OP2
                ACS_XACML_COMPARISON_INTEGER_LT
                    All values of OP1 must be less than the smallest value of OP2
                ACS_XACML_COMPARISON_INTEGER_GRT
                    All values of OP1 must be greater than the smallest value of OP2
            DIFF_ONE_OP1_WITH_UPPER_LIMIT_OP2
                ACS_XACML_COMPARISON_INTEGER_LT
                    At least one value of OP1 must be less than the highest value of OP2
                ACS_XACML_COMPARISON_INTEGER_GRT
                    At least one value of OP1 must be greater than the highest value of OP2
            DIFF_ONE_OP1_WITH_BOTTOM_LIMIT_OP2
                ACS_XACML_COMPARISON_INTEGER_LT
                    At least one value of OP1 must be less than the smallest value of OP2
                ACS_XACML_COMPARISON_INTEGER_GRT
                    At least one value of OP1 must be greater than the smallest value of OP2

        Diff or equal:
            Same as for strict and equality is treated as follows:
            DIFF_ALL_OP1_WITH_UPPER_LIMIT_OP2
                ACS_XACML_COMPARISON_INTEGER_LT_OE
                    All values of OP1 must be less than or equal to the highest value of OP2
                ACS_XACML_COMPARISON_INTEGER_GRT_OE
                    All values of OP1 must be greater than or equal to the highest value of OP2
            DIFF_ALL_OP1_WITH_BOTTOM_LIMIT_OP2
                ACS_XACML_COMPARISON_INTEGER_LT_OE
                    All values of OP1 must be less than or equal to the smallest value of OP2
                ACS_XACML_COMPARISON_INTEGER_GRT_OE
                    All values of OP1 must be greater than or equal to the smallest value of OP2
            DIFF_ONE_OP1_WITH_UPPER_LIMIT_OP2
                ACS_XACML_COMPARISON_INTEGER_LT_OE
                    At least one value of OP1 must be less than or equal to the highest value of OP2
                ACS_XACML_COMPARISON_INTEGER_GRT_OE
                    At least one value of OP1 must be greater than or equal to the highest value of OP2
            DIFF_ONE_OP1_WITH_BOTTOM_LIMIT_OP2
                ACS_XACML_COMPARISON_INTEGER_LT_OE
                    At least one value of OP1 must be less than or equal to the smallest value of OP2
                ACS_XACML_COMPARISON_INTEGER_GRT_OE
                    At least one value of OP1 must be greater than or equal to the smallest value of OP2

        To deal with richer comparison and equality of multivalued attributes, a 'or' statement should be used
2011-08-23 17:05:14 +02:00
Mikaël Ates 8b5d3ece1e Revert "[abac] Modify core functions to handle more precise multi-valued attributes"
Wrong file added

This reverts commit 38eccafb74.
2011-08-23 17:04:25 +02:00
Mikaël Ates a9908893ab README update 2011-08-23 16:55:43 +02:00
Mikaël Ates a7cfe5423c A unique script is now used for initialization including abac 2011-08-23 16:55:20 +02:00
Mikaël Ates 3ca2307646 [abac] Test script updated 2011-08-23 16:53:25 +02:00
Mikaël Ates 38eccafb74 [abac] Modify core functions to handle more precise multi-valued attributes
The following options for dealing with multivalued attributes in comparison are now supported:

        All:
            NO_MULTIVALUES
                Both operand are single valued attributes

        Equality:
            EQUAL_ONE_VALUE
                At least one value of the values of OP1 is equal to one value of the values of OP2
            EQUAL_OP1_SUBSET_OP2
                The values of OP1 is is a subset of the values of OP2
            EQUAL_EXACT_MATCH
                Equal set of values

        Diff strict:
            DIFF_ALL_OP1_WITH_UPPER_LIMIT_OP2
                ACS_XACML_COMPARISON_INTEGER_LT
                    All values of OP1 must be less than the highest value of OP2
                ACS_XACML_COMPARISON_INTEGER_GRT
                    All values of OP1 must be greater than the highest value of OP2
            DIFF_ALL_OP1_WITH_BOTTOM_LIMIT_OP2
                ACS_XACML_COMPARISON_INTEGER_LT
                    All values of OP1 must be less than the smallest value of OP2
                ACS_XACML_COMPARISON_INTEGER_GRT
                    All values of OP1 must be greater than the smallest value of OP2
            DIFF_ONE_OP1_WITH_UPPER_LIMIT_OP2
                ACS_XACML_COMPARISON_INTEGER_LT
                    At least one value of OP1 must be less than the highest value of OP2
                ACS_XACML_COMPARISON_INTEGER_GRT
                    At least one value of OP1 must be greater than the highest value of OP2
            DIFF_ONE_OP1_WITH_BOTTOM_LIMIT_OP2
                ACS_XACML_COMPARISON_INTEGER_LT
                    At least one value of OP1 must be less than the smallest value of OP2
                ACS_XACML_COMPARISON_INTEGER_GRT
                    At least one value of OP1 must be greater than the smallest value of OP2

        Diff or equal:
            Same as for strict and equality is treated as follows:
            DIFF_ALL_OP1_WITH_UPPER_LIMIT_OP2
                ACS_XACML_COMPARISON_INTEGER_LT_OE
                    All values of OP1 must be less than or equal to the highest value of OP2
                ACS_XACML_COMPARISON_INTEGER_GRT_OE
                    All values of OP1 must be greater than or equal to the highest value of OP2
            DIFF_ALL_OP1_WITH_BOTTOM_LIMIT_OP2
                ACS_XACML_COMPARISON_INTEGER_LT_OE
                    All values of OP1 must be less than or equal to the smallest value of OP2
                ACS_XACML_COMPARISON_INTEGER_GRT_OE
                    All values of OP1 must be greater than or equal to the smallest value of OP2
            DIFF_ONE_OP1_WITH_UPPER_LIMIT_OP2
                ACS_XACML_COMPARISON_INTEGER_LT_OE
                    At least one value of OP1 must be less than or equal to the highest value of OP2
                ACS_XACML_COMPARISON_INTEGER_GRT_OE
                    At least one value of OP1 must be greater than or equal to the highest value of OP2
            DIFF_ONE_OP1_WITH_BOTTOM_LIMIT_OP2
                ACS_XACML_COMPARISON_INTEGER_LT_OE
                    At least one value of OP1 must be less than or equal to the smallest value of OP2
                ACS_XACML_COMPARISON_INTEGER_GRT_OE
                    At least one value of OP1 must be greater than or equal to the smallest value of OP2

        To deal with richer comparison and equality of multivalued attributes, a 'or' statement should be used
2011-08-23 16:49:22 +02:00
Mikaël Ates 8acb29c711 [abac] Predicate models modified to handle checking of single-valued attributes
The attribute single_value is added to PredicateRequired model to indicate
    that each source satisfying this predicate must provide an attribute with a
    single value.

    The attributes operand1_single_value and operand2_single_value are added
    to PredicateComparison to enforce than a unique value must be provided
    to have the predicate evaluated.
2011-08-23 16:43:35 +02:00
Mikaël Ates 62c10be454 Display attribute name of predicate required during a new rule defnition 2011-08-13 16:42:35 +02:00
Mikaël Ates 7017406dd6 [abac] Display more intuitive numbers for predicate used to set the logic rule 2011-08-06 09:48:46 +02:00
Mikaël Ates 91572594f3 Transform one form to many in the add abac permission template 2011-08-06 09:47:26 +02:00
Mikaël Ates 59515aeeb6 [abac] Unicode of models defined 2011-08-06 09:06:00 +02:00
Mikaël Ates ffc54bee21 [abac] correct string management in comparison operand 2011-08-06 09:03:48 +02:00