You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
602 B
20 lines
602 B
package cc.bnblogs.provider.config; |
|
|
|
import com.alibaba.csp.sentinel.adapter.servlet.callback.RequestOriginParser; |
|
import org.springframework.util.StringUtils; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
/** |
|
* 根据name进行授权 |
|
*/ |
|
public class RequestOriginParserDefinition implements RequestOriginParser { |
|
@Override |
|
public String parseOrigin(HttpServletRequest httpServletRequest) { |
|
String name = httpServletRequest.getParameter("name"); |
|
if (StringUtils.isEmpty(name)) { |
|
throw new RuntimeException("name is null"); |
|
} |
|
return name; |
|
} |
|
}
|
|
|