---
pattern_id: A-003
slug: a-distributed-licence-based-access-control-for-data-and-services
title: Distributed licence-based access control for data and services
pattern_type: architectural
problem: An archival repository or other service needs to grant access to licensed data or infrastructure without building and maintaining its own access-control system.
applies_when:
  - users can hold their own copies of data assets, or access a service directly from their own computers, subject to licence conditions
  - there is a defined process (typically an application form) by which a person is granted a licence
  - an external authentication service and a licence-granting authority exist, or can be stood up, separately from the archive or service itself
  - the same licence-granting approach is meant to extend across more than one system or over time, not just one repository
cluster: authorisation-and-authentication
cluster_refs: []
diagrams:
  - slot: activity
    caption: "Applying for a licence: the repository finds the licence a dataset requires, CILogon logs the researcher in, and REMS reports no grant; the researcher applies through REMS, a data custodian approves, and the repository checks REMS again before releasing the dataset."
  - slot: architecture
    caption: "A C4 context view of the pattern: the repository sends a research user to an external authentication server to log in, asks a separate authorisation server whether that user holds the licence a resource requires, and returns the resource only when the check passes."
keywords:
  - authentication
  - authorisation
  - federated-identity
  - licensing
  - access-control
  - sustainability
authors:
  - Peter Sefton (ANU / UQ)
contributors:
  - name: James Smithies (ANU)
    roles: [technical_editor]
---

## Summary

This pattern separates authorisation of user-agents and authentication from an archival repository or other service using a system of licence-granting. It aims to make authorisation systems for software services as sustainable and maintainable as possible. Data stays available beyond the life of any particular system, and different systems can house it at the same time or over time.

Historically, the dominant authorisation pattern has been for each system to maintain access control lists (ACLs) for granting access to resources, sometimes with additional attributes stored for each person or group. This pattern removes the need for access control lists and group management in individual applications by delegating both authentication (log in) and authorisation (does this person hold a particular licence to do something?) to an external system.

This pattern suits data distributed under licence conditions that users have agreed to and been granted, explicitly or implicitly. A defined process grants the licence, typically triggered when a potential user fills out an application form. It is not suitable for high-risk environments such as medical or other personal data. The same pattern can be used for access to services, such as computing.

| Recommendation | Why? |
|----------------|------|
| Describe data and services with natural-language licences specifying *who* is allowed to do *what* with the data/service and for *how long* | This information can always be used in future to re-establish access control systems if needed, even manually |
| Store the licence with the data | Data does not become orphaned and closed by default |
| Avoid encoding complex social relationships into system-specific code or databases in a non-portable way | Mitigates the risk that data access is lost if that system becomes unavailable, and the risk of a privacy breach in a research system, by delegating to trusted authorities |
| Separate the granting of licences and authentication of people from archives and other services | Archives and other research services can be simpler, and data can move between them with its licences |
| Use one or more licence services to manage the administrative processes of licence granting | Not every system has to carry the complexity and risk of maintaining user information, including potentially private attributes |
| Do not build complex access control into every system; tie access to explicit licences for reuse and share the management of user authentication and authorisation across a community of use | [PILARS] protocol 1: "Data is Portable: Assets are not locked-in to a particular mode of storage, interface or service." FAIR and CARE address *access* to data; it is essential that Archival Repositories are architected independently of particular software |

::diagram[activity]

Figure 1: An authentication/authorisation system in action. Two services are needed: one for authentication (CILogon in this case) and a second for authorisation (REMS, which uses the same authentication service so it can share user IDs with the repository service). One application can deliver both services, or they can be separate, with the authorisation server sitting "behind" the licence server.

::diagram[architecture]

## Context

This pattern applies where actors can hold their own copies of data assets, or access systems directly from their own computers, subject to licence conditions. They may be required to delete data after use, and there are typically restrictions on re-sharing data, ranging from acknowledging copyright through to a complete ban on any kind of redistribution.

The pattern was created to add authorisation workflows to data assets, and it also applies to granting access to services.

To implement this pattern you must have a way of adding licence information to a data record, at least via its metadata. This implies having some form of archival repository in the terms of the [HASS&I RDM conceptual model][HASS and Indigenous Research Data Commons (HASS&I RDC) Research Data Management (RDM): A Conceptual Overview].

Do not use this pattern:

- If there are trusted authorisation systems already in place.
- When there are serious risks from data leakage. In this case, use a secure eResearch system or similar controlled environment.

## Usage

This section assumes the context of data access in a repository, data portal, API, or similar data delivery system. You can adapt it for services. It has been used for access to computing services, and a future pattern will describe that use.

Implementing this pattern has two stages: preparation and use.

### Preparation

Put two things in place. The same application can provide both:

1. An authentication service, typically using OAuth or a similar protocol. Examples include:
   - Single sign-on (SSO) services, such as:
     - GitHub, or another service where users can self-register for an account
     - CILogon, an open-source enterprise system offered as a subscription service at enterprise pricing, available to projects under the ARDC HASS&I RDC
     - The Australian Access Federation (AAF)
   - A local authentication service with usernames and passwords, for example an LDAP implementation.
2. An authorisation server, in this case a "licence server" that can verify whether a given user holds a licence. This should have:
   - A way to store licence workflows, at least allowing an administrator to grant a licence.
   - In a fully featured system: a registry of licences (publicly discoverable or not, as their metadata specifies), and a set of forms that trigger an approval workflow.
   - An API endpoint to verify whether a user ID from the authentication service holds a given licence.

See Implementations for an example in practice.

### In use

To use this pattern:

- Factor data into a set of digital objects, each with one or more natural-language licence documents describing who can access the data and what they can do with it (keep it for how long, reuse parts of it, republish). Ideally store the licence with the data and its metadata; at a minimum, link to it from the data via its metadata.
- For each licence, work out a process for how actors may be granted that licence. Options include:
  - No explicit grant, for open access and similar licences.
  - Click-through agreement to licence terms, recording the user's identity.
  - Delegating approval to one or more administrators, with a notification to approve.
  - A convention where, for example, membership of a particular group in an authentication system explicitly denotes holding a licence (such as membership of a GitHub group within a GitHub organisation).

Licences must:
- Name an authorisation service (licence server). A system can use one service for every licence, or set it per licence.
- Have enough metadata and approval forms for the authorisation services an implementation uses.

When an actor requests access to a resource, the system must:

- Retrieve the licence(s) for the resource. If a licence allows unmediated immediate access (for example, open access or open source), allow access.
- If a licence requires authorisation, get the actor's ID through a login to the authentication service or a locally managed token (API key). Then get the list of licences the user holds from the authorisation service, and grant or withhold the resource accordingly.
- If a user does not hold a licence and the licence metadata indicates an application pathway, direct the user to it, for example an application form.

## Implementations

The Language Data Commons of Australia (LDaCA) implements this pattern, using the Australian Access Federation for authentication. [A CARE and FAIR-ready distributed access control system for human-created data using the Australian Access Federation and beyond](https://www.ldaca.edu.au/news/posts/fair-care-eresearch-2022/), a write-up of a talk given at eResearch Australasia 2022, describes how.

## References

### Models

[HASS and Indigenous Research Data Commons (HASS&I RDC) Research Data Management (RDM): A Conceptual Overview]

### Other resources

The [PILARS] (Protocols for Implementing Long-term Archival Repository Services), quoted in the Summary recommendation table.

## Acknowledgments

Members of the Language Data Commons of Australia contributed to this work and this pattern, including Moises Sacal Bonequi, Rosanna Smith, and River Smith.

<!-- References -->
[HASS and Indigenous Research Data Commons (HASS&I RDC) Research Data Management (RDM): A Conceptual Overview]: /architecture/hass-rdc-rdm-concept-overview/
[PILARS]: https://w3id.org/ldac/pilars
