Giter VIP home page Giter VIP logo

hapi-rbac's People

Contributors

adrieankhisbe avatar franciscogouveia avatar hazkiel avatar jeffm13 avatar romakita avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hapi-rbac's Issues

hapi-rbac on data collection

Is there way to write RBAC policy to restrict access (visibility) to data collection?
e.g database has collection of books and student should only see books which has particular metadata. In other words if getBooks API should return books depending on particular book metadata,

Allow returning HTTP 403 (Forbidden) instead of only 401

It would be great if the "onPostAuth" handler could support returning 403 (Forbidden). This would help API client's distinguish between Authentication and Authorization Failures.

This could be a config option to either hard-code the result for RbacCore.DENY, or allow a function to specify.

I would be more than happy to make the change if you are willing to accept a patch.

Please let me know.

Create own data retrievers

With rbac-core v2.0.0 it is now possible to register your own asynchronous and synchronous data retrievers. With this feature you will be able to match information from a database, another Webservice, etc. depending on your implementation.

A public interface to the register from the instance of DataRetrieverRouter is not yet available in hapi-rbac.

Simplify target

Instead of

target: ['all-of',
  {
    type: 'username',
    value: 'fgouveia'
  },
  {
    type: 'group',
    value: 'writer'
  }
]

Do something like this for an AND condition

target: {
  username: 'fgouveia',
  group: 'writer'
}

Use an array for a combination of AND and OR condition

target: [
  {
    username: 'fgouveia',
    group: 'writer'
  },
  {
    username: 'anonymous',
    group: 'reader'
  }
]

Support Hapi v17??

Any chances of a new version compatible with Hapi v17?

is there any other branch, fork or other solution to work with RBAC??

field level access control

@franciscogouveia excellent library!

I wanted to see if you had any thoughts on how this could be used for field-level access control?

For example, given a customer record, a business owner may have full access to the record, which includes some private meta data, where as the customer themselves may have access to everything except that private meta data.

Thanks!

[feature request]possibility of retrieving rbac rules via promise

firstly, thanks for your great plugin, it's the most flexible authorization plugin for hapijs.
but I'd like to be able to store the rbac setting in database and retrieve them via a promise, so admin can dynamically change the rules without restarting the server.
I think the simple way is to detect if request.route.settings.plugins.rbac a function, if yes, execute it and get a promise.

thanks in advance

Manage request headers in data retriever

I would like to be able to check some HTTP headers in the request, like the Accept-language, to determine the access right on certain routes.
Is it OK for you if I submit a PR to manage that in the request data retriever ?

// Check allowed keys
if (['method', 'path', 'headers'].indexOf(key) === -1) {
return callback();
}

Is this project active?

Hello,
I'd like to use this library in one of my project but it says that you support Hapi 17.0 and you have hoek as one of the project dependencies (hoek is deprecated in favor of @hapi/hoek).

Are there any compatibility issues with recent versions of the Hapi framework?

Thank you for your hard work

Extract core

We have a use case where we would like to be able to use RBACs at a deeper layer then hapi/http. Would you be open to extracting the core functionality into a lib?

I'll be able to help on the PR.

Allow to evaluate more fields

At the moment, it is only possible to evaluate a target based on credentials.

It would be cool to be able to evaluate also based on request information, such as remote address or domain.

Method of defining Role hierarchy?

In the case of having roles such as ADMIN, MANAGER, REP, USER while defining the lower tier of rules
for a User in this case:

{
    target: ['any-of',
        {type: "role", value: "ADMIN"},
        {type: "role", value: "MANAGER"},
        {type: "role", value: "REP"},
        {type: "role", value: "USER"},
    ],
    effect: 'permit'    
}

it appears that I must do an 'any-of' and supply every more privileged role in the rule.
Is there a method of defining that ADMIN > MANAGER > REP > USER, allowing something akin to a greater-than or equal to rule type: "role", gte: "USER"

dynamic policy create

I am quite newbie for using hapi js.

i want to create dynamic policy using mysql database,
Whenever i write callback function it gives me error,
can you please provide me some example for the same? also how to write callback

server.register({
register: require('hapi-rbac'),
options: {
policy: function (request, callback) {
var roles = request.auth.credentials.group;

    var pol = "{ \n\t target: ['any-of', ";
     for(var i = 0; i<roles.length ; i++){
        pol = pol+ "{type: 'credentials:group', value: '"+roles[i]+"'}, ";
    } 
        pol = pol.substring(0, pol.length-2);

    pol = pol+" ], \n\t apply:  'permit-overrides', \n\t rules: [\n\t\t{\n\t\t\t target: ['any-of', {type: 'credentials:group', value: 'admin'}], \n\t\t\t effect: 'permit'\n\t\t}\n\t]\n}";

    //callback(null, pol);
    return callback(null, pol);
}

}
}, function(err) {
if(err){
throw err; }
});

Please suggest me any solution...

Test dict objects on target rules

Hi!
I cant realy understand the way the target is tested against the real value.

After define this rule

{ target: { 'credentials.roles.recruiter': undefined },
  effect: 'deny'
},
{ effect: 'permit' }

I expect that

{ credentials: {
      roles: {
          recruiter: {}
      }
  }
}

Would resolve to credentials.roles.recruiter = "Object" (or something not undefined)
And the rule would deny the access.

Why is my rule denying the access to that case?

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.