001package org.apache.hadoop.security.rpcauth; 002 003import org.apache.hadoop.ipc.protobuf.IpcConnectionContextProtos.UserInformationProto.Builder; 004import org.apache.hadoop.security.UserGroupInformation; 005import org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod; 006 007public final class SimpleAuthMethod extends RpcAuthMethod { 008 static final RpcAuthMethod INSTANCE = new SimpleAuthMethod(); 009 private SimpleAuthMethod() { 010 super((byte) 80, "simple", "", AuthenticationMethod.SIMPLE); 011 } 012 013 @Override 014 public void writeUGI(UserGroupInformation ugi, Builder ugiProto) { 015 ugiProto.setEffectiveUser(ugi.getUserName()); 016 if (ugi.getRealUser() != null) { 017 ugiProto.setRealUser(ugi.getRealUser().getUserName()); 018 } 019 } 020}