667: Add Spring Security to Service Example

Test Case #: 667

Test Case Name: Add Spring Security to Service Example

System: OpenLMIS

Subsystem: Example

Test case designed by: Anna Czyrko

Design Date:25.07.2016

Short description

Demonstrate how to do RBAC with Spring Security on a Spring Boot RESTful interface

                                                                                                                                                   

Pre – conditions:

                                                                                                                                                                                                                                                       

 

 

Step

Action

Expected system response

Comment

1

http://localhost:8080/ it is not protected

Open Postman.

Enter:

URL: http://localhost:8080/

Method: Get

Authentication: no authentication

Should appear: Status 200 OK
2

http://localhost:8080/api/foos/count is available for authenticated users (regular user and admin) - without any login

URL: http://localhost:8080/api/foos/count

Method: Get

Authentication: no auhentication


Should appear: Status 401 Unauthorized
3

http://localhost:8080/api/foos/count is available for authenticated users (regular user and admin) - regukar user

URL: http://localhost:8080/api/foos/count

Method: Get

Authentication:

user/password


Should appear: Status 200 OK
4

http://localhost:8080/api/foos/count is available for authenticated users (regular user and admin) - admin

URL: http://localhost:8080/api/foos/count

Method: Get

Authentication:

admin/password

Should appear: Status 200 OK
5

http://localhost:8080/weather/Gdynia only admin has access - whithout any login

URL: http://localhost:8080/weather/Gdynia

Method: Get

Authentication: no authentication


Should appear: Status 401 Unauthorized
6

http://localhost:8080/weather/Gdynia only admin has access - regular user

URL: http://localhost:8080/weather/Gdynia

Method: Get

Authentication: user/password

Should appear: Status 401 Unauthorized
7

http://localhost:8080/weather/Gdynia only admin has access - regular user

URL: http://localhost:8080/weather/Gdynia

Method: Get

Authentication: admin/password

Should appear: Status 200 OK
8

http://localhost:8080/logout

URL: http://localhost:8080/logout

Method: Get

Authentication: no auhentication


Should appear: Status 200 OK

 

Post – conditions:

                                                                                                                   

OpenLMIS: the global initiative for powerful LMIS software