This commit is contained in:
wangkang
2017-08-21 15:27:32 +08:00
parent 8d2d054d21
commit 1e080c2e4e
2 changed files with 18 additions and 18 deletions
@@ -2,11 +2,8 @@ package org.itkk.udf.auth.filter.client;
import lombok.extern.slf4j.Slf4j;
import org.itkk.udf.auth.Constant;
import org.itkk.udf.auth.IUserAuthenticationService;
import org.itkk.udf.auth.UserType;
import org.itkk.udf.auth.filter.AbstractBaseZuulFilter;
import org.itkk.udf.core.exception.SystemRuntimeException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
import org.springframework.stereotype.Component;
@@ -19,24 +16,9 @@ import org.springframework.stereotype.Component;
@ConditionalOnProperty(value = "org.itkk.auth.filter.client.identity.enabled", matchIfMissing = true)
public class ClientIdentityFilter extends AbstractBaseZuulFilter {
/**
* userAuthenticationService
*/
@Autowired(required = false)
private IUserAuthenticationService userAuthenticationService;
@Override
public Object run() {
log.info("ClientIdentityFilter.run");
//判空
if (userAuthenticationService == null) {
throw new SystemRuntimeException("You need to implement the IUserAuthenticationService interface");
}
//获得accessToken
String accessToken = this.getAccessToken();
//校验token
userAuthenticationService.verification(accessToken);
//返回
return null;
}
@@ -2,8 +2,11 @@ package org.itkk.udf.auth.filter.user;
import lombok.extern.slf4j.Slf4j;
import org.itkk.udf.auth.Constant;
import org.itkk.udf.auth.IUserAuthenticationService;
import org.itkk.udf.auth.UserType;
import org.itkk.udf.auth.filter.AbstractBaseZuulFilter;
import org.itkk.udf.core.exception.SystemRuntimeException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
import org.springframework.stereotype.Component;
@@ -16,9 +19,24 @@ import org.springframework.stereotype.Component;
@ConditionalOnProperty(value = "org.itkk.auth.filter.user.identity.enabled", matchIfMissing = true)
public class UserIdentityFilter extends AbstractBaseZuulFilter {
/**
* userAuthenticationService
*/
@Autowired(required = false)
private IUserAuthenticationService userAuthenticationService;
@Override
public Object run() {
log.info("UserIdentityFilter.run");
//判空
if (userAuthenticationService == null) {
throw new SystemRuntimeException("You need to implement the IUserAuthenticationService interface");
}
//获得accessToken
String accessToken = this.getAccessToken();
//校验token
userAuthenticationService.verification(accessToken);
//返回
return null;
}