Package org.vrspace.server.api
Class Users
java.lang.Object
org.vrspace.server.api.ApiBase
org.vrspace.server.api.ClientControllerBase
org.vrspace.server.api.Users
@RestController
@RequestMapping("/vrspace/api/user")
public class Users
extends ClientControllerBase
Basic user information. Users can't be created here yet, it's all automated
in Oauth2Controller for authenticated users, and WorldManager for guest
users.
- Author:
- joe
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.fasterxml.jackson.databind.ObjectMapper
static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
authenticated
(jakarta.servlet.http.HttpSession session) Check if the user is already authenticatedboolean
Verifies that user name is available: if user is not logged in, that there's no such user, or user's name in the database matches name in current session.org.springframework.http.ResponseEntity<Client>
Find user by name.userName
(jakarta.servlet.http.HttpSession session) Returns current user nameorg.springframework.http.ResponseEntity<String>
userObject
(jakarta.servlet.http.HttpSession session) Returns current user objectMethods inherited from class org.vrspace.server.api.ClientControllerBase
findClient, findClient, getAuthorisedClient, getAuthorisedClient, isAuthenticated
Methods inherited from class org.vrspace.server.api.ApiBase
currentUserName, isAuthenticated
-
Field Details
-
PATH
- See Also:
-
jackson
@Autowired @Qualifier("restPrivateMapper") protected com.fasterxml.jackson.databind.ObjectMapper jackson
-
-
Constructor Details
-
Users
public Users()
-
-
Method Details
-
checkName
@GetMapping("/available") public boolean checkName(String name, jakarta.servlet.http.HttpSession session) Verifies that user name is available: if user is not logged in, that there's no such user, or user's name in the database matches name in current session.- Parameters:
name
- user name to verifysession
- http session, automatically provided- Returns:
- true if user can log in with given name
-
authenticated
@GetMapping("/authenticated") public boolean authenticated(jakarta.servlet.http.HttpSession session) Check if the user is already authenticated- Parameters:
session
- http session, automatically provided- Returns:
- true if user is currently authenticated
-
userName
Returns current user name- Parameters:
session
-- Returns:
- authenticated user name, or null if user is not authenticated
-
userObject
@GetMapping("/object") public org.springframework.http.ResponseEntity<String> userObject(jakarta.servlet.http.HttpSession session) Returns current user object- Parameters:
session
-- Returns:
- current user object, or null if user is not authenticated, or not instance of User
-
find
@GetMapping("/find") @ResponseBody public org.springframework.http.ResponseEntity<Client> find(String name, jakarta.servlet.http.HttpSession session) Find user by name. Only available to users currently connected.- Parameters:
name
- User name, case sensitive, exact matchsession
-- Returns:
- Client object
-