<!--
{
  "availability" : [
    "macOS: 10.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SecurityFoundation",
  "identifier" : "/documentation/SecurityFoundation/SFAuthorization",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Security Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)SFAuthorization"
  },
  "title" : "SFAuthorization"
}
-->

# SFAuthorization

A class that allows you to restrict a user’s access to particular features in your Mac app or daemon.

```
class SFAuthorization
```

## Overview> Important: The authorization services API is not supported within an app sandbox because it allows privilege escalation.

The [`SFAuthorization`](/documentation/SecurityFoundation/SFAuthorization) class is an interface for some of the functions in the Authorization Services API. You can use the [`authorizationRef()`](/documentation/SecurityFoundation/SFAuthorization/authorizationRef()) method to obtain an authorization reference, used in other calls to Authorization Services functions. The Authorization Services API is documented in <doc://com.apple.documentation/documentation/Security/authorization-services>.

## Topics

### Allocating and initializing an authorization object

[`authorization()`](/documentation/SecurityFoundation/SFAuthorization/authorization())

Returns an authorization object initialized with a default environment, flags, and rights.

[`authorization(with:rights:environment:)`](/documentation/SecurityFoundation/SFAuthorization/authorization(with:rights:environment:))

Returns an authorization object initialized with the specified flags, rights and environment.

[`init()`](/documentation/SecurityFoundation/SFAuthorization/init())

Initializes an authorization object with default environment, flags, and rights.

[`init(flags:rights:environment:)`](/documentation/SecurityFoundation/SFAuthorization/init(flags:rights:environment:))

Initializes an authorization object with the specified flags, rights, and environment.

### Obtaining an authorization reference

[`authorizationRef()`](/documentation/SecurityFoundation/SFAuthorization/authorizationRef())

Returns the authorization reference for this object.

### Authorizing rights

[`permitWithRights:flags:environment:authorizedRights:`](/documentation/SecurityFoundation/SFAuthorization/permitWithRights:flags:environment:authorizedRights:)

Authorizes and preauthorizes rights to access a privileged operation and returns the granted rights.

[`obtain(withRights:flags:environment:authorizedRights:)`](/documentation/SecurityFoundation/SFAuthorization/obtain(withRights:flags:environment:authorizedRights:))

Authorizes and preauthorizes rights to access a privileged operation and returns the granted rights.

[`permitWithRight:flags:`](/documentation/SecurityFoundation/SFAuthorization/permitWithRight:flags:)

Authorizes and preauthorizes one specific right.

[`obtain(withRight:flags:)`](/documentation/SecurityFoundation/SFAuthorization/obtain(withRight:flags:))

Authorizes and preauthorizes one specific right.

### Preventing credentials from being shared

[`invalidateCredentials()`](/documentation/SecurityFoundation/SFAuthorization/invalidateCredentials())

Prevents any rights that were obtained by this object from being preserved.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)