GithubHelp home page GithubHelp logo

avelino / bottle-auth Goto Github PK

View Code? Open in Web Editor NEW
29.0 29.0 12.0 381 KB

Bootle authentication, for Personal, Google, Twitter and facebook

Home Page: https://pypi.python.org/pypi/bottle-auth

License: MIT License

Python 100.00%

bottle-auth's Introduction

Hey, I'm Avelino !

What I'm working on ๐Ÿ‘จโ€๐Ÿ’ป

ฮป: moclojer - Simple and efficient HTTP mock server with specification in yaml, edn or OpenAPI
๐Ÿ˜: prestd - PostgreSQL + REST, simplify and accelerate development, โšก instant, realtime, high-performance on any Postgres application, existing or new

Find me elsewhere ๐ŸŒŽ

๐Ÿš€: Site
๐Ÿ˜: mastodon ๐Ÿฆ: Twitter
๐Ÿ’ผ: LinkedIn
๐Ÿ“ธ: Instagram - good dream is dream lived, triathlete ๐ŸŠโ€โ™‚๏ธ ๐Ÿšดโ€โ™‚๏ธ ๐Ÿƒโ€โ™‚๏ธ

Avelino profile views

bottle-auth's People

Contributors

avelino avatar brunogfranca avatar lerrua avatar tpdn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

bottle-auth's Issues

egg problem

Try to install this plugin:
can use the source files but the egg generated have some problem perform proper imports.
I've check ... and egg is in sys.path.

"Com muita vontade de provar o teu plugin ... obrigado"

... sorry new in github ... maybe this should be in bug

missing reference

missing a reference for breaker session middleware in example:
fix:
from beaker.middleware import SessionMiddleware

app = SessionMiddleware("currentApp", session_opts)

Added suppoprt bottle.auth

Today at the core of the bottle exist a basic authentication method, the idea is to make the "bottle-auth" conversation with the "bottle auth."

HTTP authentication data as a (user, password) tuple. This
implementation currently supports basic (not digest) authentication
only. If the authentication happened at a higher level (e.g. in the
front web-server or a middleware), the password field is None, but
the user field is looked up from the ``REMOTE_USER`` environ
variable. On any errors, None is returned.

Example:

import bottle
from bottle import Bottle, redirect, request, run
from bottle.ext import auth
from bottle.ext.auth.decorator import login
from bottle.ext.auth.social.facebook import Facebook, UserDenied
from bottle.ext.auth.social.facebook import NegotiationError
from pprint import pformat

facebook = Facebook('fb-key', 'fb-secret',
                    'http://127.0.0.1:8000/', 'email')

app = Bottle()
plugin = auth.AuthPlugin(facebook)
app.install(plugin)


@app.route('/login')
def login(auth):
    return auth.redirect(request.environ)


@app.route('/')
@bottle.auth(auth) # alternative used core source bottle
def home():
    user = auth.get_user(request.environ)
    return "Home page {}".format(pformat(user))


run(app=app, host='0.0.0.0', port='3333', debug=True)

AttributeError: 'module' object has no attribute 'redirect'

When I try with the example I have this error :

File "facebook.py", line 22, in
@login(auth)
File "facebook.py", line 18, in login
return auth.redirect(request.environ)
AttributeError: 'module' object has no attribute 'redirect'

I install bottle-auth with easy_install, pip and I have the same error. What's wrong ?

Support python3

Python 3.5 is not very happy:

  Running setup.py install for bottle-auth
      File "/var/www/venv/lib/python3.5/site-packages/bottle_auth/social/facebook.py", line 34
        except HTTPRedirect, e:
                           ^
    SyntaxError: invalid syntax

      File "/var/www/venv/lib/python3.5/site-packages/bottle_auth/social/twitter.py", line 29
        except HTTPRedirect, e:
                           ^
    SyntaxError: invalid syntax

      File "/var/www/venv/lib/python3.5/site-packages/bottle_auth/social/google.py", line 31
        except HTTPRedirect, e:
                           ^
    SyntaxError: invalid syntax

      File "/var/www/venv/lib/python3.5/site-packages/bottle_auth/core/escape.py", line 223
        _URL_RE = re.compile(ur"""\b((?:([\w-]+):(/{1,3})|www[.])(?:(?:(?:[^\s&()]|&amp;|&quot;)*(?:[^!"#$%&'()*+,.:;<=>?@\[\]^`{|}~\s]))|(?:\((?:[^\s&()]|&amp;|&quot;)*\)))+)""")
                                                                                                                                                                                 ^
    SyntaxError: invalid syntax

      File "/var/www/venv/lib/python3.5/site-packages/bottle_auth/core/httpclient.py", line 101
        except (httplib.error, socket.error, IOError), e:
                                                     ^
    SyntaxError: invalid syntax

Decorator login not working as expected

The decorator login isn't working as a decorator:

couldn't get this to work:

@sme_auth_app.route('/')
@login(auth)
def home(auth):

but

@sme_auth_app.route('/')

@login()

def home(auth):
user = auth.get_user(request.environ)

works fine.

error with some ascii and unicode

got the app working changing line 273 (auth.py)
to
args = dict((k, unicode(v[-1]).encode('utf-8')) for k, v in self.request.arguments.iteritems())

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.