diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-05 14:03:29 +0000 | 
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-05 14:03:29 +0000 | 
| commit | 112113a84a0e5fd31b4778a36d91dc33bab49c62 (patch) | |
| tree | 3b8b648224a324528018fdf3efa2384e37e0395e | |
| parent | 79e3a8f62cd7cdba5475fd62fc198722f272515c (diff) | |
automatic import of python-yhttp-authopeneuler20.03
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-yhttp-auth.spec | 339 | ||||
| -rw-r--r-- | sources | 1 | 
3 files changed, 341 insertions, 0 deletions
@@ -0,0 +1 @@ +/yhttp-auth-3.8.1.tar.gz diff --git a/python-yhttp-auth.spec b/python-yhttp-auth.spec new file mode 100644 index 0000000..72d88d4 --- /dev/null +++ b/python-yhttp-auth.spec @@ -0,0 +1,339 @@ +%global _empty_manifest_terminate_build 0 +Name:		python-yhttp-auth +Version:	3.8.1 +Release:	1 +Summary:	A very micro http framework. +License:	MIT +URL:		http://github.com/yhttp/yhttp-auth +Source0:	https://mirrors.nju.edu.cn/pypi/web/packages/45/d0/d7832dec974d3e7d6fc8cfeefeece0c05c684a9ea9e56c7e415ef44992ac/yhttp-auth-3.8.1.tar.gz +BuildArch:	noarch + + +%description +# yhttp-auth + +[](https://pypi.python.org/pypi/yhttp-auth) +[](https://github.com/yhttp/yhttp-auth/actions/workflows/build.yml) +[](https://coveralls.io/github/yhttp/yhttp-auth?branch=master) + + +Authentication extension for [yhttp](https://github.com/yhttp/yhttp). + + +### Install + +```bash +pip install yhttp-pony +``` + + +### Usage + +```python +from yhttp import Application +from yhttp.ext.auth import install as auth_install + + +app = Application() +auth = auth_install(app) +app.settings.merge(f''' +auth: +  redis: +    host: localhost +    port: 6379 +    db: 0 + +  token: +    algorithm: HS256 +    secret: foobar + +  refresh: +    key: yhttp-refresh-token +    algorithm: HS256 +    secret: quxquux +    secure: true +    httponly: true +    maxage: 2592000  # 1 Month +    domain: example.com +''') + + +@app.route('/reftokens') +@yhttp.statuscode(yhttp.statuses.created) +def create(req): +    app.auth.set_refreshtoken(req, 'alice', dict(baz='qux')) + +@app.route('/tokens') +@yhttp.statuscode(yhttp.statuses.created) +@yhttp.text +def refresh(req): +    reftoken = app.auth.verify_refreshtoken(req) +    return app.auth.dump_from_refreshtoken(reftoken, dict(foo='bar')) + +@app.route('/admin') +@auth(roles='admin, god') +@yhttp.text +def get(req): +    return req.identity.roles + +app.ready() +``` + +### Command line interface + +setup.py + +```python + +setup( +    ... +    entry_points={ +        'console_scripts': [ +            'myapp = myapp:app.climain' +        ] +    }, +    ... +) + +``` + +```bash +myapp auth --help +``` + +%package -n python3-yhttp-auth +Summary:	A very micro http framework. +Provides:	python-yhttp-auth +BuildRequires:	python3-devel +BuildRequires:	python3-setuptools +BuildRequires:	python3-pip +%description -n python3-yhttp-auth +# yhttp-auth + +[](https://pypi.python.org/pypi/yhttp-auth) +[](https://github.com/yhttp/yhttp-auth/actions/workflows/build.yml) +[](https://coveralls.io/github/yhttp/yhttp-auth?branch=master) + + +Authentication extension for [yhttp](https://github.com/yhttp/yhttp). + + +### Install + +```bash +pip install yhttp-pony +``` + + +### Usage + +```python +from yhttp import Application +from yhttp.ext.auth import install as auth_install + + +app = Application() +auth = auth_install(app) +app.settings.merge(f''' +auth: +  redis: +    host: localhost +    port: 6379 +    db: 0 + +  token: +    algorithm: HS256 +    secret: foobar + +  refresh: +    key: yhttp-refresh-token +    algorithm: HS256 +    secret: quxquux +    secure: true +    httponly: true +    maxage: 2592000  # 1 Month +    domain: example.com +''') + + +@app.route('/reftokens') +@yhttp.statuscode(yhttp.statuses.created) +def create(req): +    app.auth.set_refreshtoken(req, 'alice', dict(baz='qux')) + +@app.route('/tokens') +@yhttp.statuscode(yhttp.statuses.created) +@yhttp.text +def refresh(req): +    reftoken = app.auth.verify_refreshtoken(req) +    return app.auth.dump_from_refreshtoken(reftoken, dict(foo='bar')) + +@app.route('/admin') +@auth(roles='admin, god') +@yhttp.text +def get(req): +    return req.identity.roles + +app.ready() +``` + +### Command line interface + +setup.py + +```python + +setup( +    ... +    entry_points={ +        'console_scripts': [ +            'myapp = myapp:app.climain' +        ] +    }, +    ... +) + +``` + +```bash +myapp auth --help +``` + +%package help +Summary:	Development documents and examples for yhttp-auth +Provides:	python3-yhttp-auth-doc +%description help +# yhttp-auth + +[](https://pypi.python.org/pypi/yhttp-auth) +[](https://github.com/yhttp/yhttp-auth/actions/workflows/build.yml) +[](https://coveralls.io/github/yhttp/yhttp-auth?branch=master) + + +Authentication extension for [yhttp](https://github.com/yhttp/yhttp). + + +### Install + +```bash +pip install yhttp-pony +``` + + +### Usage + +```python +from yhttp import Application +from yhttp.ext.auth import install as auth_install + + +app = Application() +auth = auth_install(app) +app.settings.merge(f''' +auth: +  redis: +    host: localhost +    port: 6379 +    db: 0 + +  token: +    algorithm: HS256 +    secret: foobar + +  refresh: +    key: yhttp-refresh-token +    algorithm: HS256 +    secret: quxquux +    secure: true +    httponly: true +    maxage: 2592000  # 1 Month +    domain: example.com +''') + + +@app.route('/reftokens') +@yhttp.statuscode(yhttp.statuses.created) +def create(req): +    app.auth.set_refreshtoken(req, 'alice', dict(baz='qux')) + +@app.route('/tokens') +@yhttp.statuscode(yhttp.statuses.created) +@yhttp.text +def refresh(req): +    reftoken = app.auth.verify_refreshtoken(req) +    return app.auth.dump_from_refreshtoken(reftoken, dict(foo='bar')) + +@app.route('/admin') +@auth(roles='admin, god') +@yhttp.text +def get(req): +    return req.identity.roles + +app.ready() +``` + +### Command line interface + +setup.py + +```python + +setup( +    ... +    entry_points={ +        'console_scripts': [ +            'myapp = myapp:app.climain' +        ] +    }, +    ... +) + +``` + +```bash +myapp auth --help +``` + +%prep +%autosetup -n yhttp-auth-3.8.1 + +%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-yhttp-auth -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 3.8.1-1 +- Package Spec generated @@ -0,0 +1 @@ +a57420ab83098deec123317edb42aa27  yhttp-auth-3.8.1.tar.gz  | 
