GluuFederation / uma-rs

UMA Resource Server library - helps to easily protect Java based project with UMA

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

uma-rs

UMA Resource Server library - helps to easily protect Java based project with UMA in declarative way.

Sample declaration

{"resources":[
    {
        "path":"/photo",
        "conditions":[
            {
                "httpMethods":["GET"],
                "scopes":[
                    "http://photoz.example.com/dev/actions/view"
                ]
            },
            {
                "httpMethods":["PUT", "POST"],
                "scopes":[
                    "http://photoz.example.com/dev/actions/all",
                    "http://photoz.example.com/dev/actions/add"
                ],
                "ticketScopes":[
                    "http://photoz.example.com/dev/actions/add"
                ]
            }
        ]
    },
    {
        "path":"/document",
        "conditions":[
            {
                "httpMethods":["GET"],
                "scopes":[
                    "http://photoz.example.com/dev/actions/view"
                ]
            }
        ]
    }
]
}

ticketScopes are used for UMA ticket registration. If it is skipped then ALL scopes are registered for ticket.

Usage

Configuration configuration = ConfigurationLoader.loadFromJson(inputStream(CONFIGURATION_FILE_NAME));
Collection<RsResource> values = RsProtector.instance(inputStream(PROTECTION_CONFIGURATION_FILE_NAME)).getResourceMap().values();

ServiceProvider serviceProvider = new ServiceProvider(configuration);
PatProvider patProvider = new PatProvider(serviceProvider);
ResourceRegistrar resourceRegistrar = new ResourceRegistrar(patProvider);

resourceRegistrar.register(values);

Check RS demo project sources.

About

UMA Resource Server library - helps to easily protect Java based project with UMA

License:Other


Languages

Language:Java 99.7%Language:Batchfile 0.3%