com.ibm.wps.portletservice.credentialvault.credentials
Class JavaMailCredential

java.lang.Object
  extended by com.ibm.wps.portletservice.credentialvault.credentials.Credential
      extended by com.ibm.wps.portletservice.credentialvault.credentials.ActiveCredential
          extended by com.ibm.wps.portletservice.credentialvault.credentials.UserPasswordCredential
              extended by com.ibm.wps.portletservice.credentialvault.credentials.JavaMailCredential
All Implemented Interfaces:
ActiveCredential, Credential, JavaMailCredential, UserPasswordCredential, java.io.Serializable

Deprecated. since 6.0. Support of the IBM portlet API may be removed in a future release of WebSphere Portal. Use of the Java Portlet API (javax.portlet) is recommended instead.

public class JavaMailCredential
extends UserPasswordCredential
implements JavaMailCredential

Credential for authenticating at the back-end the javax.mail API. To be used in following way:

  1. Construct and initialize the credential
  2. Create a javax.mail.Session and have it authenticated by the credential
    To do so, call getAuthenticatedSession and supply you session object, the host name and optionally the port number to use
  3. Use the session for business calls to the mail server
Preconditions:

Since:
WP 5.1.0.1
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.ibm.wps.portletservice.credentialvault.credentials.UserPasswordCredential
secret
 
Fields inherited from class com.ibm.wps.portletservice.credentialvault.credentials.Credential
LOGGER_NAME
 
Fields inherited from interface com.ibm.portal.portlet.service.credentialvault.credentials.Credential
KEY_CREDENTIAL_SECRET
 
Constructor Summary
JavaMailCredential()
          Deprecated.  
 
Method Summary
 Session getAuthenticatedSession(Session session, java.lang.String host)
          Deprecated. Authenticates an javax.mail.Session.
 Session getAuthenticatedSession(Session session, java.lang.String host, int port)
          Deprecated. Authenticates an javax.mail.Session.
 int getSecretType()
          Deprecated. Returns the credential's Secret Type in terms of the constants declared in CredentialVaultService
Should be overwritten by any child class that "overwrites" the secret attribute.
 void init(java.util.Map config)
          Deprecated. Creates a new JavaMail credential.
 
Methods inherited from class com.ibm.wps.portletservice.credentialvault.credentials.ActiveCredential
isActive
 
Methods inherited from class com.ibm.wps.portletservice.credentialvault.credentials.Credential
checkInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.portal.portlet.service.credentialvault.credentials.ActiveCredential
isActive
 

Constructor Detail

JavaMailCredential

public JavaMailCredential()
Deprecated. 
Method Detail

init

public void init(java.util.Map config)
          throws CredentialVaultException
Deprecated. 
Creates a new JavaMail credential.

Specified by:
init in interface Credential
Specified by:
init in interface JavaMailCredential
Specified by:
init in interface UserPasswordCredential
Overrides:
init in class UserPasswordCredential
Parameters:
config - The configuration needed to initialize this credential:
  • KEY_CREDENTIAL_SECRET JavaMailCredentialSecret - the credential's secret (mandatory)
Throws:
CredentialVaultException - If any mandatory parameter is missing or has a wrong object type as value.

getSecretType

public int getSecretType()
Deprecated. 
Description copied from class: Credential
Returns the credential's Secret Type in terms of the constants declared in CredentialVaultService
Should be overwritten by any child class that "overwrites" the secret attribute.

Specified by:
getSecretType in interface Credential
Specified by:
getSecretType in interface JavaMailCredential
Specified by:
getSecretType in interface UserPasswordCredential
Overrides:
getSecretType in class UserPasswordCredential
Returns:
int Credential Secret Type identifier
See Also:
CredentialVaultService

getAuthenticatedSession

public Session getAuthenticatedSession(Session session,
                                       java.lang.String host)
                                throws MessagingException
Deprecated. 
Authenticates an javax.mail.Session.

Specified by:
getAuthenticatedSession in interface JavaMailCredential
Parameters:
session - The session to authenticate.
host - The mail server host name.
Returns:
Session The authenticated session.
Throws:
MessagingException - thrown if javax.mail.session.getTransport().connect() fails.

getAuthenticatedSession

public Session getAuthenticatedSession(Session session,
                                       java.lang.String host,
                                       int port)
                                throws MessagingException
Deprecated. 
Authenticates an javax.mail.Session.

Specified by:
getAuthenticatedSession in interface JavaMailCredential
Parameters:
session - The session to authenticate.
host - The mail server host name.
port - The mail server port number.
Returns:
Session The authenticated session.
Throws:
MessagingException - thrown if javax.mail.session.getTransport().connect() fails.