아파치 기본 인증 Karaf
-
12-12-2019 - |
문제
가 OSGi
번들은 배포 Apache Karaf 2.2.8
.이 번들로 나를 사용하여 CXF
고 Camel
니다.내가 쓰 CXF
interceptor 는 기본적인 인증모든한 기존 사용자가 데이터베이스에서는 유효성 검사를 수행합니다.
을 때 문제가 방법 handleMessage
가 호출되는 AuthorizationPolicy
체가 null 입니다.그것은 제공하지 않습니다.여기에는 나의 코드:
@Override
public void handleMessage(Message message)
throws Fault {
AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);
if (users == null) {
setLastAccessedTime(Calendar.getInstance());
}
if (!wasRecentlyAccessed()) {
users = this.loadUsers();
setLastAccessedTime(Calendar.getInstance());
}
for (String user : users.values()) {
LOGGER.debug("Existing user: " + user);
}
if (policy == null) {
LOGGER.error("User attempted to log in with no credentials");
sendErrorResponse(message, HttpURLConnection.HTTP_UNAUTHORIZED);
return;
}
String password = users.get(policy.getUserName());
if (password == null || !policy.getPassword().equals(password)) {
LOGGER.error("Invalid login authentication for user: " + policy.getUserName());
sendErrorResponse(message, HttpURLConnection.HTTP_FORBIDDEN);
}
}
어쨌든 내가 설정할 수 있습니다 기본적인 인증을 매개변수에 Karaf 에 대한 특정한 끝점?는 몇 가지 종류의 구성 파일 또는 뭔가?나는 찾을 수없는 아무거나 인터넷에서...
해결책
은 여기를 참조하십시오: https://access.redhat.com/documentation/en-US/Fuse_ESB_Enterprise/7.1/html/Security_Guide/files/CamelJetty-BasicAuth.html
설명 아주 분명하는 방법들에게 기본적인 인증과 함께 작업 Apache Karaf
고 Camel Jetty
.나중에 사용할 수 있습니다 그것은 모든 번들에 배포 Apache Karaf
.
제휴하지 않습니다 StackOverflow