
com.github.mcollovati.vertx.vaadin.connect.auth.UserAwareRequest Maven / Gradle / Ivy
/*
* The MIT License
* Copyright © 2016-2020 Marco Collovati ([email protected])
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.github.mcollovati.vertx.vaadin.connect.auth;
public interface UserAwareRequest {
/**
* Returns a boolean indicating whether the authenticated user is included
* in the specified logical "role". Roles and role membership can be
* defined using deployment descriptors. If the user has not been
* authenticated, the method returns false
.
*
* The role name “*” should never be used as an argument in calling
* isUserInRole
. Any call to isUserInRole
with
* “*” must return false.
* If the role-name of the security-role to be tested is “**”, and
* the application has NOT declared an application security-role with
* role-name “**”, isUserInRole
must only return true if
* the user has been authenticated; that is, only when
* {@link #getRemoteUser} and {@link #getUserPrincipal} would both return
* a non-null value. Otherwise, the container must check
* the user for membership in the application role.
*
* @param role a String
specifying the name
* of the role
*
* @return a boolean
indicating whether
* the user making this request belongs to a given role;
* false
if the user has not been
* authenticated
*/
boolean isUserInRole(String role);
/**
* 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
*/
java.security.Principal getUserPrincipal();
/**
* Returns the login of the user making this request, if the
* user has been authenticated, or null
if the user
* has not been authenticated.
* Whether the user name is sent with each subsequent request
* depends on the browser and type of authentication. Same as the
* value of the CGI variable REMOTE_USER.
*
* @return a String
specifying the login
* of the user making this request, or null
* if the user login is not known
*/
String getRemoteUser();
}