release version 1.11.0
This commit is contained in:
175
platform/runtime/security/jaas/jaas-management/LICENSE.txt
Normal file
175
platform/runtime/security/jaas/jaas-management/LICENSE.txt
Normal file
@ -0,0 +1,175 @@
|
||||
ЛИЦЕНЗИЯ ОГРАНИЧЕННОГО ПРИМЕНЕНИЯ
|
||||
|
||||
Настоящий документ устанавливает для Пользователя условия применения Базовой (некоммерческой)
|
||||
версии лицензии для пробного использования программного обеспечения ENTAXY, принадлежащего
|
||||
Правообладателю – Обществу с ограниченной ответственностью "ЕМДЕВ" (ОГРН 1057810026658, ИНН
|
||||
7813313860, юридический адрес: 197022, Россия, г. Санкт-Петербург, ул. Профессора Попова,
|
||||
д. 23, литера В, помещение 3Н), расположенной в сети Интернет по адресу
|
||||
https://www.emdev.ru/about (далее - Компания).
|
||||
|
||||
Используя или получая доступ к Программному обеспечению, или нажав «Я согласен с Условиями»
|
||||
(или аналогичную кнопку или флажок) после загрузки или установки Программного обеспечения,
|
||||
Пользователь выражает свое согласие на обязательность условий и ограничений, изложенных в
|
||||
настоящем документе, в противном случае, он должен не использовать или не получать доступ
|
||||
к Программному обеспечению.
|
||||
|
||||
1. ТЕРМИНЫ И ОПРЕДЕЛЕНИЯ
|
||||
|
||||
a) ПО – Программное обеспечение, интеграционная шина «ЭНТАКСИ» (ENTAXY) в любой ее версии
|
||||
или редакции, исключительные права на которую принадлежат Правообладателю.
|
||||
b) Правообладатель (Компания) – ООО «ЕМДЕВ», ОГРН 1057810026658, ИНН 7813313860, исключительные
|
||||
права которого подтверждаются Свидетельством о государственной регистрации в Реестре программ
|
||||
для ЭВМ № 2021610848 от 19.01.2021 года.
|
||||
c) Пользователь – юридическое или физическое лицо, получившее через скачивание с сайта
|
||||
https://entaxy.ru или иным образом, дистрибутив ПО, пользующееся ПО.
|
||||
d) ИС – интеллектуальная собственность – закреплённое законом исключительное право, а также
|
||||
личные неимущественные права авторов произведений на результат интеллектуальной деятельности.
|
||||
e) Подписка – это коммерческое предложение Правообладателя, состоящее из Лицензии на использование
|
||||
ПО и доступа к технической поддержке программного обеспечения на срок Подписки. Подписка
|
||||
включает предоставление Пользователю неисключительного права использования ПО, в том числе
|
||||
получение обновлений функционала ПО и безопасности ПО, исправление ошибок ПО и получение
|
||||
патчей с обновлениями и исправлениями программного обеспечения. Подписка приобретается
|
||||
Пользователем на период времени, указанный в Сертификате. Количество подписок устанавливается
|
||||
для каждого Пользователя индивидуально в Сертификате.
|
||||
f) Сертификат – документ, выдаваемый Дистрибъютором или Авторизованным партнёром (Партнёром),
|
||||
подтверждающий факт приобретения физическим или юридическим лицом Подписки на программное
|
||||
обеспечение в ограниченном объёме и на определённый период времени.
|
||||
g) Лицензия (простая (неисключительная) – совокупность ограниченных прав использования ПО,
|
||||
предоставленных Пользователю согласно условиям Подписки.
|
||||
h) Библиотека – совокупность подпрограмм и объектов, используемых для разработки программного
|
||||
обеспечения.
|
||||
i) Исходный код – текст компьютерной программы на каком-либо языке программирования, состоящий
|
||||
из одного или нескольких файлов, который может быть прочтён человеком.
|
||||
j) Объектный код – файл (часть машинного кода) с промежуточным представлением отдельного модуля
|
||||
программы, полученный в результате обработки исходного кода, еще не связанный в полную программу.
|
||||
Это машинный код для одной конкретной библиотеки или модуля, который будет составлять готовый
|
||||
продукт.
|
||||
k) Некоммерческое использование – индивидуальное личное использование Пользователем программного
|
||||
обеспечения с целью обучения работе с Программным обеспечением, для оценки или демонстрации
|
||||
возможностей Программного обеспечения, при котором, Пользователем не извлекается коммерческая
|
||||
выгода и/или не идёт в доход денежное вознаграждение при использовании Программного обеспечения.
|
||||
|
||||
2. ДОПУСТИМЫЕ СПОСОБЫ ИСПОЛЬЗОВАНИЯ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ
|
||||
|
||||
2.1. Правообладатель предоставляет Пользователю ограниченное право использования Программного
|
||||
обеспечения на условиях простой (неисключительной) лицензии в объёме, ограниченном правом
|
||||
воспроизведения полной рабочей версии программного обеспечения, новых версий программного обеспечения
|
||||
в памяти оборудования и его запуска на оборудовании в соответствии со ст. 1280 ГК РФ.
|
||||
2.2. Право на использование Программного обеспечения, предоставляемое Пользователю, носит
|
||||
неисключительный характер.
|
||||
2.3. Пользователю предоставляется всемирная, неисключительная, не подлежащая сублицензированию,
|
||||
лицензия на ограниченное использование Программного обеспечения.
|
||||
2.4. Пользователь, имеющий Базовую (некоммерческую) версию лицензии для пробного использования
|
||||
имеет право приобрести Подписку на программное обеспечение. В этом случае Пользователь обязан
|
||||
обратиться в службу поддержки Правообладателя по адресу: https://entaxy.ru/ для изменения
|
||||
вида лицензии с Базовой бесплатной версии на Подписки.
|
||||
2.5. Срок использования скачанной Пользователем базовой (некоммерческой) версии лицензии для
|
||||
пробного использования программного обеспечения – не ограничен.
|
||||
2.6. Использование Пользователем настоящего программного обеспечения в целях разработки,
|
||||
модификации, обновления другого ПО, принадлежащего третьим лицам, а не Правообладателю,
|
||||
без разрешения Правообладателя не допускается.
|
||||
|
||||
3. АВТОРСКОЕ ПРАВО.
|
||||
|
||||
3.1. Все авторские права, все права интеллектуальной собственности на Программное обеспечение
|
||||
и любые его копии принадлежат Правообладателю.
|
||||
3.2. Все авторские права, все права интеллектуальной собственности в отношении любого контента,
|
||||
к которому можно получить доступ с помощью Программного обеспечения, является собственностью
|
||||
соответствующего владельца контента и защищается применимым законодательством об авторском
|
||||
праве или другими законами и договорами об интеллектуальной собственности.
|
||||
3.3. Условия использования Программного обеспечения.
|
||||
Лицензия, предоставленная Пользователю, действительна только в том случае, если Пользователь
|
||||
придерживается следующих условий:
|
||||
3.3.1. Принятие уведомлений об авторских правах. Пользователю запрещается удалять или изменять
|
||||
какие-либо уведомления об авторских правах или лицензиях, которые появляются при использовании
|
||||
Программного обеспечения или на нем.
|
||||
3.3.2. Модификация. Пользователю запрещается модифицировать, изменять, декомпилировать,
|
||||
расшифровывать, дизассемблировать, переводить или реверсировать, перепроектировать
|
||||
Программное обеспечение.
|
||||
3.3.3. Распространение. Пользователю запрещается сублицензировать, передавать право использования
|
||||
ПО или иным образом распространять или предоставлять Программное обеспечение любой третьей стороне.
|
||||
3.3.4. SaaS. За исключением случаев, когда это разрешено Правообладателем, Пользователю запрещено
|
||||
использовать Программное обеспечение в коммерческих целях для оказания услуг третьим лицам.
|
||||
|
||||
4. ОТВЕТСТВЕННОСТЬ ПРАВООБЛАДАТЕЛЯ ПРИ НАРУШЕНИИ ПОЛЬЗОВАТЕЛЕМ ПРАВ «ИС»
|
||||
|
||||
4.1. Правообладатель не несет никаких обязательств в отношении каких-либо претензий к Пользователю
|
||||
на предмет нарушения последним прав Интеллектуальной собственности, возникших в связи с
|
||||
использованием Пользователем:
|
||||
4.1.1. Любых компонентов программного обеспечения с открытым исходным кодом, включенных в
|
||||
Программное обеспечение;
|
||||
4.1.2. Любого нарушения правил использования Программного обеспечения, установленного условиями
|
||||
настоящего соглашения;
|
||||
4.1.3. Любого использования Программного обеспечения в сочетании с другими ПО, оборудованием,
|
||||
или данными, не предоставленными Пользователю Правообладателем;
|
||||
4.1.4. Любого изменения Программного обеспечения любым третьим лицом, а не Правообладателем.
|
||||
|
||||
|
||||
5. НАСТОЯЩИМ ПРАВООБЛАДАТЕЛЬ ЗАЯВЛЯЕТ, ЧТО ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ ПОЛЬЗОВАТЕЛЮ
|
||||
ПО ПРИНЦИПУ «AS IS» - «КАК ЕСТЬ». НИ ПРИ КАКИХ ОБСТОЯТЕЛЬСТВАХ ПРАВООБЛАДАТЕЛЬ НЕ ГАРАНТИРУЕТ
|
||||
И НЕ ОБЕЩАЕТ, ЧТО ПРЕДОСТАВЛЕННОЕ ИМ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ БУДЕТ ПОДХОДИТЬ ИЛИ НЕ ПОДХОДИТЬ
|
||||
ДЛЯ КОНКРЕТНЫХ ЦЕЛЕЙ ПОЛЬЗОВАТЕЛЯ, ЧТО ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ БУДЕТ ОТВЕЧАТЬ ВСЕМ КОММЕРЧЕСКИМ
|
||||
И ЛИЧНЫМ СУБЪЕКТИВНЫМ ОЖИДАНИЯМ ПОЛЬЗОВАТЕЛЯ, ЧТО ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ БУДЕТ РАБОТАТЬ
|
||||
ИСПРАВНО, БЕЗ ТЕХНИЧЕСКИХ ОШИБОК, БЫСТРО И БЕСПЕРЕБОЙНО.
|
||||
|
||||
6. ОГРАНИЧЕНИЕ ОТВЕТСТВЕННОСТИ.
|
||||
НИ ПРИ КАКИХ ОБСТОЯТЕЛЬСТВАХ ПРАВООБЛАДАТЕЛЬ ИЛИ ЕГО АФФИЛЛИРОВАННЫЕ ЛИЦА НЕ НЕСУТ ПЕРЕД ПОЛЬЗОВАТЕЛЕМ
|
||||
ОТВЕТСТВЕННОСТИ ЗА ЛЮБЫЕ ПРЯМЫЕ ИЛИ КОСВЕННЫЕ УБЫТКИ ПОЛЬЗОВАТЕЛЯ, ЕГО РАСХОДЫ ИЛИ РЕАЛЬНЫЙ УЩЕРБ,
|
||||
ВКЛЮЧАЯ, ПОМИМО ПРОЧЕГО, ПРОСТОИ; УТРАТУ БИЗНЕСА; УПУЩЕННУЮ ВЫГОДУ; НЕДОПОЛУЧЕННУЮ ПРИБЫЛЬ;
|
||||
ПОТЕРЮ ИЛИ ПОВРЕЖДЕНИЕ ДАННЫХ, ИМУЩЕСТВА И ИНОЕ.
|
||||
ОГРАНИЧЕНИЯ ПРИМЕНЯЮТСЯ НЕЗАВИСИМО ОТ ОСНОВАНИЯ НАСТУПЛЕНИЯ ОТВЕТСТВЕННОСТИ; В ТОМ ЧИСЛЕ ВСЛЕДСТВИЕ
|
||||
ДЕЙСТВИЯ ИЛИ БЕЗДЕЙСТВИЯ, НЕБРЕЖНОСТИ, УМЫСЛА, ПРЯМОГО ИЛИ КОСВЕННОГО; НЕОСТОРОЖНОСТИ; ЗАБЛУЖДЕНИЯ;
|
||||
КЛЕВЕТЫ; НАРУШЕНИЯ КОНФИДЕНЦИАЛЬНОСТИ ИЛИ ПРАВА ИНТЕЛЛЕКТУАЛЬНОЙ СОБСТВЕННОСТИ; ИЛИ ЛЮБОЕ ДРУГОЕ
|
||||
ОСНОВАНИЕ НАСТУПЛЕНИЯ ОТВЕТСТВЕННОСТИ.
|
||||
|
||||
7. ОБЯЗАННОСТЬ ПОЛЬЗОВАТЕЛЯ:
|
||||
Не осуществлять самостоятельно и (или) с привлечением третьих лиц нижеследующие действия
|
||||
(включая, но не ограничиваясь) по:
|
||||
-дизассемблированию и (или) декомпилированию (преобразованию объектного кода в исходный код)
|
||||
Программного обеспечения;
|
||||
-модификации Программного обеспечения, в том числе вносить изменения в объектный код, исходный
|
||||
код Программного обеспечения, за исключением тех изменений, которые вносятся средствами,
|
||||
включёнными в Программное обеспечение и описанными непосредственно в документации к нему;
|
||||
-созданию условий для использования Программного обеспечения лицами, не имеющими прав на
|
||||
использование данного Программного обеспечения, включая (но не ограничиваясь) вмешательство
|
||||
третьих лиц в функционирование Программного обеспечения, предоставление третьим лицам доступа
|
||||
к исследованию и (или) замене настроек Программного обеспечения, включая его первичную установку;
|
||||
-распространению Программного обеспечения в целом или в части (включая приложенную к нему документацию).
|
||||
|
||||
8. БИБЛИОТЕКА ПО. ИСПОЛЬЗУЕМЫЕ ПРОГРАММНЫЕ СРЕДСТВА.
|
||||
|
||||
8.1. Настоящим, Правообладатель заверяет, что Библиотека программного обеспечения состоит из
|
||||
лицензионных продуктов, используемых на законных основаниях, а
|
||||
именно https://entaxy.ru/libs/licenses/root-aggregated.deps.
|
||||
8.2. Любые программные средства, применяемые Пользователем при работе с ПО, должны быть
|
||||
совместимы с библиотекой ПО, указанной в п.8.1. настоящего соглашения.
|
||||
8.3. Перечень внешних модулей ПО, указанный в п.8.1 настоящего соглашения, может изменяться
|
||||
Правообладателем в одностороннем порядке, в зависимости от выпуска релизов программного обеспечения,
|
||||
содержащих все изменения и дополнения программного обеспечения.
|
||||
|
||||
9. ВНЕСЕНИЕ ИЗМЕНЕНИЙ В ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ.
|
||||
|
||||
9.1. Программное обеспечение, интеграционная шина «ЭНТАКСИ» (ENTAXY) является свободно распространяемым
|
||||
программным обеспечением.
|
||||
9.2. Пользователь имеет право вносить изменения в исходный код программного обеспечения исключительно
|
||||
с согласия Правообладателя в порядке предложения изменений/правок/дополнений через механизм
|
||||
«Pull Requests» в открытом репозитории Правообладателя по адресу: https://git.entaxy.ru/entaxy/entaxy-public.
|
||||
9.3. Любые изменения программного обеспечения, осуществляемые Пользователем без соблюдения условий
|
||||
пункта 9.2. настоящего документа, являются нарушением авторских и смежных прав Правообладателя,
|
||||
прав интеллектуальной собственности Правообладателя и влекут применение к Пользователю мер
|
||||
ответственности в соответствии с условиями настоящей Лицензии, а также применимого законодательства
|
||||
Российской Федерации.
|
||||
|
||||
10. ЗАКЛЮЧИТЕЛЬНЫЕ ПОЛОЖЕНИЯ.
|
||||
|
||||
10.1. В случае нарушения Пользователем любого из условий настоящей Лицензии, Правообладатель имеет
|
||||
право взыскать с Пользователя любые причинённые таким нарушением убытки, реальный ущерб,
|
||||
недополученную прибыль, упущенную выгоду, а также в случае нарушения Пользователем условий
|
||||
пункта 9.2 настоящего соглашения, в том числе, взыскать с Пользователя штраф в размере
|
||||
2 000 000 (Два миллиона) рублей за каждый установленный случай несанкционированного изменения
|
||||
исходного или объектного кода Программного обеспечения «Энтакси» (Entaxy).
|
||||
10.2. В рамках исполнения Пользователем обязательств по настоящей Лицензии, применимое
|
||||
законодательство – Российской Федерации.
|
||||
10.3. Если какое-либо положение настоящей Лицензии будет признано судом недействительным,
|
||||
остальные положения будут продолжать своё действие, а Пользователь будет обязан продолжать
|
||||
исполнять свои обязанности в соответствии с этими положениями.
|
59
platform/runtime/security/jaas/jaas-management/pom.xml
Normal file
59
platform/runtime/security/jaas/jaas-management/pom.xml
Normal file
@ -0,0 +1,59 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>ru.entaxy.platform.security</groupId>
|
||||
<artifactId>jaas</artifactId>
|
||||
<version>1.11.0</version>
|
||||
</parent>
|
||||
<groupId>ru.entaxy.platform.security.jaas</groupId>
|
||||
<artifactId>jaas-management</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
|
||||
<properties>
|
||||
<bundle.osgi.export.pkg>ru.entaxy.platform.core.management.jaas</bundle.osgi.export.pkg>
|
||||
<bundle.osgi.private.pkg>ru.entaxy.platform.core.management.jaas.impl</bundle.osgi.private.pkg>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core.management</groupId>
|
||||
<artifactId>object-management</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.platform.security.jaas</groupId>
|
||||
<artifactId>jaas-runtime</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.osgi</groupId>
|
||||
<artifactId>org.osgi.service.component.annotations</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>org.apache.felix.scr</artifactId>
|
||||
<version>2.1.20</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>
|
||||
ru.entaxy.esb.platform.runtime.base
|
||||
</groupId>
|
||||
<artifactId>base-support</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base</groupId>
|
||||
<artifactId>management-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.karaf.jaas</groupId>
|
||||
<artifactId>org.apache.karaf.jaas.modules</artifactId>
|
||||
<version>${karaf.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,39 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* jaas-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.core.management.jaas;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Attribute;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface JaasLoginModuleMBean extends EntaxyRuntimeObjectMBean {
|
||||
|
||||
@Attribute
|
||||
boolean isBackingEngineDriven();
|
||||
|
||||
}
|
@ -0,0 +1,193 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* jaas-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.core.management.jaas;
|
||||
|
||||
import org.apache.karaf.jaas.boot.principal.GroupPrincipal;
|
||||
import org.apache.karaf.jaas.boot.principal.UserPrincipal;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.*;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface JaasLoginModuleWithBackingEngineMBean extends JaasLoginModuleMBean {
|
||||
|
||||
/**
|
||||
* Create a new user.
|
||||
*
|
||||
* @param username the user name.
|
||||
* @param password the user password.
|
||||
*/
|
||||
@Operation(desc = "Create a new user")
|
||||
void addUser(
|
||||
@Parameter(name = "username", desc = "Username") String username,
|
||||
@Parameter(name = "password", desc = "Password") String password);
|
||||
|
||||
/**
|
||||
* Delete user.
|
||||
*
|
||||
* @param username the user name.
|
||||
*/
|
||||
@Operation(desc = "Delete user")
|
||||
void deleteUser(@Parameter(name = "username", desc = "Username") String username);
|
||||
|
||||
/**
|
||||
* List all users.
|
||||
*
|
||||
* @return the list of users.
|
||||
*/
|
||||
@Operation(desc = "List all users")
|
||||
String listUsers();
|
||||
|
||||
/**
|
||||
* List groups that a user is member of.
|
||||
*
|
||||
* @param username the user name.
|
||||
* @return the list of groups.
|
||||
*/
|
||||
@Operation(desc = "List groups that a user is member of")
|
||||
String listGroupsForUser(@Parameter(name = "username", desc = "Username") String username);
|
||||
|
||||
/**
|
||||
* List all groups.
|
||||
*
|
||||
* @return the groups.
|
||||
*/
|
||||
@Operation(desc = "List all groups")
|
||||
String listGroups();
|
||||
|
||||
/**
|
||||
* Add a user into a given group.
|
||||
*
|
||||
* @param username the user name.
|
||||
* @param group the group.
|
||||
*/
|
||||
@Operation(desc = "Add a user into a given group")
|
||||
void addGroup(
|
||||
@Parameter(name = "username", desc = "Username") String username,
|
||||
@Parameter(name = "group", desc = "Group") String group);
|
||||
|
||||
/**
|
||||
* Create a group
|
||||
*
|
||||
* @param group the group.
|
||||
*/
|
||||
@Operation(desc = "Create a group")
|
||||
void createGroup(@Parameter(name = "group", desc = "Group") String group);
|
||||
|
||||
/**
|
||||
* Remove a group from a user.
|
||||
*
|
||||
* @param username the user name.
|
||||
* @param group the group.
|
||||
*/
|
||||
@Operation(desc = "Remove a group from a user")
|
||||
void deleteGroup(
|
||||
@Parameter(name = "username", desc = "Username") String username,
|
||||
@Parameter(name = "group", desc = "Group") String group);
|
||||
|
||||
/**
|
||||
* Get profile associated with {@link UserPrincipal}.
|
||||
*
|
||||
* @param username the user name.
|
||||
* @return the associated profile name.
|
||||
*/
|
||||
@Operation(desc = "Get profile associated with user")
|
||||
String getAssociatedProfile(@Parameter(name = "username", desc = "Username") String username);
|
||||
|
||||
/**
|
||||
* Associate profile with {@link UserPrincipal}.
|
||||
*
|
||||
* @param username the user name.
|
||||
* @param profileName the name of the profile.
|
||||
*/
|
||||
@Operation(desc = "Associate profile with a user")
|
||||
void associateProfile(
|
||||
@Parameter(name = "username", desc = "Username") String username,
|
||||
@Parameter(name = "profileName", desc = "Profile Name") String profileName);
|
||||
|
||||
/**
|
||||
* List roles for a {@link UserPrincipal}.
|
||||
*
|
||||
* @param username the user name.
|
||||
* @return the list of roles.
|
||||
*/
|
||||
@Operation(desc = "List roles for a user")
|
||||
String listRolesForUser(@Parameter(name = "username", desc = "Username") String username);
|
||||
|
||||
/**
|
||||
* List roles for a {@link GroupPrincipal}.
|
||||
*
|
||||
* @param groupName the name of the group.
|
||||
* @return the list of roles.
|
||||
*/
|
||||
@Operation(desc = "List roles for a group")
|
||||
String listRolesForGroup(@Parameter(name = "groupName", desc = "Group Name") String groupName);
|
||||
|
||||
/**
|
||||
* Add a role to the user.
|
||||
*
|
||||
* @param username the user name.
|
||||
* @param role the role.
|
||||
*/
|
||||
@Operation(desc = "Add a role to the user")
|
||||
void addRole(
|
||||
@Parameter(name = "username", desc = "Username") String username,
|
||||
@Parameter(name = "role", desc = "Role") String role);
|
||||
|
||||
/**
|
||||
* Remove a role from a user.
|
||||
*
|
||||
* @param username the user name.
|
||||
* @param role the role.
|
||||
*/
|
||||
@Operation(desc = "Remove a role from a user")
|
||||
void deleteRole(
|
||||
@Parameter(name = "username", desc = "Username") String username,
|
||||
@Parameter(name = "role", desc = "Role") String role);
|
||||
|
||||
/**
|
||||
* Add a role in a group.
|
||||
*
|
||||
* @param group the group.
|
||||
* @param role the role.
|
||||
*/
|
||||
@Operation(desc = "Add a role in a group")
|
||||
void addGroupRole(
|
||||
@Parameter(name = "group", desc = "Group") String group,
|
||||
@Parameter(name = "role", desc = "Role") String role);
|
||||
|
||||
/**
|
||||
* Remove a role from a group.
|
||||
*
|
||||
* @param group the group.
|
||||
* @param role the role.
|
||||
*/
|
||||
@Operation(desc = "Remove a role from a group")
|
||||
void deleteGroupRole(
|
||||
@Parameter(name = "group", desc = "Group") String group,
|
||||
@Parameter(name = "role", desc = "Role") String role);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* jaas-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.core.management.jaas;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.ManagementCore;
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Operation;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Parameter;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectContainerMBean;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface JaasMBean extends EntaxyRuntimeObjectContainerMBean {
|
||||
|
||||
Qualifier QUALIFIER = ManagementCore.Q_RUNTIME.qualifier("section", "security")
|
||||
.attribute("security", "jaas");
|
||||
|
||||
String SUBQUALIFIER = QUALIFIER.getValue().substring(ManagementCore.Q_RUNTIME.getValue().length() + 1);
|
||||
|
||||
String TYPE_REALM = "entaxy.security.jaas.realm";
|
||||
String TYPE_LOGINMODULE = "entaxy.security.jaas.loginmodule";
|
||||
|
||||
@Operation(desc = "Start realm")
|
||||
void startJaasRealm(
|
||||
@Parameter(name = "idOrName", desc = "Id or name of the realm") String idOrName) throws Exception;
|
||||
|
||||
@Operation(desc = "Stop realm")
|
||||
void stopJaasRealm(
|
||||
@Parameter(name = "idOrName", desc = "Id or name of the realm") String idOrName) throws Exception;
|
||||
|
||||
@Operation(desc = "Uninstall realm")
|
||||
void uninstallJaasRealm(
|
||||
@Parameter(name = "idOrName", desc = "Id or name of the realm") String idOrName) throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* jaas-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.core.management.jaas;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Attribute;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface JaasRealmMBean extends EntaxyRuntimeObjectMBean {
|
||||
|
||||
@Attribute
|
||||
default String getName() {
|
||||
return getObjectId();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* jaas-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.core.management.jaas.impl;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.EntaxyRuntimeTyped;
|
||||
import ru.entaxy.platform.core.management.jaas.JaasLoginModuleMBean;
|
||||
import ru.entaxy.platform.core.management.jaas.JaasMBean;
|
||||
import ru.entaxy.platform.core.management.object.ObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractObjectMBean;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
@EntaxyRuntimeTyped(name = JaasMBean.TYPE_LOGINMODULE)
|
||||
@ObjectMBean(subQualifierName = "module")
|
||||
public class JaasLoginModuleMBeanImpl extends AbstractObjectMBean<JaasLoginModuleMBean>
|
||||
implements JaasLoginModuleMBean {
|
||||
|
||||
protected JaasLoginModuleMBeanImpl(EntaxyRuntimeObject entaxyRuntimeObject)
|
||||
throws NotCompliantMBeanException {
|
||||
super(JaasLoginModuleMBean.class, entaxyRuntimeObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBackingEngineDriven() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,247 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* jaas-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.core.management.jaas.impl;
|
||||
|
||||
import java.security.Principal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
import javax.security.auth.login.AppConfigurationEntry;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.karaf.jaas.boot.principal.GroupPrincipal;
|
||||
import org.apache.karaf.jaas.boot.principal.RolePrincipal;
|
||||
import org.apache.karaf.jaas.modules.BackingEngine;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.EntaxyRuntimeTyped;
|
||||
import ru.entaxy.platform.core.management.jaas.JaasLoginModuleWithBackingEngineMBean;
|
||||
import ru.entaxy.platform.core.management.jaas.JaasMBean;
|
||||
import ru.entaxy.platform.core.management.object.ObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractObjectMBean;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeRelation;
|
||||
import ru.entaxy.platform.runtime.security.jaas.JaasHelper;
|
||||
|
||||
@EntaxyRuntimeTyped(name = JaasMBean.TYPE_LOGINMODULE)
|
||||
@ObjectMBean(subQualifierName = "module")
|
||||
public class JaasLoginModuleWithBackingEngineMBeanImpl
|
||||
extends AbstractObjectMBean<JaasLoginModuleWithBackingEngineMBean>
|
||||
implements JaasLoginModuleWithBackingEngineMBean {
|
||||
|
||||
protected AppConfigurationEntry entry = null;
|
||||
protected BackingEngine engine = null;
|
||||
|
||||
private final String SYSTEM_ROLE_PREFIX = "PROFILE_";
|
||||
|
||||
protected JaasLoginModuleWithBackingEngineMBeanImpl(EntaxyRuntimeObject entaxyRuntimeObject)
|
||||
throws NotCompliantMBeanException {
|
||||
super(JaasLoginModuleWithBackingEngineMBean.class, entaxyRuntimeObject);
|
||||
|
||||
}
|
||||
|
||||
protected boolean init() {
|
||||
if (engine == null) {
|
||||
List<EntaxyRuntimeRelation> relations = entaxyRuntimeObject.getIncomiingSubordRelations();
|
||||
if (relations == null)
|
||||
return false;
|
||||
relations = relations.stream().filter(rel -> !rel.getMain().isGhost())
|
||||
.filter(rel -> JaasMBean.TYPE_REALM.equals(rel.getMain().getType())).collect(Collectors.toList());
|
||||
if (relations.isEmpty())
|
||||
return false;
|
||||
String realmName = relations.get(0).getMain().getId();
|
||||
try {
|
||||
engine = JaasHelper.getInstance().getBackingEngine(realmName, entaxyRuntimeObject.getId());
|
||||
} catch (Exception ignore) {
|
||||
|
||||
}
|
||||
}
|
||||
return engine != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBackingEngineDriven() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addUser(String username, String password) {
|
||||
if (!init())
|
||||
throw new UnsupportedOperationException("Backing engine not bound");
|
||||
engine.addUser(username, password);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUser(String username) {
|
||||
if (!init())
|
||||
throw new UnsupportedOperationException("Backing engine not bound");
|
||||
engine.deleteUser(username);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String listUsers() {
|
||||
if (!init())
|
||||
throw new UnsupportedOperationException("Backing engine not bound");
|
||||
|
||||
return engine.listUsers().stream().map(user -> {
|
||||
return getJsonObjectFromPrincipal(user);
|
||||
}).collect(Collectors.toList()).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String listGroupsForUser(String username) {
|
||||
if (!init())
|
||||
throw new UnsupportedOperationException("Backing engine not bound");
|
||||
|
||||
return engine.listGroups(engine.lookupUser(username)).stream().map(groupPrincipal -> {
|
||||
return getJsonObjectFromPrincipal(groupPrincipal);
|
||||
}).collect(Collectors.toList()).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String listGroups() {
|
||||
if (!init())
|
||||
throw new UnsupportedOperationException("Backing engine not bound");
|
||||
|
||||
List<JsonObject> groups = new ArrayList<>();
|
||||
engine.listGroups().forEach((groupPrincipal, roles) -> {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("name", groupPrincipal.getName());
|
||||
jsonObject.addProperty("roles", roles);
|
||||
groups.add(jsonObject);
|
||||
});
|
||||
return groups.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGroup(String username, String group) {
|
||||
if (!init())
|
||||
throw new UnsupportedOperationException("Backing engine not bound");
|
||||
engine.addGroup(username, group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createGroup(String group) {
|
||||
if (!init())
|
||||
throw new UnsupportedOperationException("Backing engine not bound");
|
||||
engine.createGroup(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteGroup(String username, String group) {
|
||||
if (!init())
|
||||
throw new UnsupportedOperationException("Backing engine not bound");
|
||||
engine.deleteGroup(username, group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAssociatedProfile(String username) {
|
||||
if (!init())
|
||||
throw new UnsupportedOperationException("Backing engine not bound");
|
||||
|
||||
RolePrincipal role = engine.listRoles(engine.lookupUser(username)).stream().filter(rolePrincipal -> {
|
||||
return rolePrincipal.getName().startsWith(SYSTEM_ROLE_PREFIX);
|
||||
}).findAny().orElse(null);
|
||||
|
||||
return role != null ? role.getName().substring(SYSTEM_ROLE_PREFIX.length(), role.getName().length()) : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void associateProfile(String username, String profileName) {
|
||||
if (!init())
|
||||
throw new UnsupportedOperationException("Backing engine not bound");
|
||||
|
||||
RolePrincipal role = engine.listRoles(engine.lookupUser(username)).stream().filter(rolePrincipal -> {
|
||||
return rolePrincipal.getName().startsWith(SYSTEM_ROLE_PREFIX);
|
||||
}).findAny().orElse(null);
|
||||
|
||||
if (role != null) {
|
||||
engine.deleteRole(username, role.getName());
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(profileName)) {
|
||||
engine.addRole(username, SYSTEM_ROLE_PREFIX.concat(profileName));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String listRolesForUser(String username) {
|
||||
if (!init())
|
||||
throw new UnsupportedOperationException("Backing engine not bound");
|
||||
|
||||
return engine.listRoles(engine.lookupUser(username)).stream().filter(role -> {
|
||||
return !role.getName().startsWith(SYSTEM_ROLE_PREFIX);
|
||||
}).map(role -> {
|
||||
return getJsonObjectFromPrincipal(role);
|
||||
}).collect(Collectors.toList()).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String listRolesForGroup(String groupName) {
|
||||
if (!init())
|
||||
throw new UnsupportedOperationException("Backing engine not bound");
|
||||
|
||||
return engine.listRoles(new GroupPrincipal(groupName)).stream().map(role -> {
|
||||
return getJsonObjectFromPrincipal(role);
|
||||
}).collect(Collectors.toList()).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRole(String username, String role) {
|
||||
if (!init())
|
||||
throw new UnsupportedOperationException("Backing engine not bound");
|
||||
engine.addRole(username, role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRole(String username, String role) {
|
||||
if (!init())
|
||||
throw new UnsupportedOperationException("Backing engine not bound");
|
||||
engine.deleteRole(username, role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGroupRole(String group, String role) {
|
||||
if (!init())
|
||||
throw new UnsupportedOperationException("Backing engine not bound");
|
||||
engine.addGroupRole(group, role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteGroupRole(String group, String role) {
|
||||
if (!init())
|
||||
throw new UnsupportedOperationException("Backing engine not bound");
|
||||
engine.deleteGroupRole(group, role);
|
||||
}
|
||||
|
||||
private JsonObject getJsonObjectFromPrincipal(Principal principal) {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("name", principal.getName());
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* jaas-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.core.management.jaas.impl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.platform.core.management.jaas.JaasMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeItemMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.MBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractMBeanFactory;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
@MBeanFactory(id = "jaas-factory", supportedTypes = {"entaxy.security.jaas.*"})
|
||||
@Component(service = EntaxyRuntimeObjectMBeanFactory.class, immediate = true)
|
||||
public class JaasMBeanFactory extends AbstractMBeanFactory {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(JaasMBeanFactory.class);
|
||||
|
||||
private static final String ATTR_BACKEND_ENABLED = "backendEnabled";
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile protected JaasMbeanImpl jaasMBean;
|
||||
|
||||
public void activate(ComponentContext componentContext) {
|
||||
// try {
|
||||
// this.jaasMBean = new JaasMbeanImpl();
|
||||
// } catch (NotCompliantMBeanException e) {
|
||||
// log.error("Error creating JaasMbeanImpl", e);;
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends EntaxyRuntimeObjectMBean> T createMBean(EntaxyRuntimeObject entaxyRuntimeObject) {
|
||||
try {
|
||||
if (JaasMBean.TYPE_REALM.equals(entaxyRuntimeObject.getType())) {
|
||||
JaasRealmMBeanImpl mBean = new JaasRealmMBeanImpl(entaxyRuntimeObject);
|
||||
return (T) mBean;
|
||||
}
|
||||
if (JaasMBean.TYPE_LOGINMODULE.equals(entaxyRuntimeObject.getType())) {
|
||||
|
||||
boolean withBackend = false;
|
||||
|
||||
if (entaxyRuntimeObject.hasAttribute(ATTR_BACKEND_ENABLED)) {
|
||||
Object value = entaxyRuntimeObject.getAttribute(ATTR_BACKEND_ENABLED);
|
||||
if (value != null) {
|
||||
try {
|
||||
withBackend = Boolean.parseBoolean(value.toString());
|
||||
} catch (Exception ignore) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (withBackend) {
|
||||
JaasLoginModuleWithBackingEngineMBeanImpl mBean =
|
||||
new JaasLoginModuleWithBackingEngineMBeanImpl(entaxyRuntimeObject);
|
||||
return (T) mBean;
|
||||
} else {
|
||||
JaasLoginModuleMBeanImpl mBean = new JaasLoginModuleMBeanImpl(entaxyRuntimeObject);
|
||||
return (T) mBean;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Error creating MBean for [" + entaxyRuntimeObject.getObjectFullId() + "]", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends EntaxyRuntimeItemMBean> createMBeans() {
|
||||
if (jaasMBean != null)
|
||||
return Collections.singletonList(jaasMBean);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* jaas-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.core.management.jaas.impl;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.osgi.service.component.annotations.*;
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.platform.base.objects.EntaxyObjectService;
|
||||
import ru.entaxy.platform.core.management.jaas.JaasMBean;
|
||||
import ru.entaxy.platform.core.management.object.ContainerMBean;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractObjectContainerMBean;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager;
|
||||
|
||||
@Component(service = {JaasMbeanImpl.class}, scope = ServiceScope.SINGLETON,
|
||||
immediate = true)
|
||||
@ContainerMBean(id = "jaas", subQualifierValue = "jaas", subQualifierName = "security")
|
||||
public class JaasMbeanImpl extends AbstractObjectContainerMBean<JaasMBean> implements JaasMBean {
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile public EntaxyObjectService entaxyObjectService;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile private EntaxyRuntimeObjectManager entaxyRuntimeObjectManager;
|
||||
|
||||
public JaasMbeanImpl() throws NotCompliantMBeanException {
|
||||
super(JaasMBean.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Qualifier getJMXQualifier() {
|
||||
return JaasMBean.QUALIFIER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJMXSubQualifier() {
|
||||
return JaasMBean.SUBQUALIFIER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startJaasRealm(String idOrName) throws Exception {
|
||||
entaxyRuntimeObjectManager
|
||||
.start(entaxyObjectService.findObject(idOrName, JaasMBean.TYPE_REALM).getObjectFullId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopJaasRealm(String idOrName) throws Exception {
|
||||
entaxyRuntimeObjectManager
|
||||
.stopForced(entaxyObjectService.findObject(idOrName, JaasMBean.TYPE_REALM).getObjectFullId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallJaasRealm(String idOrName) throws Exception {
|
||||
entaxyRuntimeObjectManager
|
||||
.uninstallForced(entaxyObjectService.findObject(idOrName, JaasMBean.TYPE_REALM).getObjectFullId());
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* jaas-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.core.management.jaas.impl;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.EntaxyRuntimeTyped;
|
||||
import ru.entaxy.platform.core.management.jaas.JaasMBean;
|
||||
import ru.entaxy.platform.core.management.jaas.JaasRealmMBean;
|
||||
import ru.entaxy.platform.core.management.object.ObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractObjectMBean;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
@EntaxyRuntimeTyped(name = JaasMBean.TYPE_REALM)
|
||||
@ObjectMBean(subQualifierName = "realm")
|
||||
public class JaasRealmMBeanImpl extends AbstractObjectMBean<JaasRealmMBean> implements JaasRealmMBean {
|
||||
|
||||
protected JaasRealmMBeanImpl(EntaxyRuntimeObject entaxyRuntimeObject)
|
||||
throws NotCompliantMBeanException {
|
||||
super(JaasRealmMBean.class, entaxyRuntimeObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Qualifier getJMXQualifier() {
|
||||
return JaasMBean.QUALIFIER.qualifier("realm", getObjectId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJMXSubQualifier() {
|
||||
return JaasMBean.SUBQUALIFIER.concat(",realm=").concat(getObjectId());
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user