Contents

SFAuthorizationView

The class responsible for displaying a lock icon that can be used to indicate that a user interface has restricted access.

Declaration

class SFAuthorizationView

Overview

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.

[Image]

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 setString(_:) method to create a default rights structure (containing a prompt string) or the setAuthorizationRights(_:) method to specify a rights structure. You must also either specify automatic updates (setAutoupdate(_:) or setAutoupdate(_:interval:)) or perform a manual update (updateStatus(_:)) 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 updateStatus(_:) method to determine whether the user has been preauthorized: this method returns true if the view is in the unlocked state, otherwise false. 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.

Topics

Setting up the authorization view

Setting and getting the delegate for the view

Updating the view

Getting information about the authorization view

Setting the authorization state

Delegate methods

Constants

See Also

Classes