Name:		authHub
Version:	v1.0.0
Release:	6
Summary:	Authentication authority based on oauth2
License:	MulanPSL2
URL:		https://gitee.com/openeuler/%{name}
Source0:	%{name}-%{version}.tar.gz
Source1:	node_modules.tar.gz
Patch0001:	0001-change-authhub-web-service-file-directory.patch
Patch0002:	0002-fix-the-router-redirect-error.patch
Patch0003:	0003-fix-logout-register-error.patch
Patch0004:	0004-supplementary-verify-token.patch
Patch0005:	0005-change-login-authorization-url.patch
Patch0006:	0006-add-field-validation-when-submitting-the-form.patch
Patch0007:	0007-update-authhub-yml.patch

BuildRequires:  python3-setuptools
Requires:  aops-vulcanus >= v2.1.0 python3-Authlib aops-zeus >= v2.1.0 python3-Flask-SQLAlchemy
Provides:  authhub

%description
authhub is a specialized authentication center built on OAuth2, providing robust authentication and authorization capabilities for secure user access control in your applications..

%package -n authhub-web
Summary: Authentication authority web based on oauth2

BuildRequires: nodejs
Requires:  nginx

%description -n authhub-web
Authentication authority web based on oauth2

%prep
%autosetup -n %{name}-%{version} -p1
%setup -T -D -a 1 -n %{name}-%{version}/oauth2_web
cd %{_builddir}/%{name}-%{version}

# build for authhub
%py3_build

# build for authhub-web
pushd oauth2_web
npm run build
popd

# install for authhub
%py3_install

# install for authhub-web
pushd oauth2_web
mkdir -p %{buildroot}/opt/authhub/web/
cp -r dist %{buildroot}/opt/authhub/web/
mkdir -p %{buildroot}/%{_sysconfdir}/nginx/conf.d/
cp deploy/authhub.nginx.conf %{buildroot}/%{_sysconfdir}/nginx/conf.d/
mkdir -p %{buildroot}/usr/lib/systemd/system
cp -r deploy/authhub-web.service %{buildroot}/usr/lib/systemd/system/
popd

%files
%attr(0644,root,root) %{_sysconfdir}/aops/conf.d/authhub.yml
%attr(0755,root,root) %{_unitdir}/authhub.service
%attr(0755, root, root) /opt/aops/database/*
%{python3_sitelib}/authhub*.egg-info
%{python3_sitelib}/oauth2_provider/*

%files -n authhub-web
%attr(0755, root, root) /opt/authhub/web/dist/*
%attr(0755,root,root) %{_unitdir}/authhub-web.service
%attr(0755,root,root) %{_sysconfdir}/nginx/conf.d/*

%changelog
* Tue Nov 19 2024 Hu gang<18768366022@163.com> - v1.0.0-6
- Add field validation when submitting the form
- Solve the problem of not being able to obtain the accurate domain name after deploying the forwarding address
- Set uwsgi buffer-size to 32k to solve the problem of parameters being truncated due to large size

* Tue Sep 24 2024 luxuexian<luxuexian@huawei.com> - v1.0.0-5
- Supplementary verify token

* Fri Sep 20 2024 luxuexian<luxuexian@huawei.com> - v1.0.0-4
- Fix logout error
- Fix register error

* Thu Sep 19 2024 luxuexian<luxuexian@huawei.com> - v1.0.0-3
- Fix the router redirect error
- Add python3-FLask-SQLAlchemy requires

* Mon Sep 9 2024 luxuexian<luxuexian@huawei.com> - v1.0.0-2
- change authhub-web.service file directory

* Mon Sep 9 2024 luxuexian<luxuexian@huawei.com> - v1.0.0-1
- The first version of authHub is released, supporting local
- unified authentication for services such as aops and copilot
