MCPcopy Create free account
hub / github.com/M66B/FairEmail / login

Method login

app/src/main/java/com/sun/mail/imap/IMAPStore.java:763–858  ·  view source on GitHub ↗
(IMAPProtocol p, String u, String pw)

Source from the content-addressed store, hash-verified

761 }
762
763 private void login(IMAPProtocol p, String u, String pw)
764 throws ProtocolException {
765 // turn on TLS if it's been enabled or required and is supported
766 // and we're not already using SSL
767 if ((enableStartTLS || requireStartTLS) && !p.isSSL()) {
768 if (p.hasCapability("STARTTLS")) {
769 p.startTLS();
770 // if startTLS succeeds, refresh capabilities
771 p.capability();
772 } else if (requireStartTLS) {
773 logger.fine("STARTTLS required but not supported by server");
774 throw new ProtocolException(
775 "STARTTLS required but not supported by server");
776 }
777 }
778 if (p.isAuthenticated())
779 return; // no need to login
780
781 // allow subclasses to issue commands before login
782 preLogin(p);
783
784 // issue special ID command to Yahoo! Mail IMAP server
785 // http://en.wikipedia.org/wiki/Yahoo%21_Mail#Free_IMAP_and_SMTPs_access
786 if (guid != null) {
787 Map<String,String> gmap = new HashMap<>();
788 gmap.put("GUID", guid);
789 p.id(gmap);
790 }
791
792 /*
793 * Put a special "marker" in the capabilities list so we can
794 * detect if the server refreshed the capabilities in the OK
795 * response.
796 */
797 p.getCapabilities().put("__PRELOGIN__", "");
798 String authzid;
799 if (authorizationID != null)
800 authzid = authorizationID;
801 else if (proxyAuthUser != null)
802 authzid = proxyAuthUser;
803 else
804 authzid = null;
805
806 if (enableSASL) {
807 try {
808 p.sasllogin(saslMechanisms, saslRealm, authzid, u, pw);
809 if (!p.isAuthenticated())
810 throw new CommandFailedException(
811 "SASL authentication failed");
812 } catch (UnsupportedOperationException ex) {
813 // continue to try other authentication methods below
814 }
815 }
816
817 if (!p.isAuthenticated())
818 authenticate(p, authzid, u, pw);
819
820 if (proxyAuthUser != null)

Callers 4

protocolConnectMethod · 0.95
getProtocolMethod · 0.95
getStoreProtocolMethod · 0.95
authenticateMethod · 0.45

Calls 15

preLoginMethod · 0.95
authenticateMethod · 0.95
capabilityMethod · 0.80
fineMethod · 0.80
isAuthenticatedMethod · 0.80
proxyauthMethod · 0.80
eMethod · 0.80
isSSLMethod · 0.45
hasCapabilityMethod · 0.45
startTLSMethod · 0.45
putMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected