Skip to main content
RSS feed Subscribe to feed

 

Virtual Columns: Using the CredentialsService

This example shows the basic use case for the credentials service.

private const string credentialsKey = "CredentialsScenarios.CredentialsKey";

public void BasicCredentialsServiceUsage(DocumentNode myNode)
{
    // Get the credentials service from the node.
    CredentialsService service = myNode.Context.GetService<CredentialsService>();

    // Check if credentials exist in the service.
    string credentials;
    if (service.TryGetCredentials(credentialsKey, out credentials))
    {
        // Use credentials.
    }

    // Set new credentials.
    service.SetCredentials(credentialsKey, "new credentials");
}