Gyeongtae Park created ZEPPELIN-6251:
----------------------------------------
Summary: Refactor AuthenticationService binding using factory
method
Key: ZEPPELIN-6251
URL: https://issues.apache.org/jira/browse/ZEPPELIN-6251
Project: Zeppelin
Issue Type: Improvement
Reporter: Gyeongtae Park
Fix For: 1.0.0, 0.12.1, 0.13.0
In {{{}ZeppelinServer.java{}}}, the conditional binding logic for
{{AuthenticationService}} has been refactored to improve readability and
maintainability.
Previously, the code directly used an {{if-else}} statement to bind either
{{ShiroAuthenticationService}} or {{NoAuthenticationService}} based on the
presence of a Shiro configuration path:
{code:java}
if (!StringUtils.isBlank(zConf.getShiroPath())) {
bind(ShiroAuthenticationService.class).to(AuthenticationService.class).in(Singleton.class);
} else {
bind(NoAuthenticationService.class).to(AuthenticationService.class).in(Singleton.class);
} {code}
This logic has now been encapsulated in a new class,
AuthenticationServiceFactory, which determines the appropriate implementation
class via a static method:
{code:java}
bind(AuthenticationServiceFactory.getAuthServiceClass(zConf))
.to(AuthenticationService.class)
.in(Singleton.class); {code}
This change reduces clutter in ZeppelinServer.java and promotes cleaner
separation of concerns.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)