在application.properties配置下面两个key
sso.logo=logo
sso.secret.key=key
@Configuration
public class MPSsoInterceptor implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
InterceptorRegistration addInterceptor = registry.addInterceptor(new SSOInterceptor());
// 拦截的配置
addInterceptor.addPathPatterns("/**");
// 不拦截的配置
addInterceptor.excludePathPatterns("/login");
}
}
R<String> r = TokenLoginHelper.loginSuccess(1L, "admin", json.toJSONString());
r.getData(); 即为生成的jwt token将此token返回,之后每次请求是将此token放在请求头中key为Authorization