Mac Developer Library

Developer

SecurityInterface Framework Reference SFAuthorizationPluginView Class Reference

Options
Deployment Target:

On This Page
Language:

SFAuthorizationPluginView

The SFAuthorizationPluginView class allows authorization plug-in developers to create a custom view their plug-in can display. More...

Inheritance


Conforms To


Import Statement


Not Applicable @import SecurityInterface;

Availability


Available in OS X v10.5 and later
  • Returns the AuthorizationCallbacks structure with which this instance was initialized.

    Declaration

    Objective-C

    - (const AuthorizationCallbacks *)callbacks

    Return Value

    An object of type AuthorizationCallbacks.

    Discussion

    Use the AuthorizationCallbacks structure to get the function pointers to functions such as SetResult and SetContextValue.

    Import Statement

    Availability

    Available in OS X v10.5 and later.

  • Returns the authorization engine handle with which this instance was initialized.

    Declaration

    Objective-C

    - (AuthorizationEngineRef)engineRef

    Return Value

    A handle of type AuthorizationEngineRef.

    Discussion

    Use the authorization engine handle when you call the functions in the AuthorizationCallbacks structure to set a result or a context value.

    Import Statement

    Availability

    Available in OS X v10.5 and later.

  • Returns the last error that occurred during evaluation.

    Declaration

    Objective-C

    - (NSError *)lastError

    Discussion

    Your authorization plug-in should override this method and return the last error that occurred during evaluation or nil if no error occurred.

    A downstream plug-in can set a context value using the kAuthorizationContextFlagSticky flag to make it available to the SFAuthorizationPluginView class in case of an error.

    Import Statement

    Availability

    Available in OS X v10.5 and later.

  • Informs the SFAuthorizationPluginView instance when a user presses a button in the custom view.

    Declaration

    Objective-C

    - (void)buttonPressed:(SFButtonType)inButtonType

    Parameters

    inButtonType

    The type of button that was pressed.

    Discussion

    By default, buttonPressed: will set a result of Deny when the OK or Login buttons are pressed. An SFAuthorizationPluginView subclass needs to override this method to set the context values for the short name of the user so that user attributes can be looked up. To do this, use kAuthorizationEnvironmentUsername as the key. A subclass should also set any additional context values that are needed by the authorization plug-in to verify the user’s credentials. To do this, use the appropriate function pointers you receive from callbacks.

    When you override this method, do not call [super buttonPressed].

    Import Statement

    Availability

    Available in OS X v10.5 and later.

  • Returns the appropriate NSView object for the specified SFViewType.

    Declaration

    Objective-C

    - (NSView *)viewForType:(SFViewType)inType

    Parameters

    inType

    The type of view being requested by the authorization plug-in.

    Return Value

    An NSView object representing either a credentials view or an identity and credentials view.

    Discussion

    When the authorization plug-in calls this method, the SFAuthorizationPluginView instance should return the NSView object that represents the view indicated by the specified SFViewType. The NSView object and its contents should have the autoresize flags set to allow the view to be resized.

    Note that although a maximum width of 394 points is currently supported, this may change in the future. You should not assume that the width of the NSView object will never change.

    Import Statement

    Availability

    Available in OS X v10.5 and later.

  • Informs the SFAuthorizationPluginView instance when the authorization plug-in makes the instance’s user interface active.

    Declaration

    Objective-C

    - (void)didActivate

    Import Statement

    Availability

    Available in OS X v10.5 and later.

  • Informs the SFAuthorizationPluginView instance when the authorization plug-in deactivates its user interface.

    Declaration

    Objective-C

    - (void)didDeactivate

    Import Statement

    Availability

    Available in OS X v10.5 and later.

  • Informs the SFAuthorizationPluginView instance when its user interface is about to be made active by the Apple-provided Security Agent.

    Declaration

    Objective-C

    - (void)willActivateWithUser:(NSDictionary *)inUserInformation

    Parameters

    inUserInformation

    A dictionary that contains the following information:

    • kSFAuthorizationPluginViewUserNameKey

      An NSString object containing the selected user’s name

    • kSFAuthorizationPluginViewUserShortNameKey

      An NSString object containing the selected user’s short name

    Note: inUserInformation may be nil.

    Discussion

    Your SFAuthorizationPluginView instance can use the user name to pre-populate a text field in the user interface.

    Import Statement

    Availability

    Available in OS X v10.5 and later.

  • Returns the first view in the keyboard loop of the view.

    Declaration

    Objective-C

    - (NSView *)firstKeyView

    Discussion

    The default return value of this method is nil. When the authorization plug-in calls this method, your subclass should return the first view in the keyboard loop of your custom NSView object.

    Import Statement

    Availability

    Available in OS X v10.5 and later.

  • Returns the view that should get focus for keyboard events.

    Declaration

    Objective-C

    - (NSResponder *)firstResponder

    Discussion

    The default return value of this method is nil. When the authorization plug-in calls this method, your subclass should return the view that should get the focus for keyboard events.

    Import Statement

    Availability

    Available in OS X v10.5 and later.

  • Returns the last view in the keyboard loop of the view.

    Declaration

    Objective-C

    - (NSView *)lastKeyView

    Discussion

    The default return value of this method is nil. When the authorization plug-in calls this method, your subclass should return the last view in the keyboard loop of your custom NSView object.

    Import Statement

    Availability

    Available in OS X v10.5 and later.

  • Enables or disables the controls in the SFAuthorizationPluginView instance’s view.

    Declaration

    Objective-C

    - (void)setEnabled:(BOOL)inEnabled

    Parameters

    inEnabled

    The state the controls should be in.

    Discussion

    When the authorization plug-in calls this method, the subclass should call setEnabled: on the controls that are in its view.

    Import Statement

    Availability

    Available in OS X v10.5 and later.

  • Displays the user interface provided by the SFAuthorizationPluginView subclass.

    Declaration

    Objective-C

    - (void)displayView

    Discussion

    It’s not likely that you will want to override this method, but if you do, be sure to call [super displayView]. If you don’t call [super displayView], your custom view will not get displayed.

    This method will raise an SFDisplayViewException exception if an error occurs while displaying the authorization dialog.

    Import Statement

    Availability

    Available in OS X v10.5 and later.

  • Enables or disables a button in the SFAuthorizationPluginView instance’s user interface.

    Declaration

    Objective-C

    - (void)setButton:(SFButtonType)inButtonType enabled:(BOOL)inEnabled

    Parameters

    inButtonType

    The type of the button.

    inEnabled

    YEStrue to enable the button, NOfalse to disable the button.

    Import Statement

    Availability

    Available in OS X v10.5 and later.

  • Tells the authorization plug-in to get and display the appropriate view in the SFAuthorizationPluginView instance’s user interface.

    Declaration

    Objective-C

    - (void)updateView

    Discussion

    Your subclass of SFAuthorizationPluginView should call this method when a user clicks a button in your view that should result in a new view being displayed. Calling this method causes the authorization plug-in to get the new view and display it.

    Import Statement

    Availability

    Available in OS X v10.5 and later.

  • These constants define the button types used by authorization plug-ins.

    Declaration

    Objective-C

    typedef enum{ SFButtonTypeCancel = NSCancelButton, SFButtonTypeOK = NSOKButton, SFButtonTypeBack = SFButtonTypeCancel, SFButtonTypeLogin = SFButtonTypeOK } SFButtonType;

    Constants

    • SFButtonTypeCancel

      SFButtonTypeCancel

      Indicates the Cancel button was pressed.

      Available in OS X v10.5 and later.

    • SFButtonTypeOK

      SFButtonTypeOK

      Indicates the OK button was pressed.

      Available in OS X v10.5 and later.

    • SFButtonTypeBack

      SFButtonTypeBack

      Indicates the Back button was pressed.

      Available in OS X v10.5 and later.

    • SFButtonTypeLogin

      SFButtonTypeLogin

      Indicates the Login button was pressed.

      Available in OS X v10.5 and later.

    Import Statement

    Availability

    Available in OS X v10.5 and later.

  • These constants define the view type requested by the authorization plug-in.

    Declaration

    Objective-C

    typedef enum { SFViewTypeIdentityAndCredentials, SFViewTypeCredentials } SFViewType;

    Constants

    • SFViewTypeIdentityAndCredentials

      SFViewTypeIdentityAndCredentials

      Indicates a view that contains controls for identity and credentials was requested by the authorization plug-in.

      Available in OS X v10.5 and later.

    • SFViewTypeCredentials

      SFViewTypeCredentials

      Indicates a view that contains controls for credentials was requested by the authorization plug-in.

      Available in OS X v10.5 and later.

    Import Statement

    Availability

    Available in OS X v10.5 and later.

  • Exceptions thrown by the SFAuthorizationPluginView class

    Declaration

    Objective-C

    extern NSString * const SFDisplayViewException;

    Constants

    • SFDisplayViewException

      SFDisplayViewException

      Raised when an error occurs in displaying the authorization dialog.

      Available in OS X v10.5 and later.

    Import Statement