-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathSecurityContext.java
More file actions
28 lines (24 loc) · 1.09 KB
/
SecurityContext.java
File metadata and controls
28 lines (24 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* Copyright (c) restSQL Project Contributors. Licensed under MIT. */
package org.restsql.security;
import java.security.Principal;
/**
* Provides user principal and role check method. Mapped to the JAX-RS SecurityContext by the
* <code>org.restsql.service.SecurityContextAdapter</code>.
*
* @author Mark Sawers
*/
public interface SecurityContext {
/**
* Returns a boolean indicating whether the authenticated user is included in the specified logical "role".
*
* @param roleName a String specifying the name of the role
* @return a boolean indicating whether the user making the request belongs to a given role; false if the user has not been authenticated
*/
public boolean isUserInRole(String roleName);
/**
* Returns a java.security.Principal object containing the name of the current authenticated user. If the user has not been authenticated, the method returns null.
*
* @return a java.security.Principal containing the name of the user making this request; null if the user has not been authenticated
*/
public Principal getUserPrincipal();
}