1 83 package com.ivata.groupware.business.mail.session; 84 85 import java.io.IOException ; 86 import java.io.ObjectInputStream ; 87 import java.io.ObjectOutputStream ; 88 import java.io.Serializable ; 89 90 import javax.mail.Authenticator ; 91 import javax.mail.PasswordAuthentication ; 92 93 94 103 public class MailAuthenticator extends Authenticator implements Serializable { 104 107 String userName; 108 109 112 String password; 113 114 126 public MailAuthenticator(String userName, String password) { 127 this.userName = userName; 128 this.password = password; 129 } 130 131 140 public PasswordAuthentication getPasswordAuthentication() { 141 return new PasswordAuthentication (userName, password); 142 } 143 144 151 private void writeObject(final ObjectOutputStream oos) throws IOException { 152 oos.defaultWriteObject(); 153 } 154 155 164 private void readObject(final ObjectInputStream ois) 165 throws ClassNotFoundException , IOException { 166 ois.defaultReadObject(); 167 } 168 } 169 | Popular Tags |