GithubHelp home page GithubHelp logo

yanzefa / spring-boot-shiro-orientdb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pires/spring-boot-shiro-orientdb

0.0 1.0 0.0 231 KB

A simple REST API built with Spring Boot and OrientDB (Object API) datastore, secured with Apache Shiro (distributed session storage powered by Hazelcast).

License: Apache License 2.0

Java 100.00%

spring-boot-shiro-orientdb's Introduction

This sample project is comprehended by the following:

  • Spring Boot REST controller
  • OrientDB (2.0.13) remote object persistence by means of Spring Data
  • Apache Shiro (1.2.4) session-management with OrientDB-based authorizing realm
  • Hazelcast (3.5.1) powered session distributed persistence

Pre-requisites

  • JDK 8
  • Maven 3.2.3 or newer

Spring Data hack

We need spring-data-orientdbfor Spring Data OrientDB support. We'll be checking out a commit known to be working at the time of this writing.

git clone [email protected]:orientechnologies/spring-data-orientdb.git
cd spring-data-orientdb
git checkout 6337a3e
mvn clean install

Run

mvn clean package spring-boot:run

Testing

Automatically

mvn clean test

Manually

Initialize test scenario

curl -i -H "Accept: application/json" -X PUT http://localhost:8080/users

Access protected method without being authenticated

curl -i -H "Accept: application/json" -X GET http://localhost:8080/users

You should get a 401 Unauthorized response status.

Log-in

curl -i -c cookie.txt -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"username":"[email protected]","password":"123qwe"}' http://localhost:8080/users/auth

You should get a 200 OK response status and have a valid cookie stored in cookie.txt.

Access protected method again

curl -i -b cookie.txt -H "Accept: application/json" -X GET http://localhost:8080/users

You should get a 200 OK response status and some JSON representing existing users.

Access another protected method to which you don't have permission

curl -i -b cookie.txt -H "Accept: application/json" -X GET http://localhost:8080/users/do_something

You should get a 401 Unauthorized response status.

spring-boot-shiro-orientdb's People

Contributors

pires avatar vidakovic avatar

Watchers

 avatar

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.