initial public commit

This commit is contained in:
2021-09-06 17:46:59 +03:00
commit b744b08829
824 changed files with 91593 additions and 0 deletions

View File

@ -0,0 +1,242 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~~~~~~licensing~~~~~~
basic-auth-soap
==========
Copyright (C) 2020 - 2021 EmDev LLC
==========
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
~~~~~~/licensing~~~~~~
-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xmlns:cxf="http://cxf.apache.org/blueprint/core"
xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf"
xmlns:bas="http://www.entaxy.ru/basic-auth-service/"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
">
<cm:property-placeholder persistent-id="ru.entaxy.esb.system.basic_auth" update-strategy="reload">
<cm:default-properties>
<cm:property name="basic_auth_endpoint.address" value="/basic-auth-management"/>
</cm:default-properties>
</cm:property-placeholder>
<reference id="basicAuthService"
interface="ru.entaxy.esb.system.auth.basic.jpa.api.BasicAuthService"
timeout="30000"/>
<reference id="permissionService"
interface="ru.entaxy.esb.system.core.permission.jpa.PermissionService"
timeout="30000"/>
<reference id="serviceInterceptor" interface="org.apache.cxf.phase.PhaseInterceptor"
filter="(type=service)"/>
<reference id="authInterceptor" interface="org.apache.cxf.phase.PhaseInterceptor"
filter="(type=authentication)"/>
<camelcxf:cxfEndpoint id="basic-auth-endpoint"
address="${basic_auth_endpoint.address}"
endpointName="bas:basic-auth-serviceSOAP"
serviceName="bas:basic-auth-service"
wsdlURL="wsdl/basic-auth-service.wsdl">
<camelcxf:properties>
<entry key="dataFormat" value="PAYLOAD"/>
<entry key="mtom-enabled" value="false"/>
</camelcxf:properties>
<camelcxf:inInterceptors>
<ref component-id="authInterceptor"/>
<ref component-id="serviceInterceptor"/>
</camelcxf:inInterceptors>
</camelcxf:cxfEndpoint>
<camelContext id="basic-auth-service-camel-context" xmlns="http://camel.apache.org/schema/blueprint">
<route id="basic-auth-endpoint" streamCache="true">
<from uri="cxf:bean:basic-auth-endpoint"/>
<log message="${body}" loggingLevel="INFO"/>
<choice>
<when>
<simple>${headers.operationName} in 'addAccount,updateAccount'</simple>
<to uri="direct:update-account"/>
</when>
<when>
<simple>${headers.operationName} == 'removeAccount'</simple>
<to uri="direct:remove-account"/>
</when>
<when>
<simple>${headers.operationName} in 'addAccountPermission,removeAccountPermission'</simple>
<to uri="direct:update-account-permission"/>
</when>
</choice>
</route>
<route id="updateAccount">
<from uri="direct:update-account"/>
<doTry>
<split>
<xpath>//bas:accountList/bas:account</xpath>
<log message="\r\n${body}\r\n" loggingLevel="DEBUG"/>
<setHeader name="NTX_AccountLogin">
<xpath resultType="String">//bas:account/bas:login</xpath>
</setHeader>
<setHeader name="NTX_AccountPassword">
<xpath resultType="String">//bas:account/bas:password</xpath>
</setHeader>
<setHeader name="NTX_AccountSystemUUID">
<xpath resultType="String">//bas:account/bas:systemUUID</xpath>
</setHeader>
<log message="\r\n${headers.NTX_AccountLogin}\r\n" loggingLevel="DEBUG"/>
<log message="\r\n${headers.NTX_AccountPassword}\r\n" loggingLevel="DEBUG"/>
<log message="\r\n${headers.NTX_AccountSystemUUID}\r\n" loggingLevel="DEBUG"/>
<to uri="bean-fix:basicAuthService?method=saveCommon(${headers.NTX_AccountLogin}, ${headers.NTX_AccountPassword},
${headers.NTX_AccountSystemUUID}, ${headers.X-ForwardedUser}, ${headers.X-ForwardedUser})"/>
</split>
<setBody>
<constant>&lt;response xmlns="http://www.entaxy.ru/basic-auth-service/"&gt;true&lt;/response&gt;
</constant>
</setBody>
<doCatch>
<exception>java.lang.Exception</exception>
<log message="${exception.message}" loggingLevel="ERROR"/>
<log message="${exception.stacktrace}" loggingLevel="DEBUG"/>
<setBody>
<constant>&lt;response xmlns="http://www.entaxy.ru/basic-auth-service/"&gt;false&lt;/response&gt;</constant>
</setBody>
</doCatch>
</doTry>
</route>
<route id="removeAccount">
<from uri="direct:remove-account"/>
<doTry>
<split>
<xpath>//bas:loginList/bas:login</xpath>
<log message="\r\n${body}\r\n" loggingLevel="DEBUG"/>
<setHeader name="NTX_Login">
<xpath resultType="String">//bas:login</xpath>
</setHeader>
<log message="\r\n${headers.NTX_Login}\r\n" loggingLevel="DEBUG"/>
<to uri="bean-fix:basicAuthService?method=remove(${headers.NTX_Login})"/>
</split>
<setBody>
<constant>&lt;response xmlns="http://www.entaxy.ru/basic-auth-service/"&gt;true&lt;/response&gt;
</constant>
</setBody>
<doCatch>
<exception>java.lang.Exception</exception>
<log message="${exception.message}" loggingLevel="ERROR"/>
<setBody>
<constant>&lt;response xmlns="http://www.entaxy.ru/basic-auth-service/"&gt;false&lt;/response&gt;</constant>
</setBody>
</doCatch>
</doTry>
</route>
<route id="addAccountPermission">
<from uri="direct:update-account-permission"/>
<doTry>
<split>
<xpath>//bas:permissionList/bas:permission</xpath>
<to uri="direct:permission-request"/>
<log message="${headers.operationName} for ${exchangeProperty.NTX_Login} by user ${headers.X-ForwardedUser}"/>
<log message="\r\n${exchangeProperty.NTX_Login}\r\n" loggingLevel="DEBUG"/>
<log message="\r\n${exchangeProperty.NTX_Subject}\r\n" loggingLevel="DEBUG"/>
<log message="\r\n${exchangeProperty.NTX_SubjectType}\r\n" loggingLevel="DEBUG"/>
<log message="\r\n${exchangeProperty.NTX_Action}\r\n" loggingLevel="DEBUG"/>
<to uri="bean-fix:basicAuthService?method=get(${exchangeProperty.NTX_Login})"/>
<choice>
<when>
<simple>${body.isPresent()}</simple>
<setProperty name="account">
<simple>${body.get()}</simple>
</setProperty>
<choice>
<when>
<simple>${headers.operationName} == 'addAccountPermission'</simple>
<to uri="bean-fix:permissionService?method=addIfNotExist(${exchangeProperty.NTX_Action.id}, 'account', ${exchangeProperty.NTX_Subject},
${exchangeProperty.NTX_SubjectType}, ${exchangeProperty.NTX_Action})"/>
</when>
<when>
<simple>${headers.operationName} == 'removeAccountPermission'</simple>
<to uri="bean-fix:permissionService?method=remove(${exchangeProperty.NTX_Action.id}, 'account', ${exchangeProperty.NTX_Subject},
${exchangeProperty.NTX_SubjectType}, ${exchangeProperty.NTX_Action})"/>
</when>
</choice>
<to uri="bean-fix:basicAuthService?method=saveFull(${exchangeProperty.NTX_Action.login}, ${exchangeProperty.NTX_Action.passwordHash},
${exchangeProperty.NTX_Action.encryptionAlgorithm.getAlgorithmName()},
${exchangeProperty.NTX_Action.getSystemUUID()}, ${exchangeProperty.NTX_Action.authorizationHeaderHash},
${exchangeProperty.NTX_Action.description}, ${exchangeProperty.NTX_Action.createdBy},
${headers.X-ForwardedUser})"/>
</when>
<otherwise>
<throwException exceptionType="java.lang.IllegalArgumentException"
message="Account with current login not found"/>
</otherwise>
</choice>
</split>
<setBody>
<constant>&lt;response xmlns="http://www.entaxy.ru/basic-auth-service/"&gt;true&lt;/response&gt;
</constant>
</setBody>
<doCatch>
<exception>java.lang.Exception</exception>
<log message="${exception.message}" loggingLevel="ERROR"/>
<log message="${exception.stacktrace}" loggingLevel="DEBUG"/>
<setBody>
<constant>&lt;response xmlns="http://www.entaxy.ru/basic-auth-service/"&gt;false&lt;/response&gt;</constant>
</setBody>
</doCatch>
</doTry>
</route>
<route id="permissionRequest">
<from uri="direct:permission-request"/>
<setProperty name="NTX_Login">
<xpath resultType="String">//bas:permission/bas:login</xpath>
</setProperty>
<setProperty name="NTX_Subject">
<xpath resultType="String">//bas:permission/bas:subject</xpath>
</setProperty>
<setProperty name="NTX_SubjectType">
<xpath resultType="String">//bas:permission/bas:subjectType</xpath>
</setProperty>
<setProperty name="NTX_Action">
<xpath resultType="String">//bas:permission/bas:action</xpath>
</setProperty>
</route>
</camelContext>
</blueprint>

View File

@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.entaxy.ru/basic-auth-service/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="basic-auth-service"
targetNamespace="http://www.entaxy.ru/basic-auth-service/">
<wsdl:types>
<xsd:schema targetNamespace="http://www.entaxy.ru/basic-auth-service/" elementFormDefault="qualified">
<xsd:element name="accountList" type="tns:accountListType"/>
<xsd:element name="response" type="xsd:boolean"/>
<xsd:complexType name="accountListType">
<xsd:sequence>
<xsd:element name="account" type="tns:accountType" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="accountType">
<xsd:sequence>
<xsd:element name="login" type="xsd:string"/>
<xsd:element name="password" type="xsd:string"/>
<xsd:element name="systemUUID" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="loginList" type="tns:loginListType"/>
<xsd:complexType name="loginListType">
<xsd:sequence>
<xsd:element name="login" type="xsd:string" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="permissionList" type="tns:permissionListType"/>
<xsd:complexType name="permissionListType">
<xsd:sequence>
<xsd:element name="permission" type="tns:permissionType" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="permissionType">
<xsd:sequence>
<xsd:element name="login" type="xsd:string"/>
<xsd:element name="subject" type="xsd:string"/>
<xsd:element name="subjectType" type="xsd:string"/>
<xsd:element name="action" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="addAccountRequest">
<wsdl:part name="request" element="tns:accountList"/>
</wsdl:message>
<wsdl:message name="addAccountResponse">
<wsdl:part name="response" element="tns:response"/>
</wsdl:message>
<wsdl:message name="updateAccountRequest">
<wsdl:part name="request" element="tns:accountList"/>
</wsdl:message>
<wsdl:message name="updateAccountResponse">
<wsdl:part name="response" element="tns:response"/>
</wsdl:message>
<wsdl:message name="removeAccountRequest">
<wsdl:part name="request" element="tns:loginList"/>
</wsdl:message>
<wsdl:message name="removeAccountResponse">
<wsdl:part name="response" element="tns:response"/>
</wsdl:message>
<wsdl:message name="addAccountPermissionRequest">
<wsdl:part name="request" element="tns:permissionList"/>
</wsdl:message>
<wsdl:message name="addAccountPermissionResponse">
<wsdl:part name="response" element="tns:response"/>
</wsdl:message>
<wsdl:message name="removeAccountPermissionRequest">
<wsdl:part name="request" element="tns:permissionList"/>
</wsdl:message>
<wsdl:message name="removeAccountPermissionResponse">
<wsdl:part name="response" element="tns:response"/>
</wsdl:message>
<wsdl:portType name="basic-auth-service">
<wsdl:operation name="addAccount">
<wsdl:input message="tns:addAccountRequest"/>
<wsdl:output message="tns:addAccountResponse"/>
</wsdl:operation>
<wsdl:operation name="updateAccount">
<wsdl:input message="tns:updateAccountRequest"/>
<wsdl:output message="tns:updateAccountResponse"/>
</wsdl:operation>
<wsdl:operation name="removeAccount">
<wsdl:input message="tns:removeAccountRequest"/>
<wsdl:output message="tns:removeAccountResponse"/>
</wsdl:operation>
<wsdl:operation name="addAccountPermission">
<wsdl:input message="tns:addAccountPermissionRequest"/>
<wsdl:output message="tns:addAccountPermissionResponse"/>
</wsdl:operation>
<wsdl:operation name="removeAccountPermission">
<wsdl:input message="tns:removeAccountPermissionRequest"/>
<wsdl:output message="tns:removeAccountPermissionResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="basic-auth-serviceSOAP" type="tns:basic-auth-service">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="addAccount">
<soap:operation soapAction="http://www.entaxy.ru/basic-auth-service/add-account"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="updateAccount">
<soap:operation soapAction="http://www.entaxy.ru/basic-auth-service/update-account"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="removeAccount">
<soap:operation soapAction="http://www.entaxy.ru/basic-auth-service/update-account"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="addAccountPermission">
<soap:operation soapAction="http://www.entaxy.ru/basic-auth-service/add-account-permission"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="removeAccountPermission">
<soap:operation soapAction="http://www.entaxy.ru/basic-auth-service/remove-account-permission"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="basic-auth-service">
<wsdl:port name="basic-auth-serviceSOAP" binding="tns:basic-auth-serviceSOAP">
<soap:address location="http://dev.esbHost.ru/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>