title: Shiro Spring JDBCRealm Authentication and Authorization
body: <h3>Idea</h3>
  <p>I need to develop a web application using Spring MVC with Shiro as Security Framework.</p>
  <h3>Requirements</h3>
  <p>The usernames, passwords, roles etc to be stored in a database. Database Schema:</p>
  <pre><code>authorities[id, authorty_name] 
  role[id, role_name] 
  role_authorities_map[authority.id, role.id] 
  user[id, username, password] 
  user_rol_map[user.id, role_id]
  </code></pre>
  <p>The Password should be hashed and salted in the table.</p>
  <p>Shiro Filter in web application should be <code>DeligatingFilterProxy</code> to utilize Spring's configuration mechanisms</p>
  <p>All requests should be authenticated except /login, e.g.</p>
  <pre><code>/** = authc
  /login = anon
  /admin/** = authc, admin
  </code></pre>
  <p>If the authentication is successful, the framework should route to <code>/dashboard</code></p>
  <p>All URLs are processed by Spring Controller called <code>MainController</code></p>
  <h3>Problem</h3>
  <p>How do we solve above requirements? What configuration goes to what file?</p>
  <p>Please help.</p>