ENTAXY-248 release 1.8.1
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.system.auth.basic</groupId>
|
||||
<artifactId>basic-auth</artifactId>
|
||||
<version>1.8.0</version>
|
||||
<version>1.8.1</version>
|
||||
</parent>
|
||||
|
||||
<groupId>ru.entaxy.esb.system.auth.basic.api</groupId>
|
||||
|
@ -31,6 +31,8 @@ public interface BasicAuthService {
|
||||
List<BasicAuthAccount> list();
|
||||
|
||||
Optional<BasicAuthAccount> get(String login);
|
||||
|
||||
Optional<BasicAuthAccount> getBySystem(String systemUuid);
|
||||
|
||||
Optional<BasicAuthAccount> getByAuthorizationHeaderHash(String authorizationHeaderHash);
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.system.auth.basic</groupId>
|
||||
<artifactId>basic-auth</artifactId>
|
||||
<version>1.8.0</version>
|
||||
<version>1.8.1</version>
|
||||
</parent>
|
||||
|
||||
<groupId>ru.entaxy.esb.system.auth.basic.impl</groupId>
|
||||
@ -35,6 +35,12 @@
|
||||
org.apache.commons.codec.binary,
|
||||
*
|
||||
</bundle.osgi.import.pkg>
|
||||
<!-- bundle.osgi.private.pkg>
|
||||
ru.entaxy.esb.system.auth.basic.interceptor,
|
||||
ru.entaxy.esb.system.auth.basic.jpa.impl,
|
||||
ru.entaxy.esb.system.auth.basic.jpa.listener,
|
||||
ru.entaxy.esb.system.auth.basic.jpa.util
|
||||
</bundle.osgi.private.pkg -->
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -75,7 +81,6 @@
|
||||
<dependency>
|
||||
<groupId>org.osgi</groupId>
|
||||
<artifactId>osgi.core</artifactId>
|
||||
<version>${osgi.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -105,6 +105,23 @@ public class BasicAuthServiceImpl implements BasicAuthService {
|
||||
return basicAuthAccount;
|
||||
}
|
||||
|
||||
public Optional<BasicAuthAccount> getBySystem(String systemUuid){
|
||||
Optional<BasicAuthAccount> basicAuthAccount;
|
||||
try (Session s = getSession()) {
|
||||
s.getTransaction().begin();
|
||||
|
||||
CriteriaBuilder builder = s.getCriteriaBuilder();
|
||||
CriteriaQuery<BasicAuthAccount> criteriaQuery = builder.createQuery(BasicAuthAccount.class);
|
||||
Root<BasicAuthAccount> root = criteriaQuery.from(BasicAuthAccount.class);
|
||||
criteriaQuery.where(builder.equal(root.get("systemUUID"), systemUuid));
|
||||
basicAuthAccount = s.createQuery(criteriaQuery).uniqueResultOptional();
|
||||
|
||||
s.getTransaction().commit();
|
||||
s.close();
|
||||
}
|
||||
return basicAuthAccount;
|
||||
};
|
||||
|
||||
public Optional<BasicAuthAccount> get(Session session, String login) {
|
||||
Optional<BasicAuthAccount> basicAuthAccount;
|
||||
CriteriaBuilder builder = session.getCriteriaBuilder();
|
||||
|
@ -29,7 +29,7 @@ import org.hibernate.event.spi.EventType;
|
||||
public class EntityEventListenerRegistry {
|
||||
|
||||
private static final Log LOG = LogFactory.getLog(EntityEventListenerRegistry.class);
|
||||
private static final int SESSION_WAIT_TIMEOUT = 5000;
|
||||
private static final int SESSION_WAIT_TIMEOUT = 50000;
|
||||
|
||||
private SessionFactory sessionFactory;
|
||||
private BasicAuthPostEventListener basicAuthPostEventListener;
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>basic-auth</artifactId>
|
||||
<groupId>ru.entaxy.esb.system.auth.basic</groupId>
|
||||
<version>1.8.0</version>
|
||||
<version>1.8.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -107,7 +107,7 @@
|
||||
<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},
|
||||
<to uri="bean:basicAuthService?method=saveCommon(${headers.NTX_AccountLogin}, ${headers.NTX_AccountPassword},
|
||||
${headers.NTX_AccountSystemUUID}, ${headers.X-ForwardedUser}, ${headers.X-ForwardedUser})"/>
|
||||
</split>
|
||||
<setBody>
|
||||
@ -138,7 +138,7 @@
|
||||
<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})"/>
|
||||
<to uri="bean:basicAuthService?method=remove(${headers.NTX_Login})"/>
|
||||
</split>
|
||||
<setBody>
|
||||
<constant><response xmlns="http://www.entaxy.ru/basic-auth-service/">true</response>
|
||||
@ -168,7 +168,7 @@
|
||||
<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})"/>
|
||||
<to uri="bean:basicAuthService?method=get(${exchangeProperty.NTX_Login})"/>
|
||||
|
||||
<choice>
|
||||
<when>
|
||||
@ -181,17 +181,17 @@
|
||||
<choice>
|
||||
<when>
|
||||
<simple>${headers.operationName} == 'addAccountPermission'</simple>
|
||||
<to uri="bean-fix:permissionService?method=addIfNotExist(${exchangeProperty.NTX_Action.id}, 'account', ${exchangeProperty.NTX_Subject},
|
||||
<to uri="bean: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},
|
||||
<to uri="bean: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},
|
||||
<to uri="bean: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},
|
||||
|
@ -62,16 +62,17 @@ htpasswd.file.directory=/mnt/share
|
||||
|
||||
* KARAF_HOST_NAMES=("http://192.168.122.93:9091" "http://192.168.122.94:9091") - караф сервера с запущеным сервисом htpasswd
|
||||
* HTPASSWD_STORAGE=/etc/nginx/htpasswd - адрес файла htpasswd, на который настроен nginX
|
||||
* LOGFILE="htpasswd-sync.log" - адрес лог файла
|
||||
|
||||
Добавить запуск скрипта через cron
|
||||
sudo crontab -e
|
||||
|
||||
```
|
||||
раз в минут
|
||||
*/5 * * * * <path_to_script>
|
||||
*/5 * * * * <path_to_script> >> <path_to_log_file> 2>&1
|
||||
|
||||
либо раз в минуту
|
||||
*/1 * * * * <path_to_script>
|
||||
*/1 * * * * <path_to_script> >> <path_to_log_file> 2>&1
|
||||
```
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.system.auth.basic</groupId>
|
||||
<artifactId>basic-auth</artifactId>
|
||||
<version>1.8.0</version>
|
||||
<version>1.8.1</version>
|
||||
</parent>
|
||||
|
||||
<groupId>ru.entaxy.esb.system.auth.basic.htpasswd</groupId>
|
||||
@ -20,6 +20,10 @@
|
||||
<bundle.osgi.export.pkg>
|
||||
ru.entaxy.esb.system.auth.basic.htpasswd,
|
||||
</bundle.osgi.export.pkg>
|
||||
<!-- bundle.osgi.private.pkg>
|
||||
ru.entaxy.esb.system.auth.basic.htpasswd.entity,
|
||||
ru.entaxy.esb.system.auth.basic.htpasswd.rest
|
||||
</bundle.osgi.private.pkg -->
|
||||
<bundle.osgi.import.pkg>
|
||||
ru.entaxy.esb.system.auth.basic.jpa.api,
|
||||
ru.entaxy.esb.system.auth.basic.jpa.api.entity,
|
||||
@ -46,7 +50,6 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-cxf</artifactId>
|
||||
<version>${camel.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel.karaf</groupId>
|
||||
|
@ -17,7 +17,7 @@
|
||||
# limitations under the License.
|
||||
# ~~~~~~/licensing~~~~~~
|
||||
###
|
||||
# !/bin/sh
|
||||
#!/bin/bash
|
||||
KARAF_HOST_NAMES=("http://192.168.122.93:9091" "http://192.168.122.94:9091")
|
||||
HTPASSWD_PATH=/htpasswd
|
||||
CHECKSUM_PATH=$HTPASSWD_PATH/checksum
|
||||
|
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.system.auth</groupId>
|
||||
<artifactId>system-auth</artifactId>
|
||||
<version>1.8.0</version>
|
||||
<version>1.8.1</version>
|
||||
</parent>
|
||||
|
||||
<groupId>ru.entaxy.esb.system.auth.basic</groupId>
|
||||
|
Reference in New Issue
Block a user