
com.wavefront.agent.auth.StaticTokenAuthenticator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of proxy Show documentation
Show all versions of proxy Show documentation
Service for batching and relaying metric traffic to Wavefront
package com.wavefront.agent.auth;
import com.google.common.base.Preconditions;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* {@link TokenAuthenticator} that validates tokens by comparing them to a pre-defined value.
*
* @author [email protected]
*/
class StaticTokenAuthenticator implements TokenAuthenticator {
private final String staticToken;
StaticTokenAuthenticator(@Nonnull String staticToken) {
Preconditions.checkNotNull(staticToken, "staticToken parameter must be set");
this.staticToken = staticToken;
}
@Override
public boolean authorize(@Nullable String token) {
return staticToken.equals(token);
}
@Override
public boolean authRequired() {
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy