update readme

This commit is contained in:
Matthew Scragg 2015-11-22 11:19:11 -06:00
부모 1e62997272
커밋 4063754e12
6개의 변경된 파일72개의 추가작업 그리고 3개의 파일을 삭제

파일 보기

@ -113,7 +113,7 @@ You may want to customize your app and the easiest way is the setup command:
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.
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`.
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
realms-wiki start

파일 보기

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

파일 보기

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

파일 보기

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

파일 보기

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

파일 보기

@ -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
blueprint = Blueprint('search', __name__)