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

Unverified Commit 57ee3c56 authored by Rafael Tonholo's avatar Rafael Tonholo
Browse files

chore: convert OAuth2TokenProvider to Kotlin

parent 11d5f95d
Loading
Loading
Loading
Loading
+13 −14
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

import com.fsck.k9.mail.AuthenticationFailedException;


public interface OAuth2TokenProvider {
interface OAuth2TokenProvider {
    companion object {
        /**
         * A default timeout value to use when fetching tokens.
         */
    int OAUTH2_TIMEOUT = 30000;

        const val OAUTH2_TIMEOUT: Int = 30000
    }

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

    /**
     * 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.
     */
    void invalidateToken();
    fun invalidateToken()
}