Key Scenarios

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.

This topic describes the most common situations developers must address when providing security functionality in their applications. Each scenario explains the task, describes a real-world situation where such a task might occur, and includes code that demonstrates how to use the Security Application Block to complete the task. The scenarios are the following:

  • Obtaining a Temporary Token for an Authenticated User. This scenario illustrates how to use the SaveIdentity method to cache an authenticated identity and return a temporary token that serves as an alternative to user credentials for the duration of the user session. You can also use this technique to save a user principal or a user identity.
  • Authenticating a User Using a Token. This scenario illustrates how to use the GetIdentity method to return an identity that has already been cached, when provided with a valid token. The same technique can be used to retrieve a user principal or user profile.
  • Terminating a User Session (Expiring a Token). This scenario illustrates how to use the ExpireIdentity method to expire a token corresponding to an identity, when the user session ends. You can also use this technique to expire a user principal or a user profile.
  • Determining Whether a User is Authorized to Perform a Task. This scenario illustrates how to use the GetAuthorizationProvider method of the AuthorizationFactory class to retrieve an authorization provider and how to use the Authorize method of the returned authorization provider to perform authorization.

You can also use the Unity Integration approach to create instances of the objects in the Security Application Block. For more details of the integration of Enterprise Library and the Unity Application Block, see Creating Objects Using the Unity Application Block.