alluxio.security.user.NoopUserState Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alluxio-core-common Show documentation
Show all versions of alluxio-core-common Show documentation
Common utilities shared in Alluxio core modules
/*
* The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
* (the "License"). You may not use this work except in compliance with the License, which is
* available at www.apache.org/licenses/LICENSE-2.0
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied, as more fully set forth in the License.
*
* See the NOTICE file distributed with this work for information regarding copyright ownership.
*/
package alluxio.security.user;
import alluxio.conf.AlluxioConfiguration;
import alluxio.conf.PropertyKey;
import alluxio.exception.status.UnauthenticatedException;
import alluxio.security.User;
import alluxio.security.authentication.AuthType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.security.auth.Subject;
/**
* A UserState implementation which does nothing.
*/
public class NoopUserState extends BaseUserState {
private static final Logger LOG = LoggerFactory.getLogger(NoopUserState.class);
private static final User NOOP_USER = new User("");
/**
* Factory class to create the user state.
*/
public static class Factory implements UserStateFactory {
@Override
public UserState create(Subject subject, AlluxioConfiguration conf, boolean isServer) {
AuthType authType = conf.getEnum(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.class);
if (authType == AuthType.NOSASL) {
return new NoopUserState(subject, conf);
}
return null;
}
}
private NoopUserState(Subject subject, AlluxioConfiguration conf) {
super(subject, conf);
}
@Override
public User login() throws UnauthenticatedException {
return NOOP_USER;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy