Package com.isode.x400api
Class Credentials
java.lang.Object
com.isode.x400api.Credentials
Class to handle the building of a bind credentials string and to tokenise a credentials string.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumTypes may be simple (password) or strong (P3/P7). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildCredentials(Credentials.BindAuthType authType, String pass, String mtaPassword, String filename, String trustedCACertificatesDirectory, String orAddress, String mtaName, String gdi) Build a credentials string.static Credentials.BindAuthTypetokeniseCredentials(String credentials, Map<String, String> creds) Tokenise the stored credentials and return the bind auth type.
-
Constructor Details
-
Credentials
public Credentials()
-
-
Method Details
-
buildCredentials
public static String buildCredentials(Credentials.BindAuthType authType, String pass, String mtaPassword, String filename, String trustedCACertificatesDirectory, String orAddress, String mtaName, String gdi) Build a credentials string. This is typically passed to x400_ms_open().- Parameters:
authType- - the auth type, simple or strong (P3/P7).pass- - the password for simple or the PKCS#12 file passphrase for strong auth.mtaPassword- - the expected password in the simple bind response from the MTA.filename- - the PKCS#12 filename for strong auth.trustedCACertificatesDirectory- - the directory holding the trused CA certificates in PEM and/or CRT foramt.orAddress- - the recipient ORAddress for MTA/UA->MS binds.mtaName- - the MTA name for MS/UA->MTA binds.gdi- - the MTA GDI for MS/UA->MTQA binds.- Returns:
- The credentials with the necessary components embedded. This is interpreted by
x400_ms_open()in order to figure out what bind type is required and what the parameters are. - Note: By default (an industry norm) the simple bind response password (
mtaPassword) for the MTA is never checked.
We can force this checking by setting themtaPasswordparameter when building the simple authentication credentials.
If we tokenise the credentials and themtaPasswordis null or empty, we skip the test, and just accept whatever is returned.
Example 1:String creds = buildCredentials(MS_BIND_SIMPLE, pass, "MTAPassword", null, null, null, null, null);
and passingcredsas the credentials argument tox400_ms_open()will check if the returned password matches"MTAPassword".
Example 2:String creds = buildCredentials(MS_BIND_SIMPLE, pass, null, null, null, null, null, null);
and passingcredsas the credentials argument to X400msOpen(), or just passing the plainpassas the credentials argument to x400_ms_open() will skip the test.
-
tokeniseCredentials
public static Credentials.BindAuthType tokeniseCredentials(String credentials, Map<String, String> creds) Tokenise the stored credentials and return the bind auth type.- Parameters:
credentials- - the credentials string to tokenise.creds- - a hash map of the credentials on success.- Returns:
- the bind auth type.
-