Comments (7)
Sorry about replying to this issue this late.
Do you think Mora should perform such authentication (it already can do Mongo auth)? Another option is put such a service in front of Mora. Apache and Nginx both could perform this task.
from mora.
I think mora is actually well performing HTTP server in it's current form and users should have an option to use authentication in it. Also it is a problem for PaaS users who doesn't always have possibility to configure loadbalancer or any intermediary server in infrastructure in such way.
from mora.
in the past, i have used HMAC to protect an Api. Kind of the way Amazon AWS
apis are accessible. Another feature that spings to mind is rate-limiting.
What kinds of schemes were you thinking of? We could provide filter
implementations to Mora for the user to configure.
On Monday, March 10, 2014, Łukasz Kurowski [email protected] wrote:
I think mora is actually well performing HTTP server in it's current form
and users should have an option to use authentication in it. Also it is a
problem for PaaS users who doesn't always have possibility to configure
loadbalancer or any intermediary server in infrastructure in such way.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/18#issuecomment-37192323
.
^ Ernest Micklei
from mora.
Yes, I think we should provide few basic filters which could be enabled in configuration file.
Example config section:
mora.filters = basic_auth,other_defined
mora.filters.basic_auth.username = admin
mora.filters.basic_auth.password = password
example implementation
var registeredFilers map[string](func(p properties.Properties) func(req *restful.Request, resp *restful.Response))
func init() {
// basic authentication filter
registeredFilters["basic_auth"] = func(p properties.Properties) func(req *restful.Request, resp *restful.Response) {
var (
username = p.GetString("username", "")
password = p.GetString("password", "")
)
return func(req *restful.Request, resp *restful.Response) {
// authenticate here
}
}
}
func initializeRouter() { //proto
filters := strings.Split(props.GetString("mora.filters"), ",")
for _, name := range filters {
if filter := registeredFilters[name]; filter != nil {
fn := filter(props.SelectProperties(fmt.Sprintf("mora.filters.%s", name)))
route.Filter(fn)
}
}
}
from mora.
good idea to have filter implementations and let users configure their
settings.
The hard part is to think about what filters to offer.
On Monday, March 10, 2014, Łukasz Kurowski [email protected] wrote:
Yes, I think we should provide few basic filters which could be enabled in
configuration file.Example config section:
mora.filters = basic_auth,other_definedmora.filters.basic_auth.username = adminmora.filters.basic_auth.password = password
example implementation
var registeredFilers map[string](func%28p properties.Properties%29 func%28req *restful.Request, resp *restful.Response%29)
func init() {
// basic authentication filter
registeredFilters["basic_auth"] = func(p properties.Properties) func(req *restful.Request, resp *restful.Response) {
var username, password = p.GetString("username", ""), p.GetString("password", "")return func(req *restful.Request, resp *restful.Response) { // authenticate here } }}
func initializeRouter() { //proto
filters := strings.Split(props.GetString("mora.filters"), "")for _, name := range filters { if filter := registeredFilters[name]; filter != nil { fn := filter(props.SelectProperties(fmt.Sprintf("mora.filters.%s", name))) route.Filter(fn) } }}
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/18#issuecomment-37215140
.
^ Ernest Micklei
from mora.
I think just basic auth should be fine for now. IMO we should create a new directory which will contain one filter per file so it would be easy to make a new one for any contributor without digging into any additional code.
from mora.
Along the vision of the new structure, we could have a subpkg contains auth method implementations.
from mora.
Related Issues (20)
- [cors] use go-restful standard filter to implement CORS HOT 2
- Error on update when new document contains string "_id".
- Mora reusing HOT 1
- XML serialization error HOT 1
- Does not handle documents with UUID's as Ids HOT 5
- Wondering about hooks HOT 1
- Can't authenticate with Mora HOT 3
- Builds failing due to missing goproperties repo HOT 3
- Is there any build document? HOT 1
- swagger seems doesn't work HOT 3
- Interger becomes double when updating document with mora. HOT 1
- Is there any api to run mongodb shell? HOT 2
- bind: cannot assign requested address HOT 1
- Is there any plan to add api input validation. HOT 2
- resp.WriteHeader(status) in func WriteStatus is not required anymore. HOT 3
- Is there an easy way to add auth mechanism in mora.
- Every new post request create a new TCP connection. HOT 1
- OPTIONS response prior to performing PUT does not contain Access-Control-Allow-Origin or Access-Control-Expose-Headers headers. Rejected by Chrome. HOT 1
- len(data)=0 when I set skip=1 and limit=1 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mora.