OutOfEastGate / dynamodb-adapter

DynamoDB adapter for Casbin

Home Page:https://github.com/casbin/jcasbin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DynamoDB Adapter

codebeat badge Build Status codecov javadoc Maven Central Gitter

DynamoDB Adapter is the Amazon DynamoDB adapter for jCasbin, which provides interfaces for loading policies from DynamoDB and saving policies to it.

Currently we only support fot the following interfaces:

  • loadPolicy
  • savePolicy

Installation

<dependency>
    <groupId>org.casbin</groupId>
    <artifactId>dynamodb-adapter</artifactId>
    <version>0.0.1</version>
</dependency>

Example

package com.company.example;

import org.casbin.jcasbin.main.Enforcer;
import org.casbin.jcasbin.util.Util;
import org.casbin.adapter.DynamoDBAdapter;

public class Example {
    
    Enforcer e = new Enforcer("examples/rbac_model.conf", "examples/rbac_policy.csv");

    String endpoint = "http://localhost:8000";
    String region = "cn-north-1";
    DynamoDBAdapter a = new DynamoDBAdapter(endpoint, region);

    // Save policy to DB
    a.savePolicy(e.getModel());

    // Load policy from DB
    a.loadPolicy(e.getModel());
}

Getting Help

License

This project is under Apache 2.0 License. See the LICENSE file for the full license text.

About

DynamoDB adapter for Casbin

https://github.com/casbin/jcasbin

License:Apache License 2.0


Languages

Language:Java 100.0%