update readme

This commit is contained in:
Matthew Scragg 2015-11-22 11:19:11 -06:00
parent 1e62997272
commit 4063754e12
6 changed files with 72 additions and 3 deletions

View file

@ -113,7 +113,7 @@ You may want to customize your app and the easiest way is the setup command:
realms-wiki setup realms-wiki setup
This will ask you questions and create a `realms-wiki.json` file in where you can find it. This will ask you questions and create a `realms-wiki.json` file.
You can manually edit this file as well. You can manually edit this file as well.
Any config value set in `realms-wiki.json` will override values set in `realms/config/__init__.py`. Any config value set in `realms-wiki.json` will override values set in `realms/config/__init__.py`.
@ -273,6 +273,71 @@ WHOOSH_INDEX has to be a path readable and writeable by Realm's user. It will be
Whoosh is set up to use language optimization, so set WHOOSH_LANGUAGE to the language used in your wiki. For available languages, check `whoosh.lang.languages`. Whoosh is set up to use language optimization, so set WHOOSH_LANGUAGE to the language used in your wiki. For available languages, check `whoosh.lang.languages`.
If your language is not supported, Realms will fall back to a simple text analyzer. If your language is not supported, Realms will fall back to a simple text analyzer.
## Authentication
### Local
Local default will be done using a backend database as defined in the config.
### LDAP (beta)
Realms uses the following library to authenticate using LDAP. https://github.com/ContinuumIO/flask-ldap-login
It supports direct bind and bind by search.
Use these examples as a guide and place it in your realms-wiki.json config.
#### Bind By Search Example
In this example, BIND_DN and BIND_AUTH are used to search and authenticate. Leaving them blank implies anonymous authentication.
```
"LDAP": {
"URI": "ldap://localhost:8389",
"BIND_DN": "",
"BIND_AUTH": "",
"USER_SEARCH": {"base": "dc=realms,dc=io", "filter": "uid=%(username)s"},
"KEY_MAP": {
"username":"cn",
"email": "mail"
}
}
```
#### Direct Bind Example
```
"LDAP": {
"URI": "ldap://localhost:8389",
"BIND_DN": "uid=%(username)s,ou=People,dc=realms,dc=io",
"KEY_MAP": {
"username":"cn",
"email": "mail",
},
"OPTIONS": {
"OPT_PROTOCOL_VERSION": 3,
}
}
```
### OAuth (beta)
Realms currently supports Github, Twitter, Facebook and Google. Each provider requires a key and secret.
Put them in your `realms-wiki.json` config file. Use the example below.
```
"OAUTH": {
"twitter": {
"key": "",
"secret": ""
},
"github": {
"key": "",
"secret": ""
}
}
```
## Running ## Running
realms-wiki start realms-wiki start

View file

@ -3,5 +3,5 @@ from wtforms import StringField, PasswordField, validators
class LoginForm(Form): class LoginForm(Form):
email = StringField('Email', [validators.DataRequired()]) login = StringField('Username', [validators.DataRequired()])
password = PasswordField('Password', [validators.DataRequired()]) password = PasswordField('Password', [validators.DataRequired()])

View file

@ -7,12 +7,14 @@ from ..models import BaseUser
users = {} users = {}
@ldap.save_user @ldap.save_user
def save_user(username, userdata): def save_user(username, userdata):
user = User(userdata.get('username'), userdata.get('email')) user = User(userdata.get('username'), userdata.get('email'))
users[user.id] = user users[user.id] = user
return user return user
class User(BaseUser): class User(BaseUser):
type = 'ldap' type = 'ldap'

View file

@ -4,6 +4,7 @@ from flask_ldap_login import LDAPLoginForm
blueprint = Blueprint('auth.ldap', __name__) blueprint = Blueprint('auth.ldap', __name__)
@blueprint.route("/login/ldap", methods=['POST']) @blueprint.route("/login/ldap", methods=['POST'])
def login(): def login():
form = LDAPLoginForm() form = LDAPLoginForm()

View file

@ -82,6 +82,7 @@ providers = {
} }
} }
class User(BaseUser): class User(BaseUser):
type = 'oauth' type = 'oauth'
provider = None provider = None

View file

@ -1,4 +1,4 @@
from flask import abort, g, render_template, request, redirect, Blueprint, flash, url_for, current_app from flask import render_template, request, Blueprint
from realms import search as search_engine from realms import search as search_engine
blueprint = Blueprint('search', __name__) blueprint = Blueprint('search', __name__)