All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.couchbase.lite.auth.TokenAuthenticator Maven / Gradle / Ivy

package com.couchbase.lite.auth;

import java.net.URL;
import java.util.Map;

/**
 * Authenticator impl that knows how to do token based auth
 *
 * @exclude
 */
public class TokenAuthenticator extends AuthenticatorImpl {
    private String loginPath;
    private MaploginParams;

    public TokenAuthenticator(String loginPath, Map loginParams) {
        this.loginPath = loginPath;
        this.loginParams = loginParams;
    }

    @Override
    public boolean usesCookieBasedLogin() {
        return true;
    }

    @Override
    public Map loginParametersForSite(URL site) {
        return loginParams;
    }

    @Override
    public String loginPathForSite(URL site) {
        String path = loginPath;
        if (path != null && !path.startsWith("/")) {
            path = '/' + path;
        }
        return path;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy