Giter VIP home page Giter VIP logo

Comments (7)

emicklei avatar emicklei commented on August 30, 2024

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.

crackcomm avatar crackcomm commented on August 30, 2024

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.

emicklei avatar emicklei commented on August 30, 2024

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

http://ernestmicklei.com

from mora.

crackcomm avatar crackcomm commented on August 30, 2024

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.

emicklei avatar emicklei commented on August 30, 2024

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

http://ernestmicklei.com

from mora.

crackcomm avatar crackcomm commented on August 30, 2024

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.

emicklei avatar emicklei commented on August 30, 2024

Along the vision of the new structure, we could have a subpkg contains auth method implementations.

from mora.

Related Issues (20)

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.