Lesson 2 of 4 IAM Access Analyzer and Authorization Tools

Externalising Application Authorisation with Amazon Verified Permissions

This lesson explains how Amazon Verified Permissions moves fine-grained authorisation for your own applications out of scattered code and into Cedar policies evaluated by a managed service.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe how Verified Permissions evaluates authorisation requests against Cedar policies.
  • Identify the benefits of externalising authorisation.
  • Distinguish the AWS services that perform authorisation for different things.

How Verified Permissions works

Custom applications traditionally embed authorisation logic in code, with checks such as "if the user is the owner or a manager" scattered across the application, which makes them hard to audit and change. Amazon Verified Permissions moves these decisions into a managed service. Permissions are written as policies in the Cedar language, and the application asks Verified Permissions whether a particular action is allowed before performing it. The following list describes how it works.

  • Cedar policies say who can do which action on which resource under what conditions, for example "users can edit documents they own or that are shared with their team".
  • Policies are stored in a policy store with a schema that validates them.
  • The application calls IsAuthorized, or batch and token-based variants, before each action.
  • Cognito or OIDC providers serve as identity sources, so tokens can be passed directly.

The following diagram evaluates four requests against the two policies.

Centralised document authorisation in Amazon Verified Permissions. The permit policy allows viewing by the owner or by a team the document is shared with; the forbid policy keeps restricted documents with the Compliance group, and forbid overrides permit. The application calls IsAuthorized before every action.
The requests are illustrative.
True or false

Verified Permissions basics

Exam skills 4.2.1

Check how Amazon Verified Permissions works.

Log in to try this activity Interactive activities are free with an account.

Benefits

Amazon Verified Permissions moves an application's authorisation rules out of its code and into policies written in the Cedar language, which brings four benefits. Policies are held centrally, so authorisation rules can be reviewed and changed without redeploying the application. Cedar is designed for analysis: policies are validated against a schema of the application's entities and actions, and can be checked automatically. Every authorisation decision can be logged for audit. Because every component asks the same service, the same rules are enforced consistently everywhere. The following table summarises the benefits.

BenefitEffect
Central policiesAuthorisation rules can be reviewed and changed without redeploying code
AnalysisCedar is designed so that policies can be analysed and validated against the schema
AuditAuthorisation decisions are logged
ConsistencyEvery component of the application enforces the same rules

Who authorises what

Several AWS services perform authorisation, and they are frequently confused because two of them use Cedar. The distinction depends on what is being protected. Verified Permissions authorises an application's own users to perform actions on the application's resources, such as editing a document. IAM authorises principals to call AWS APIs, such as reading an S3 object. Verified Access, which also uses Cedar, authorises network access to applications based on identity and device posture. Amazon Cognito authenticates users and issues tokens, which Verified Permissions can then use as an identity source.

Match the pairs

Who authorises what?

Exam skills 4.2.1 · 4.1.1

Match each service with what it authorises or does.

Log in to try this activity Interactive activities are free with an account.
Worked example

Document sharing rules in Cedar

A document application has authorisation checks scattered through its code, and a bug let users read documents shared with other teams. The rules are moved into a Verified Permissions policy store:

permit(principal, action == Action::"ViewDocument", resource)
when { resource.owner == principal || resource.sharedWith.contains(principal.team) };

forbid(principal, action, resource)
when { resource.classification == "restricted" && !(principal in Group::"Compliance") };

Before every action, the application calls IsAuthorized with the user's Cognito token and the document's attributes. The forbid policy overrides any permit, so restricted documents stay with the compliance group however they are shared. Authorisation rules can now be reviewed and changed without redeploying the application.

Check yourself

When does an application call Verified Permissions?

Show answer

Before each action, with IsAuthorized, so authorisation is decided outside the application code.

Exam Tips

Remember for the exam

  • For fine-grained, externalised authorisation in an application, written in Cedar, use Verified Permissions.
  • To use Cognito tokens for application authorisation decisions, configure a Verified Permissions identity source.
  • Applications call IsAuthorized before each action.
  • Verified Permissions authorises application users, not AWS API calls.
  • Verified Access also uses Cedar, but for network access to applications.