The class responsible for displaying a lock icon that can be used to indicate that a user interface has restricted access.
- macOS 10.3+
The lock appears locked when the user must be authorized and appears open when the user has been authorized. The closed and open lock icons of the authorization view are shown in the following figure.
When you add an authorization view as a custom view to a window or dialog box, you must initialize it before it displays correctly. To initialize the view, use the
set method to create a default rights structure (containing a prompt string) or the
set method to specify a rights structure. You must also either specify automatic updates (
set) or perform a manual update (
update) to set the lock icon to its initial state.
You can implement delegate methods that are invoked when the authorization view changes state. You can optionally implement the delegate methods to obtain the state of the authorization object when you are using an authorization view.
When the user clicks a locked authorization view icon, the Security Server displays an authentication dialog (to request a user name and password, for example). When the user provides the requested credentials, the lock icon unlocks and the user is considered preauthorized to perform the functions specified by the authorization rights structure. You can call the
update method to determine whether the user has been preauthorized: this method returns
YES if the view is in the unlocked state, otherwise
NO. Before committing changes or performing actions that require authorization, you should check the user’s authorization again, even if they are preauthorized.
The default behavior of this view is to preauthorize rights; if this is not possible it unlocks and waits for authorization to be checked when explicitly required.