<!--
{
  "availability" : [
    "macOS: 10.10.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SecurityFoundation",
  "identifier" : "/documentation/SecurityFoundation/SFAuthorization/authorization(with:rights:environment:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Security Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)SFAuthorization(cm)authorizationWithFlags:rights:environment:"
  },
  "title" : "authorization(with:rights:environment:)"
}
-->

# authorization(with:rights:environment:)

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

```
class func authorization(with flags: AuthorizationFlags, rights: UnsafePointer<AuthorizationRights>!, environment: UnsafePointer<AuthorizationEnvironment>!) -> Any!
```

## Parameters

`flags`

A bit mask for specifying authorization options. Use the following option sets:

- Pass the constant <doc://com.apple.documentation/documentation/Security/AuthorizationFlags/kAuthorizationFlagDefaults> if no options are necessary.
- Specify the <doc://com.apple.documentation/documentation/Security/AuthorizationFlags/extendRights> mask to request rights. You can also specify the <doc://com.apple.documentation/documentation/Security/AuthorizationFlags/interactionAllowed> mask to allow user interaction.
- Specify the <doc://com.apple.documentation/documentation/Security/AuthorizationFlags/partialRights> and <doc://com.apple.documentation/documentation/Security/AuthorizationFlags/extendRights> masks to request partial rights. You can also specify the <doc://com.apple.documentation/documentation/Security/AuthorizationFlags/interactionAllowed> mask to allow user interaction.
- Specify the <doc://com.apple.documentation/documentation/Security/AuthorizationFlags/preAuthorize> and <doc://com.apple.documentation/documentation/Security/AuthorizationFlags/extendRights> masks to preauthorize rights.
- Specify the <doc://com.apple.documentation/documentation/Security/AuthorizationFlags/destroyRights> mask to prevent the Security framework from preserving the rights obtained during this call.

`rights`

A pointer to a set of authorization rights you create. Pass `NULL` if the application requires no rights at this time.

`environment`

Data used when authorizing or preauthorizing rights. In macOS 10.3 and later, you can pass icon or prompt data to be used in the authentication dialog box. Possible values for this parameter are listed in `Security.framework/Headers/AuthorizationTags.h`. The data passed in this parameter is not stored in the authorization reference; it is used only during authorization. If you are not passing any data in this parameter, pass the constant <doc://com.apple.documentation/documentation/Security/kAuthorizationEmptyEnvironment>.

## Return value

The authorization object.

## Discussion

Normally, such initialization is not required, as you pass in flags, rights, and environmental data when you request authorization.

---

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)