Fantasy project is an data store for game locations and characters. It is realized as JavaEE application deployable on Wildfly server.
Core of the project. Contains database connection and models. This module serves his functionality as EJB remote beans.
- data persistence
- authorization
- writing to JMS Topic
Example EJB lookup:
private static UserRepository lookupUserRepository() throws NamingException {
final Hashtable jndiProperties = new Hashtable();
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
jndiProperties.put(Context.PROVIDER_URL,"http-remoting://localhost:8080");
final Context ctx = new InitialContext(jndiProperties);
return (UserRepository) ctx
.lookup("ejb:/fantasy-beans-1.0-SNAPSHOT/UserRepositoryBean!" + UserRepository.class.getName());
}
Web layer. Provides authentication and REST services.
- authentication
- REST endpoints
- consuming JMS messages
Example REST call:
GET localhost:8080/categoryDefinitions
Accept: application/json
Authorization: {{token}}
This module contains some of the fantasy-beans functionality as SOAP services.
WSDL is located in http://localhost:8080/soap/CategoryDefinitionService?wsdl
JavaSE console application for new user registration.
Example SOAP client as Python script.
Users in web layer are authenticated by JWT tokens. It contains userId
and role
.
Every request must contains JWT token in Authorization
header.
User can use only one token - cannot have multiple sessions.
User can have two roles: USER
or ADMIN
. Every category must belong to exactly one user.
Everyone can get all elements and all categories. Given category and all elements that belongs to it can be modified only by owner or user with ADMIN
role.