IntelliJ IDEA 9.0.3 brings you a new feature that simplifies storing of your credentials: Password Safe. With it, you can store passwords, encrypted with master password in IntelliJ IDEA either permanently in application settings, or temporary, in memory until you close IntelliJ IDEA.
Passwords in memory are stored while you are working with IntelliJ IDEA, if disk storage is selected, passwords are encrypted and stored in a database. Before database is accessed for the first time, a master password is requested. It is also possible to change master password or reset it, but then you are losing all passwords encrypted with password you are resetting.
Note that on Windows systems there is an option to encrypt master password using user credentials. This is less secure, but more convenient option. In which case master password is stored in an encrypted form in the application settings, and it can be accessed by any application that is run from under this user account. The value of this option can be specified using reset and change password dialog.
Git integration uses this functionality to store SSH passwords and passphrases. If your plugin needs to store passwords, you can make use of the PasswordSafe component or just use PasswordSafePromptDialog that automatically remembers entered passwords in the password database.