Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
pdf / 4-web-servlet3.pdf
Скачиваний:
43
Добавлен:
06.06.2015
Размер:
363.05 Кб
Скачать

Web Application Deployment

Создаются event listener (<listener>)

Вызываются contextInitialized (ServletContextListener)

Создаются фильтры и вызываются init методы

Создаются сервлеты с определенным элементам load-on-startup и вызываются init методы

Security

Declarative Security

Внешнее описание по отношению к приложению

Programmatic Security

HttpServletRequest

getRemoteUser

isUserInRole

getUserPrincipal

Authentication

HTTP Basic Authentication

HTTP Digest Authentication

HTTPS Client Authentication

Form Based Authentication

<form method=”POST” action=”j_security_check”>

<input type=”text” name=”j_username”> <input type=”password” name=”j_password”>

</form>

<security-constraint> <web-resource-collection>

<web-resource-name>Protected Pages</web-resource-name> <description>accessible by authorized users</description> <url-pattern>/protected/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method>

</web-resource-collection> <auth-constraint>

<description>These are the roles who have access</description> <role-name>user</role-name>

</auth-constraint> <user-data-constraint>

<description>This is how the user data must be transmitted</description> <transport-guarantee>CONFIDENTIAL</transport-guarantee>

</user-data-constraint> </security-constraint> <login-config>

<auth-method>FORM</auth-method> <form-login-config>

<form-login-page>/login.jsp</form-login-page> <form-error-page>/failLogin.jsp</form-error-page>

</form-login-config> </login-config> <security-role>

<description>Users</description> <role-name>user</role-name>

</security-role>

Web Container отслеживает authentication на своем уровне

Principal передаются в EJB

Сервлет может иметь элемент run-as

<servlet> <servlet-name>log4j</servlet-name> <servlet-class>SomeClass</servlet-class> <run-as>user</run-as>

</servlet>

Соседние файлы в папке pdf