Class AuthController
java.lang.Object
it.polimi.ingsw.communication.sugar_framework.message_processing.SugarMessageProcessor
it.polimi.ingsw.server.controller.auth_controller.AuthController
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final io.github.cdimascio.dotenv.Dotenvfinal GamesManagerprivate static final Stringprivate static final SecretKeyprivate final UsersRepositoryInterface -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbase(SugarMessage message, Peer peer) static StringcreateFakeJWT(String username) static StringgetUsernameFromJWT(String jwt) Get username from the jwt claimsprivate booleanisLoggedIn(String jwt) Returns true if the jwt is correctly configured, it is not expired It doesn't check if the body of the jwt is correctloginMsg(SugarMessage message, Peer peer) signUpMsg(SugarMessage message, Peer peer) private static booleanMethods inherited from class it.polimi.ingsw.communication.sugar_framework.message_processing.SugarMessageProcessor
drop, process, process, processFromLowerLayers
-
Field Details
-
usersRepository
-
dotenv
private static final io.github.cdimascio.dotenv.Dotenv dotenv -
hashedKey
-
gamesManager
-
key
-
-
Constructor Details
-
AuthController
-
-
Method Details
-
stringNotValid
-
signUpMsg
-
loginMsg
-
isLoggedIn
Returns true if the jwt is correctly configured, it is not expired It doesn't check if the body of the jwt is correct- Parameters:
jwt- of the logged user
-
getUsernameFromJWT
Get username from the jwt claims- Parameters:
jwt- String of the encoded jwt- Returns:
- the username of the user logged in, null if there is no username claims
- Throws:
IllegalArgumentException- when you provide a malformed JWT, an encrypted jwt with the wrong key
-
createFakeJWT
-
base
-