설정 :HTTP 상태 403가 계속
- 글래스 피쉬 3.1.1
- JSF 2.1
- jdbcRealm PostgreSQL을
에 유효한 사용자를 입력 한 후 로그인 양식에 대한 자격 증명 로그인되어 다음 페이지로 리디렉션됩니다. 하지만 해당 페이지를 나가서 허용 된 URL 패턴에있는 다른 페이지로 이동하면 "HTTP Status 403 - 요청한 리소스에 대한 액세스가 거부되었습니다."라는 메시지가 나타납니다. 그 후 나는 webapp의 어떤 사이트도 더 이상 방문 할 수 없다.
로그인은 glassfish의 server-config/security에서 Standard-Realm을 내 영역으로 설정 한 경우에만 작동합니다!
Warnung: Keine Principals zugeordnet zu Rolle [USER].
(Warning: No principals mapped to role [USER])
내가 크롬 디버거와 JSESSIONID를 제거하면, 내가 다시 로그인 할 수 있습니다
나는 배포시 서버 로그에 하나의 경고가. 허용 된 웹 사이트 또는 뭔가를 방문한 후 서버 측에서 세션이 파괴 된 것처럼 보입니까?!
몇 가지 관련 출처를 첨부했습니다. 나는
web.xml을
<login-config>
<auth-method>FORM</auth-method>
<realm-name>jdbcRealm</realm-name>
<form-login-config>
<form-login-page>/faces/login.xhtml</form-login-page>
<form-error-page>/faces/loginError.xhtml</form-error-page>
</form-login-config>
</login-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>User</web-resource-name>
<url-pattern>/faces/user/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>ADMIN</role-name>
</auth-constraint>
</security-constraint>
글래스 피쉬 - 웹 응용 프로그램 ...는 로그인 메커니즘이 작동하고 예외가 없기 때문에, 영역과 등 아무 상관이 없다 생각합니다. XML (수동으로 추가)
<glassfish-web-app>
<security-role-mapping>
<role-name>USER</role-name>
<group-name>USER</group-name>
</security-role-mapping>
</glassfish-web-app>
login.xhtml
,<h:form>
<h:outputLabel for="usernameInput">
Username:
</h:outputLabel>
<h:inputText id="usernameInput" value="#{authBackingBean.username}"
required="true" />
<br />
<h:outputLabel for="passwordInput">
Password:
</h:outputLabel>
<h:inputSecret id="passwordInput" value="#{authBackingBean.password}"
required="true" />
<br />
<h:commandButton value="Login"
action="#{authBackingBean.login}" />
AuthBackingBean P.S
@Stateless
@Named
public class AuthBackingBean {
private String username;
private String password;
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public String login() {
FacesContext context = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
try {
request.login(this.username, this.password);
} catch (ServletException e) {
context.addMessage(null, new FacesMessage("Login failed."));
return "loginError";
}
return "user/index";
}
public void logout() {
FacesContext context = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
try {
request.logout();
} catch (ServletException e) {
context.addMessage(null, new FacesMessage("Logout failed."));
}
}
}
: 그것은 많은 논리적 오류, 오타 및 복사/붙여 넣기 오류를 포함하고 있기 때문에 나는 오라클의 F 정말 실망이 *** 문서를 에드. 체계적이지 않고 읽기가 어렵고 과부하입니다. 표준 (
내가 "표준-교장 안녕히 Rollenzuordnung"을 활성화 :
모든 것이 완벽하게 작동했을 때 갑자기 403 오류가 발생했습니다. 누군가 "rolemapping에 대한 표준 원칙"이 무엇인지 생각하는 사람이 있습니까? 안전 해요? 글래스 피쉬는 내 경험으로 인해 끔찍한 것 같습니다. 너무 불안정하고 많은 질문이 ... – wired00