mattupstate/flask-security — pull request #260 by ocean1 (2014-06-05 14:54:04+00:00)
Title: expose flask-login token-loader to use a custom token_loader

I need to create a custom token (a key for a REST API) and want to use all the goodies flask-security brings (it's tied with a web application which uses flask-security)
it's just a matter of exposing the token_loader decorator of flask_login.

an example is the following:

```
security = Security(Flask(__name__))

@security.token_loader
def api_token_loader(token):
try:
if token is not None:
user = user_datastore.find_user(user_key=token)
if user is not None:
return user
except:
pass
return AnonymousUser()
```

and the user key can be generated any way we desire (i.e. resorting to our favourite RNG and hashing algo)