/**
* Present a dialog to the user asking them for authentication information,
* and returns the user's response. The caller must have
* NetPermission("requestPasswordAuthentication") for this to work.
*
* @param host The host for with authentication is needed
* @param port The port being accessed
* @param prompt The prompt (realm) as presented by the server
* @param type The type of server (proxy/web)
* @return an array of objects representing user's authentication tokens
* @throws SecurityException if the caller does not have the appropriate permissions.
*/
public static NamePassword showAuthenicationPrompt(String host, int port, String prompt, String type) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
NetPermission requestPermission
= new NetPermission("requestPasswordAuthentication");
sm.checkPermission(requestPermission);
}
final SecurityDialogMessage message = new SecurityDialogMessage(null);
message.dialogType = DialogType.AUTHENTICATION;
message.extras = new Object[] { host, port, prompt, type };
DialogResult response = getUserResponse(message);
OutputController.getLogger().log(OutputController.Level.MESSAGE_DEBUG, "Decided action for matching alaca at was " + response);
return (NamePassword) response;
}
SecurityDialogs.java 文件源码
java
阅读 19
收藏 0
点赞 0
评论 0
项目:icedtea-web
作者:
评论列表
文章目录