# IComparablePrincipal

Interface for principals that can be compared.

This only needs to be implemented for principals that could potentially be value-equal.
Identity-equal principals will be handled correctly by default.

Extends: IComparablePrincipal
Extends: IPrincipal
Implemented by: AccountPrincipal, AccountRootPrincipal, AnyPrincipal, ArnPrincipal, CanonicalUserPrincipal, CompositePrincipal, FederatedPrincipal, OpenIdConnectPrincipal, OrganizationPrincipal, PrincipalBase, PrincipalWithConditions, SamlConsolePrincipal, SamlPrincipal, ServicePrincipal, SessionTagsPrincipal, StarPrincipal, WebIdentityPrincipal, ViaServicePrincipal

- Source: [`aws-iam/lib/principals.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-iam/lib/principals.ts#L83)
- Type last changed: v2.26.0 · 30 May 2022

## Properties

- `assumeRoleAction`: string — When this Principal is used in an AssumeRole policy, the action to use.

- `grantPrincipal`: [IPrincipal](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IPrincipal.html) — The principal to grant permissions to.

- `policyFragment`: [PrincipalPolicyFragment](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.PrincipalPolicyFragment.html) — Return the policy fragment that identifies this principal in a Policy.

- `principalAccount`: string — The AWS account ID of this principal.

  Can be undefined when the account is not known
  (for example, for service principals).
  Can be a Token - in that case,
  it's assumed to be AWS::AccountId.

## Methods

- `addToPrincipalPolicy(statement: PolicyStatement): AddToPrincipalPolicyResult` — Add to the policy of this principal.

- `dedupeString(): string` — Return a string format of this principal which should be identical if the two principals are the same.
