2012-11-30 2 views
0

인증/권한 부여에 jdbcRealm을 사용하는 작은 웹 응용 프로그램이 있습니다. 권한 부여 내가이 글래스 피쉬 - 웹에서 주체를 제거하면glassfish-web.xml 파일에서 주체를 추가하는 것을 피하는 방법은 무엇입니까?

<glassfish-web-app error-url=""> 
    <class-loader delegate="true"/> 
    <jsp-config> 
     <property name="keepgenerated" value="true"> 
      <description>Keep a copy of the generated servlet class' java code.</description> 
     </property> 
    </jsp-config> 
    <security-role-mapping> 
     <role-name>connexion</role-name> 
     <principal-name>test</principal-name> 
     <group-name>connexion</group-name> 
    </security-role-mapping> 
</glassfish-web-app> 

<!--other stuff--> 
    <security-constraint> 
      <web-resource-collection> 
       <web-resource-name>secure</web-resource-name> 
       <url-pattern>/Downloader</url-pattern> 
       <url-pattern>/start.html</url-pattern> 
      </web-resource-collection> 
      <auth-constraint> 
       <role-name>connexion</role-name> 
      </auth-constraint> 
      <user-data-constraint> 
       <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
      </user-data-constraint> 
     </security-constraint> 
     <login-config> 
      <auth-method>FORM</auth-method> 
      <realm-name>my_realm</realm-name> 
      <form-login-config> 
       <form-login-page>/login.html</form-login-page> 
       <form-error-page>/error.html</form-error-page> 
      </form-login-config> 
     </login-config> 

     <security-role> 

      <role-name>connexion</role-name> 
     </security-role> 
<!--other stuff--> 

내가 403 오류가 web.xml의 글래스 피쉬-web.xml 파일에 사용자 이름을 넣어 경우에만 작동합니다 액세스를 거부 . xml 파일에 주체를 추가하는 것을 피하는 해결책이 있습니까? 감사합니다. .

답변

0

예, 있습니다. 보안 영역 (web.xml의 내용, 즉 my_realm)에서 로그인하려는 사용자 이름을 해당 그룹 (해당 경우, connexion)과 연결하십시오. 즉, 그룹 connexion에 속한 모든 사용자는 보호 된 리소스에 액세스 할 수 있으므로 사용자는 그룹의 목적을 설명 할 필요가 없습니다.

참조 & 추가 읽기 : Java EE 6 tutorial

관련 문제