AuthenticationDialog
initiates a standard dialog for entering username/password authentication information.
AuthenticationDialog["type"]
initiates an authentication dialog of the specified standard type.
AuthenticationDialog[{"key1","key2", …}]
initiates an authentication dialog that requests values for the specified keys.
AuthenticationDialog[arg,func]
applies the function func to the dialog's return value.
Details and Options
- Possible values for type include:
-
"UsernamePassword" a dialog with fields for username and password "Password" a dialog with a password field "PermissionsKey" a dialog for entering a PermissionsKey "SecuredAuthenticationKey" a dialog for entering a SecuredAuthenticationKey - AuthenticationDialog[] displays a dialog of type "UsernamePassword".
- AuthenticationDialog[arg] is equivalent to AuthenticationDialog[arg,Identity].
- Password fields automatically use FieldMasked to mask their contents in the dialog display.
- If the user cancels the dialog, AuthenticationDialog returns $Canceled, even if a function func is specified.
- AuthenticationDialog["PermissionsKey"] returns a PermissionsKey expression.
- AuthenticationDialog["SecuredAuthenticationKey"] returns a SecuredAuthenticationKey expression.
- All other dialog types return an Association.
- The Wolfram Language kernel in which AuthenticationDialog is evaluated will block until the dialog is finished.
- When no front end is present, AuthenticationDialog writes to standard output and reads from standard input.
- The forms AuthenticationDialog["type"->{"key1"->"init1",…}] and AuthenticationDialog[{"key1"->"init1",…}] can be used to specify initial values for any of the fields.
- The option setting SystemCredentialKey"name" allows data to be remembered securely in the current keyring given by $SystemCredentialStore.
- The content of a field specified as "key1"->"init1"->"Masked" will be masked.
- AuthenticationDialog[FormObject[…]] is also supported on some platforms, to display an arbitrary form in the dialog.
- AuthenticationDialog accepts notebook options and AppearanceRules.
- AppearanceRules can be used to specify the overall appearance of the dialog, including a title and descriptive text.
- AuthenticationDialog by default puts up a dialog in the middle of the main display screen. Explicit settings for WindowMargins override this.
Examples
open allclose allBasic Examples (4)
Scope (7)
Provide initial values for some of the dialog fields:
Specify a function to process the resulting Association:
Use custom key names, specifying optional initial values and masking:
Use SystemCredentialKey"name" to securely store the dialog fields between sessions. The data is stored under the provided name:
The data is remembered in secure storage under the given name:
Use FormObject for other control types, optional fields, and so on:
Use AuthenticationDialog in a standalone Wolfram Language kernel:
$ ./WolframKernel
Mathematica 13.2.0 Kernel for Mac OS X x86 (64-bit)
Copyright 1988-2022 Wolfram Research, Inc.
In[1]:= AuthenticationDialog[]
Username: matt
Password: *****
Out[1]= <|Username -> matt, Password -> 12345|>
Use AuthenticationDialog in wolframscript:
$ wolframscript -code "AuthenticationDialog[]"
Username: matt
Password: *****
<|Username -> matt, Password -> 12345|>
$
Generalizations & Extensions (1)
The "UsernamePassword" AuthenticationDialog has an additional feature if used with the SystemCredentialKey option. The fields are stored for each username previously provided:
A new instance of the dialog is automatically filled with the last-used credentials. The password field is automatically filled after selecting an entry from the drop-down menu:
The entries for all usernames are stored in secure storage with names derived from the base name:
Options (7)
AppearanceRules (3)
SystemCredentialKey (2)
Use SystemCredentialKey to securely store the dialog fields between sessions:
Recall the stored field values by using the same domain as before:
WindowTitle (1)
Use WindowTitle and other notebook options to adjust aspects of the dialog's notebook window:
Properties & Relations (2)
Use AuthenticationDialog as a setting for Authentication, to prompt for credentials when needed:
Use AuthenticationDialog to request a password for other functions, like Encrypt and Decrypt:
Possible Issues (5)
Preemptive controls cannot block the kernel's evaluation queue:
Always call AuthenticationDialog from a queued evaluation:
AuthenticationDialog blocks the kernel's evaluation queue, preventing asynchronous dynamics from rendering:
Only synchronous dynamics will render while the kernel's evaluation queue is blocked:
AuthenticationDialog will use any stored credentials that match the dialog's keys for the given domain:
If another unrelated authentication dialog uses the same SystemCredentialKey, its old values will be overwritten:
SystemCredentialKey is ignored for any AuthenticationDialog that uses a FormObject:
SystemCredentialKey is ignored for any AuthenticationDialog in a standalone Wolfram Language kernel:
> wolfram
Mathematica 13.2.0 Kernel for Microsoft Windows (64-bit)
Copyright 1988-2022 Wolfram Research, Inc.
In[1]:= AuthenticationDialog["Password", SystemCredentialKey->"Domain"] Password: *** Out[1]= <|Password -> 123|>
Text
Wolfram Research (2018), AuthenticationDialog, Wolfram Language function, https://reference.wolfram.com/language/ref/AuthenticationDialog.html (updated 2020).
CMS
Wolfram Language. 2018. "AuthenticationDialog." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/AuthenticationDialog.html.
APA
Wolfram Language. (2018). AuthenticationDialog. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AuthenticationDialog.html