Authorizes and preauthorizes rights asynchronously.


func AuthorizationCopyRightsAsync(_ authorization: AuthorizationRef, _ rights: UnsafePointer<AuthorizationRights>, _ environment: UnsafePointer<AuthorizationEnvironment>?, _ flags: AuthorizationFlags, _ callbackBlock: @escaping AuthorizationAsyncCallback)



An authorization reference referring to the authorization session.


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


Data used when authorizing or preauthorizing rights. Not used in OS X v10.2 and earlier. In macOS 10.3 and later, you can pass icon or prompt data to be used in the authentication dialog box. In macOS 10.4 and later, you can also pass a user name and password in order to authorize a user without displaying 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 kAuthorizationEmptyEnvironment.


A bit mask for specifying authorization options. Use one of the options sets defined for the flags parameter in the AuthorizationCopyRights(_:_:_:_:_:) function.


A callback that you provide for the function to call when it finishes asynchronously. Use a function with the signature defined by AuthorizationAsyncCallback.


See the discussion for AuthorizationCopyRights(_:_:_:_:_:). This function behaves similarly, except that it performs its operations asynchronously and calls back to you upon completion.

See Also

Rights and Credentials

func AuthorizationCopyInfo(AuthorizationRef, AuthorizationString?, UnsafeMutablePointer<UnsafeMutablePointer<AuthorizationItemSet>?>) -> OSStatus

Retrieves supporting data such as the user name and other information gathered during evaluation of authorization.

typealias AuthorizationAsyncCallback

A block used as a callback for the asynchronous version of copying authorization rights.

typealias AuthorizationString

A zero-terminated string in UTF-8 encoding.

Authorization Rights Flags

Recognize the values the Security Server sets in an authorization item’s flag field.