は$ CATALINA_HOME/confに/tomcatに-users.xmlのに以下を追加して、Tomcatを再起動します。あなたのGrailsプロジェクトのルートに
<role rolename="role1"/>
<user username="user1" password="password1" roles="role1"/>
を、grails install-templates
を実行します。これにより、src/templates/war/web.xmlがプロジェクトに追加されます。 (web-app
タグの子として)
(。。場合はファイルがIDEに表示されていない、これはバグかもしれませんし、ファイルシステムでそれを見つける。)
Add the followingにweb.xmlの:
<security-constraint>
<web-resource-collection>
<web-resource-name>
Entire Application
</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>role1</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Restricted Area</realm-name>
</login-config>
ありがとう、それは私が探していたものでした。私はセキュリティのレベルを認識しています - そして、これは人々が単にURLを覚えてテストするのを妨げることを確かめます... – fluxon