JWTCredentialsMatcher.java 580B

1234567891011121314
  1. package com.yunzhi.demo.shiro.matcher;
  2. import com.yunzhi.demo.shiro.utils.JWTUtil;
  3. import org.apache.shiro.authc.AuthenticationInfo;
  4. import org.apache.shiro.authc.AuthenticationToken;
  5. import org.apache.shiro.authc.credential.CredentialsMatcher;
  6. public class JWTCredentialsMatcher implements CredentialsMatcher {
  7. @Override
  8. public boolean doCredentialsMatch(AuthenticationToken authenticationToken, AuthenticationInfo authenticationInfo) {
  9. String token = authenticationToken.getCredentials().toString();
  10. return JWTUtil.verify(token);
  11. }
  12. }