Home  >  Q&A  >  body text

java - How does Shiro's Subject.login() know which table my user information is in?

shiro-jdbc-realm.ini

为情所困为情所困2678 days ago644

reply all(2)I'll reply

  • PHPz

    PHPz2017-05-27 17:42:56

    shirojdbcRealm中有这么些默认的query

       /**
         * The default query used to retrieve account data for the user.
         */
        protected static final String DEFAULT_AUTHENTICATION_QUERY = "select password from users where username = ?";
        
        /**
         * The default query used to retrieve account data for the user when {@link #saltStyle} is COLUMN.
         */
        protected static final String DEFAULT_SALTED_AUTHENTICATION_QUERY = "select password, password_salt from users where username = ?";
    
        /**
         * The default query used to retrieve the roles that apply to a user.
         */
        protected static final String DEFAULT_USER_ROLES_QUERY = "select role_name from user_roles where username = ?";
    
        /**
         * The default query used to retrieve permissions that apply to a particular role.
         */
        protected static final String DEFAULT_PERMISSIONS_QUERY = "select permission from roles_permissions where role_name = ?";

    Either the tables in your database are the above tables, or you specified them yourselfquery

    reply
    0
  • 阿神

    阿神2017-05-27 17:42:56

    Shiro does the username and password verification function in the realm you specify. You still have to write this verification yourself

    Look at this http://jinnianshilongnian.ite...

    reply
    0
  • Cancelreply