Rally.RestApi.UiForWpf Namespace |
This library provides a reusable UI for WPF to provide common authentication.
This pseudo code example shows how to use the UI for WPF. For a full working sample, please see the code in Test.Rally.RestApi.UiSample within the repository.
public static RestApiAuthMgrWpf wpfAuthMgr { get; set; } public static void PrimaryEntryMethod() { // HELP: Define your encryption items prior to instantiating authorization managers // You must define your own private application token. This ensures that your login details are not overwritten by someone else. string applicationToken = "RallyRestAPISample"; // You must set a user specific salt for encryption. string encryptionKey = "UserSpecificSaltForEncryption"; // You must define your own encryption routines. IEncryptionRoutines encryptionUtilities = new EncryptionUtilities(); // HELP: Instantiate authorization manager wpfAuthMgr = new RestApiAuthMgrWpf(applicationToken, encryptionKey, encryptionUtilities); // HELP: Configure labels for UI. These are global and used by the authentication manager to build their UI. // If this is not called, the default labels will be used. In this sample we are changing a label and the default server URL. ApiAuthManager.Configure(loginWindowServerLabelText: "My Updated Server Label", loginWindowDefaultServer: new Uri("http://onprem-url")); // HELP: Set the logo that is shown in the login window RestApiAuthMgrWpf.SetLogo(ImageResources.RallyLogo40x40); // Help: You can auto-authenticate if you want. We do not have it enabled for this application. // wpfAuthMgr.AutoAuthenticate(true); } // HELP: This method shows you how to open a login window. private void openWpfLogin_Click(object sender, RoutedEventArgs e) { // HELP: Delegates are provided so we can be notified that authentication or SSO authentication has completed. wpfAuthMgr.ShowUserLoginWindow(AuthenticationComplete, SsoAuthenticationComplete); } // HELP: This delegate notifies us that authentication has completed. private void AuthenticationComplete(RallyRestApi.AuthenticationResult authenticationResult, RallyRestApi api) { UpdateAuthenticationResults(authenticationResult, api); } // HELP: This delegate notifies us that SSO authentication has completed. private void SsoAuthenticationComplete(RallyRestApi.AuthenticationResult authenticationResult, RallyRestApi api) { UpdateAuthenticationResults(authenticationResult, api); } // HELP: This method handles the passthrough from the delegates. // This is where you would need to update your application to show the logged in state. private void UpdateAuthenticationResults(RallyRestApi.AuthenticationResult authenticationResult, RallyRestApi api) { // Change your applications behavoir based upon the new AuthenticationResult }
Class | Description | |
---|---|---|
RestApiAuthMgrWpf |
A WPF based authentication manager.
|
Delegate | Description | |
---|---|---|
WindowStateChangedEvent |
A delegate to indicate that the state of a window has been changed.
|
Enumeration | Description | |
---|---|---|
CustomWpfControlType |
A list of control types that can be replaced by custom controls.
|
|
WindowStateOption |
Shows the state of a window.
|
|
WindowTypeOption |
The type of window that we are sending information about.
|