Issue #321 - DeadCode JaspiAuthenticatorFactory.findServerName Server param not used
removed the subject parameter and instead get the subject from findServiceSubject(server) contextPath String was not being used Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
88d1ead25b
commit
3029f30d2b
|
@ -23,7 +23,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.security.auth.Subject;
|
||||
import javax.security.auth.message.AuthException;
|
||||
import javax.security.auth.message.config.AuthConfigFactory;
|
||||
|
@ -95,19 +94,15 @@ public class JaspiAuthenticatorFactory extends DefaultAuthenticatorFactory
|
|||
try
|
||||
{
|
||||
AuthConfigFactory authConfigFactory = AuthConfigFactory.getFactory();
|
||||
RegistrationListener listener = new RegistrationListener()
|
||||
{
|
||||
@Override
|
||||
public void notify(String layer, String appContext)
|
||||
{}
|
||||
};
|
||||
RegistrationListener listener = (layer, appContext) -> {};
|
||||
|
||||
Subject serviceSubject=findServiceSubject(server);
|
||||
String serverName=findServerName(server,serviceSubject);
|
||||
String serverName=findServerName(server);
|
||||
|
||||
String contextPath=context.getContextPath();
|
||||
if (contextPath==null || contextPath.length()==0)
|
||||
contextPath="/";
|
||||
String appContext = serverName + " " + context.getContextPath();
|
||||
String appContext = serverName + " " + contextPath;
|
||||
|
||||
AuthConfigProvider authConfigProvider = authConfigFactory.getConfigProvider(MESSAGE_LAYER,appContext,listener);
|
||||
|
||||
|
@ -146,7 +141,7 @@ public class JaspiAuthenticatorFactory extends DefaultAuthenticatorFactory
|
|||
return _serviceSubject;
|
||||
List<Subject> subjects = (List<Subject>)server.getBeans(Subject.class);
|
||||
if (subjects.size()>0)
|
||||
return (Subject)subjects.get(0);
|
||||
return subjects.get(0);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -155,14 +150,15 @@ public class JaspiAuthenticatorFactory extends DefaultAuthenticatorFactory
|
|||
* If {@link #setServerName(String)} has not been called, then
|
||||
* use the name of the a principal in the service subject.
|
||||
* If not found, return "server".
|
||||
* @param server not used
|
||||
* @param subject the subject to use
|
||||
* @return the server name from the subject (or default value if not found in subject or principals)
|
||||
* @param server the server to find the name of
|
||||
* @return the server name from the service Subject (or default value if not found in subject or principals)
|
||||
*/
|
||||
protected String findServerName(Server server, Subject subject)
|
||||
protected String findServerName(Server server)
|
||||
{
|
||||
if (_serverName!=null)
|
||||
return _serverName;
|
||||
|
||||
Subject subject = findServiceSubject(server);
|
||||
if (subject!=null)
|
||||
{
|
||||
Set<Principal> principals = subject.getPrincipals();
|
||||
|
|
Loading…
Reference in New Issue