[英]Where to place java handler for securing WSO2 API
您可以将其放在API下的handlers标记中,请检查教程示例代码。 该处理程序将应用于所有资源。
<api xmlns="http://ws.apache.org/ns/synapse"
name="TestGoogle"
context="/search">
<resource methods="GET">
<inSequence>
<log level="full">
<property name="STATUS" value="***** REQUEST HITS IN SEQUENCE *****"/>
</log>
<send>
<endpoint>
<http method="get" uri-template="https://www.google.lk/search?q=wso2"/>
</endpoint>
</send>
</inSequence>
</resource>
<handlers>
<handler class="org.wso2.handler.SimpleOAuthHandler"/>
</handlers>
</api>
您可以在API的结束标记之前添加处理程序,保存后,API可能不会显示该处理程序,但是如果您查看源视图,则可以看到分配给API的处理程序。 (主要->源代码视图)
您必须将包含处理程序的jar复制到[ESB_HOME]/repository/component/lib
并重新启动服务器。 该处理程序作为<api>
的子级添加到API配置中,如下所示:
<handlers>
<handler class="org.wso2.rest.BasicAuthHandler"/>
</handlers>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.