How to call CallbackHandler to input user name and password?
Hello,
I am new to CallbackHandlers. I wrote a small Swing application. I want this Swing application to display a login page so that user can enter user name and password, and then provide this to my CallbackHandler class.
Here is what I did in my Swing main method
public static void main(String[] args) {
try {
LoginContext lc = new LoginContext("Login",
new MyCallbackHandler());
lc.login();
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
new TestCVTApplication();
..Here is what I did in my CallbackHandler
public class MyCallbackHandler implements javax.security.auth.callback.CallbackHandler {
private String username;
private String password;
public MyCallbackHandler() {
public void handle(Callback[] callbacks) throws java.io.IOException, UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
if(callbacks[i] instanceof NameCallback){
NameCallback ncb = (NameCallback)callbacks;
ncb.setName(username);
if(callbacks[i] instanceof PasswordCallback){
PasswordCallback pcb = (PasswordCallback)callbacks[i];
pcb.setPassword(password.toCharArray());
Would you let me know what I am missing?
Thanks,
Mustafa
The code you posted never assigns values to the private username and password fields of the MyCallbackHandler class. So when its handle method is invoked it simply assigns nulls to the values in the callback objects.
Or is there code elsewhere you did not show? Are you certain that your callback is invoked at all?
- Tim
Similar Messages
-
To download Contribute, how do I find SFTP number, user name and password?
To download Contribute, am asked for a SFTP number, user name and password. How do I find those?
Am using a Mac Mini.I had been using an earlier version of Contribute, but when I upgraded to a Mac Mini, it no longer worked. Then I got a new version on a trial basis. When I tried to load to go full time with it a couple of days ago, I was asked for the SFTP number, user name and password. I am trying to download and use on my Mac Mini in my home office.
I just don't know what the SFTP number is or where I'd find it. I'm an uninformed, non-technical computer user.
Bob Vereen -
How do I manually add a user name and password to a wanted saved account
Ok you know how your mac will ask u if you want this password saved, and then you save , how do u manually save passwords/user names. In prefrence?
If you are not online, you are not communicating with anybody. Any router connection you can access will put you online, the system does not care which particular router is used or where it is.
-
How do I add an automatic user name and password fill-in for a website
When first visiting a website that requires a login, Firefox provides an option to remember the login/password for the site. If this option isn't selected the first time, how does one get Firefox to remember the login/password at a later date?
If you clicked "Not now" then Firefox will ask again on the next visit to that log in page.<br />
If you clicked "Never" then you create an exception and you need to remove that exception.
You can remove exceptions here: Tools > Options > Security: Passwords: Exceptions
See also [[Remembering passwords]]
http://kb.mozillazine.org/User_name_and_password_not_remembered -
What is user name and password for SLES10 SP1 SAP Version
Hello,
In order to install SAP NetWeaver 7.0 - Java and ABAP Trial Version on Linux - VMware Edition , I download SLES10 SP1 Vmware SAP version from novell, when I played SLES10SP1_Test_Drive.vmx,
the suse linux enterprse server was start. It asked me to input user name and password. I input slesuser and password is novell. But it was not correct. Who knows what user name and password I need input?
any help ?
Best Regards,
GeorgeHi
I have the same issue, I tried user root and password root doesn't work I've tried couple fo "stupid" word or root user but didn't work
Looks like we both missing file "index.html" so I suppose this is bug from Novell and SAP
I will let you know if I found anything.
Peter
See this forum you question
Where to download SLES10 SP1 SAP Version? -
Bypass user name and password prompt for sqlplus on Windows
Hi folks,
I had oracle 10g installed on my Windows XP SP2 system and everytime I use sqlplus, it prompts for user name and password. Some folks wrote some Unix shell scripts which invokes "sqlplus" without giving it user name and password, and these scripts are running fine on Solaris. So I would like to make these script to work on my Windows box as well. But obviously, it asks me user name and password every time. Since it is a shell script, sqlplus << EOT .... EOT will fail right away with : Fatal NI connect error 12560, blah blah blah...
So my question is how to make sqlplus bypass the user name and password questions.
Thanks,No sqlplus /nolog does not connect you to the database, you still need to connect to the database.
c:\sql>sqlplus /nolog
SQL*Plus: Release 10.2.0.2.0 - Production on Wed Feb 21 15:19:16 2007
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
idle> select * from dual;
SP2-0640: Not connected
idle> connect test/test
Connected.
test@ORCL> select * from dual;
D
X
Elapsed: 00:00:00.01
test@ORCL> -
Case 1, for a NON-JNDI based database connection:
Connection conn = DriverManager.getConnection(url, "username", "password");
Case 2, for a JNDI based database connection:
Context context = new InitialContext();
DataSource dataSource = (DataSource) context.lookup("java:comp/env/jdbc/test");
Connection conn = dataSource.getConnection();
Notice that for NON-JNDI based database connection, the username and password are specified. But for the
JNDI based database connection, there is no username and password specified. How come? If I want to specify the username and password for JNDI based connection, how can I do it?
Thanks
Scottscottjsn wrote:
Though your example shows using a jndi file, you user name is actually hard coded.There's no such thing as a "jndi file". The username is not hard coded because that's not code, it's a configuration file.
I believe my original question is how to use JNDI with the user name and password.The username and password are always the same. You have one set of those for the database, for all the users in your application. The only situation where that might differ is for example a testing server or development server having a different username and password.
They would have their own configuration files then.
The user name and password can be dynamically retireved and set for each authorized user on the fly.Authorization is a different beast. This (your code) is about getting database connections through a DataSource object. -
I save the RoboForm2Go program on a flash drive and when I opened a site that I had saved the user name and password, the RoboForm2Go would show up in the taskbar with the site I opened so I could just click on it and it would automatically fill in the info for me.
Under View>/toolbars, I don't have an option to choose RoboForm Toolbar. When I initially set up the program, I was using Internet Explorer and I can go to the taskbar at the bottom and choose RoboForm but then whatever site I was opening in Firefox will now open in Internet Explorer instead of Firefox. The old version of Firefox would display the RoboForm toolbar at the top.
-
User Name and Password for JCO RFC call to BAPI
Hi all,
What I think I know:
--We do NOT have Single Sign On configured so don't tell me to use SSO please - I agree, but...
--We have a requirement to do a goods receipt which prints labels for the handling units
.....The printer to which the labels are directed depends on the user who is running the transaction
What I think this means
--We will need to specify a user name and password in the RFC call so the label will go to the correct printer
--I cannot use the IllumnLoginPassword (or whatever its name is) for the password
--I need to prompt the user for their password a second time after they login to our MII app
The problem
--I will need to store the password somewhere for the duration of the session
......In session variable that has been encryted
.............I didn't see an encryption action block so I could create my own
......In the database using database column encryption
.............A little bit of a pain, but not too bad
Any corrections, alternatives, ideas .... ???
Thanks,
--Amy Smith
--HaworthThanks for the attention guys. A little clarification.
1. I have been assuming that I cannot use the IllumnLoginPassword for the JCO SAP password in the action block. If this is NOT true, then it solves my whole problem.
2. It would not work to prompt a shop floor person for their password every time they do an operation completion. Well, at least
if I don't want to not get lynched!
3. I am planning on prompting people every time they log on for their ECC password and retaining it somewhere secure while they are logged on (and longer if they skip the logoff step.)
4. I have been focusing on how/where to retain the password, but also need a way to encrypt it during transmission. Jeremy said the applet/BLS would at least encode it for me. That is good.
--Amy Smith
--Haworth
Edited by: Amy Smith on Feb 18, 2010 1:30 PM -
How do I connect to Net Flix? I put in my user name and password which work fine with my iMac but not on my Apple TV?
Can you give me a screenshot of the User Accounts window in Control Panel?
Please create a screenshot by following the guide mentioned at [[How do I create a screenshot of my problem?]].
Once you've done this, attach the saved screenshot file to your forum post by clicking the '''Browse...''' button below the ''Post your reply'' box. You really help us to visualize the problem. -
I had my user name and password saved for my library site. My grandson hit something and now the saved user name and password are gone. It asks me every time to enter it and it is getting annoying. How do I fix this. I want Firefox to remember these codes.
You can create a bookmark with the JavaScript code via a right-click on the "Remember Password" link on the squarefree.com website and choose "Bookmark This Link" and select the "Bookmarks Toolbar" as the destination folder for easy access.
* https://www.squarefree.com/bookmarklets/forms.html#remember_password
You need to use the "Remember Password" bookmarklet before or after filling the name and password field on the website with the <u>login form</u>, but before submitting the login form by clicking a button on the web page.
If the site is using autocomplete="off" then you see a number not equal to 0 (i.e. attributes were removed) in the pop-up alert from the bookmarklet and Firefox should offer to remember the name and password via a drop down dialog of the key icon that will appear on the location bar (Firefox 4+) or via an info bar at the top (Firefox 3). -
I did not know my kids had set up an Itunes account for me with one user name and password. then i got an i phone and set it up with a different email address and new password. how can i get my accounts to merge so i can have all of my music on my iphone
Quote: "You cannot merge two or more Apple IDs into a single one. You can, however, use one Apple ID for iCloud services and another Apple ID for store purchases (including iTunes in the Cloud and iTunes Match). See “Using one Apple ID for iCloud and a different Apple ID for Store Purchases” above for details." See also Apple ID & iCloud FAQ: http://support.apple.com/kb/HT4895?viewlocale=en_US&locale=en_US
You can set up your iCloud account on your iOS device under: "Settings > iCloud" and a other account for store purchases under "Settings > iTunes & App Stores". Unfortunately merging accounts is not possible but you could transfer all of your music manually via iTunes from your Mac or PC. -
How do I create one Apple ID and iTunes user name and password for all of my Apple products: iPad, iPhone, and iPod plus iTunes on my PC?
Yes, I do have multiple devices and it appeared to me that every time I tried to sync or log onto iTunes, the password was incorrect. Consequently, I was and am constantly changing it. Wouldn't it be nice if Apple would simply say that you only need one Apple ID and one password regardless of the number of Apple devices you intend to sync via iTunes.
Barring the above, how about a way to merge all of the Apple IDs and passwords into one. -
How to read the data from a file in another computer with user name and password login
How to read read the data from a file in anohter computer which need to login with user name and password?
duplicate post: http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2061478
duplicate post: http://forums.ni.com/t5/LabVIEW/do-need-to-enter-the-user-name-and-password-when-TCP-ip/m-p/2061612
duplicate post http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2060682 -
Trying to update my apps on the iPhone 3. When I type in user name and password, I get the message "Cannot connect to iTunes Store" How can I connect?
I have the same problem. Any suggestions?
Maybe you are looking for
-
Oracle ATG 10.1 issue in CSC
Hi all, I am doing CSC migration, from 10.0.3 to 10.1 version. But when I try to access agent UI, I am getting this error: **** Error Thu Jan 31 17:28:44 BRST 2013 1359660524099 /atg/dynamo/servlet/pipeline/RequestScopeManager/RequestScop
-
The ipad screen is white. Holding buttons didn't work so I restored it on iTunes. When I press home and on switch, the screen is white, goes black then back to white with no logo at all. Can't get past the white screen. This happened after running a
-
Acknowledgement errors in PI - JMS scenario
Hello, We have a scenario R3 Idoc -> PI7.0 -> JMS. After the Idoc message is sent to PI, In the sxi_monitor, in acknowledgement status column, I normally see a red icon which says ack not possible. But for few JMS interfaces, I observe there is a gre
-
Crashes whenever I try to copy an item from form to form
I crash frequently when I try to copy an item from one form to another. Many times, I will be able to copy 2-3 text boxes from one form to the next. On the 4th....crash. I get a image of a text box with a plus sign next to it when Livecycle locks...
-
JDI Configuration - Imports finished but nothing done
Hello, I am importing the files SAP_JTECHS, SAP_BUILDT, and SAP-JEE as per track configuration steps. We are on NW04 SP15. I started the imports, DEV and CONS system went OK (they were running a few minutes or so) but import into the TEST system fail