Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 9737deae authored by Rafael Tonholo's avatar Rafael Tonholo
Browse files

Revert "chore: convert OAuth2TokenProvider to Kotlin"

This reverts commit 481aa5c5
parent 3b4ef254
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
package com.fsck.k9.mail.oauth
package com.fsck.k9.mail.oauth;

import com.fsck.k9.mail.AuthenticationFailedException

interface OAuth2TokenProvider {
    companion object {
import com.fsck.k9.mail.AuthenticationFailedException;


public interface OAuth2TokenProvider {
    /**
     * A default timeout value to use when fetching tokens.
     */
        const val OAUTH2_TIMEOUT = 30000L
    }
    int OAUTH2_TIMEOUT = 30000;

    /**
     * Fetch the primary email found in the id_token additional claims,
     * if it is available.
     *
     * > Some providers, like Microsoft, require this as they need the primary account email to be the username,
     * not the email the user entered
     *
     * @return the primary email present in the id_token, otherwise null.
     */
    val primaryEmail: String?
        @Throws(AuthenticationFailedException::class)
        get

    /**
     * Fetch a token. No guarantees are provided for validity.
     */
    @Throws(AuthenticationFailedException::class)
    fun getToken(timeoutMillis: Long): String
    String getToken(long timeoutMillis) throws AuthenticationFailedException;

    /**
     * Invalidate the token for this username.
     *
     * <p>
     * Note that the token should always be invalidated on credential failure. However invalidating a token every
     * single time is not recommended.
     *
     * <p>
     * Invalidating a token and then failure with a new token should be treated as a permanent failure.
     */
    fun invalidateToken()
    void invalidateToken();
}