diff options
Diffstat (limited to 'python-dash-google-oauth.spec')
-rw-r--r-- | python-dash-google-oauth.spec | 218 |
1 files changed, 218 insertions, 0 deletions
diff --git a/python-dash-google-oauth.spec b/python-dash-google-oauth.spec new file mode 100644 index 0000000..945cdce --- /dev/null +++ b/python-dash-google-oauth.spec @@ -0,0 +1,218 @@ +%global _empty_manifest_terminate_build 0 +Name: python-dash-google-oauth +Version: 1.2 +Release: 1 +Summary: Authenticate to Dash app using Google OAuth +License: MIT +URL: https://github.com/hossein-jazayeri/dash-google-oauth +Source0: https://mirrors.aliyun.com/pypi/web/packages/52/a4/b6a8a993023a1f6186cd7688054bfc6a45ce605397eb662f40f490e66f07/dash-google-oauth-1.2.tar.gz +BuildArch: noarch + +Requires: python3-dash +Requires: python3-Flask +Requires: python3-authlib +Requires: python3-ua-parser +Requires: python3-chart-studio + +%description +# Dash Google OAuth + +This is a simple library using Google OAuth to authenticate and view a Dash app +written based on [dash-auth](https://github.com/plotly/dash-auth). +Upon authentication, a cookie is created and kept for 2 weeks. + +### Setup +Navigate to [Google API Console](https://console.cloud.google.com/apis/credentials), and setup an OAuth credentials +with `http://localhost:5000/login/callback` as authorized redirect URL. + +Install the package: +``` +$ pip install dash-google-oauth +``` +Define following environment variables: +``` +FLASK_SECRET_KEY + +GOOGLE_AUTH_URL +GOOGLE_AUTH_SCOPE +GOOGLE_AUTH_TOKEN_URI +GOOGLE_AUTH_REDIRECT_URI +GOOGLE_AUTH_USER_INFO_URL +GOOGLE_AUTH_CLIENT_ID +GOOGLE_AUTH_CLIENT_SECRET +``` +for example using [python-dotenv](https://pypi.org/project/python-dotenv/): +``` +FLASK_SECRET_KEY="..." + +GOOGLE_AUTH_URL=https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent +GOOGLE_AUTH_SCOPE="openid email profile" +GOOGLE_AUTH_TOKEN_URI=https://oauth2.googleapis.com/token +GOOGLE_AUTH_REDIRECT_URI=http://localhost:5000/login/callback +GOOGLE_AUTH_USER_INFO_URL=https://www.googleapis.com/userinfo/v2/me +GOOGLE_AUTH_CLIENT_ID="..." +GOOGLE_AUTH_CLIENT_SECRET="..." +``` +Add it to the application: +``` +app = Dash(__name__) + +from dash_google_oauth.google_auth import GoogleAuth +auth = GoogleAuth(app) +``` +To logout, you may make a `GET` request to `/logout` + + + +%package -n python3-dash-google-oauth +Summary: Authenticate to Dash app using Google OAuth +Provides: python-dash-google-oauth +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-dash-google-oauth +# Dash Google OAuth + +This is a simple library using Google OAuth to authenticate and view a Dash app +written based on [dash-auth](https://github.com/plotly/dash-auth). +Upon authentication, a cookie is created and kept for 2 weeks. + +### Setup +Navigate to [Google API Console](https://console.cloud.google.com/apis/credentials), and setup an OAuth credentials +with `http://localhost:5000/login/callback` as authorized redirect URL. + +Install the package: +``` +$ pip install dash-google-oauth +``` +Define following environment variables: +``` +FLASK_SECRET_KEY + +GOOGLE_AUTH_URL +GOOGLE_AUTH_SCOPE +GOOGLE_AUTH_TOKEN_URI +GOOGLE_AUTH_REDIRECT_URI +GOOGLE_AUTH_USER_INFO_URL +GOOGLE_AUTH_CLIENT_ID +GOOGLE_AUTH_CLIENT_SECRET +``` +for example using [python-dotenv](https://pypi.org/project/python-dotenv/): +``` +FLASK_SECRET_KEY="..." + +GOOGLE_AUTH_URL=https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent +GOOGLE_AUTH_SCOPE="openid email profile" +GOOGLE_AUTH_TOKEN_URI=https://oauth2.googleapis.com/token +GOOGLE_AUTH_REDIRECT_URI=http://localhost:5000/login/callback +GOOGLE_AUTH_USER_INFO_URL=https://www.googleapis.com/userinfo/v2/me +GOOGLE_AUTH_CLIENT_ID="..." +GOOGLE_AUTH_CLIENT_SECRET="..." +``` +Add it to the application: +``` +app = Dash(__name__) + +from dash_google_oauth.google_auth import GoogleAuth +auth = GoogleAuth(app) +``` +To logout, you may make a `GET` request to `/logout` + + + +%package help +Summary: Development documents and examples for dash-google-oauth +Provides: python3-dash-google-oauth-doc +%description help +# Dash Google OAuth + +This is a simple library using Google OAuth to authenticate and view a Dash app +written based on [dash-auth](https://github.com/plotly/dash-auth). +Upon authentication, a cookie is created and kept for 2 weeks. + +### Setup +Navigate to [Google API Console](https://console.cloud.google.com/apis/credentials), and setup an OAuth credentials +with `http://localhost:5000/login/callback` as authorized redirect URL. + +Install the package: +``` +$ pip install dash-google-oauth +``` +Define following environment variables: +``` +FLASK_SECRET_KEY + +GOOGLE_AUTH_URL +GOOGLE_AUTH_SCOPE +GOOGLE_AUTH_TOKEN_URI +GOOGLE_AUTH_REDIRECT_URI +GOOGLE_AUTH_USER_INFO_URL +GOOGLE_AUTH_CLIENT_ID +GOOGLE_AUTH_CLIENT_SECRET +``` +for example using [python-dotenv](https://pypi.org/project/python-dotenv/): +``` +FLASK_SECRET_KEY="..." + +GOOGLE_AUTH_URL=https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent +GOOGLE_AUTH_SCOPE="openid email profile" +GOOGLE_AUTH_TOKEN_URI=https://oauth2.googleapis.com/token +GOOGLE_AUTH_REDIRECT_URI=http://localhost:5000/login/callback +GOOGLE_AUTH_USER_INFO_URL=https://www.googleapis.com/userinfo/v2/me +GOOGLE_AUTH_CLIENT_ID="..." +GOOGLE_AUTH_CLIENT_SECRET="..." +``` +Add it to the application: +``` +app = Dash(__name__) + +from dash_google_oauth.google_auth import GoogleAuth +auth = GoogleAuth(app) +``` +To logout, you may make a `GET` request to `/logout` + + + +%prep +%autosetup -n dash-google-oauth-1.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-dash-google-oauth -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 1.2-1 +- Package Spec generated |