com.netgrif.application.engine.configuration.security.RestAuthenticationEntryPoint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of application-engine Show documentation
Show all versions of application-engine Show documentation
System provides workflow management functions including user, role and data management.
package com.netgrif.application.engine.configuration.security;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Component
public class RestAuthenticationEntryPoint extends BasicAuthenticationEntryPoint {
@Value("${nae.server.security.realm-name:NAE-Realm}")
private String realmName;
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException {
if (authException != null) {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.getWriter().println("HTTP Status 401 - " + authException.getMessage());
}
}
@Override
public void afterPropertiesSet() {
setRealmName(realmName);
super.afterPropertiesSet();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy