Class WorkerAuthController
java.lang.Object
it.univr.passportease.controller.worker.WorkerAuthController
Controller for worker authentication and registration. It handles the following GraphQL mutations:
The other mutations are handled by UserAuthController
as they are common to both users and workers.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprivate BucketLimiter
Bucket limiter.private final WorkerAuthService
Worker authentication service. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionloginWorker
(String username, String password) Logs in the worker with the given username and password.registerWorker
(WorkerInput workerInput) Deprecated.
-
Field Details
-
workerAuthService
Worker authentication service. -
bucketLimiter
Bucket limiter.
-
-
Constructor Details
-
WorkerAuthController
public WorkerAuthController()
-
-
Method Details
-
loginWorker
@MutationMapping public LoginOutput loginWorker(@Argument("username") String username, @Argument("password") String password) throws WorkerNotFoundException, WrongPasswordException, RateLimitException Logs in the worker with the given username and password.- Parameters:
username
- worker's usernamepassword
- worker's password- Returns:
LoginOutput
containing the access token and the refresh token- Throws:
WorkerNotFoundException
- if the worker is not foundWrongPasswordException
- if the password is wrongRateLimitException
- if the rate limit is exceeded
-
registerWorker
@MutationMapping @Deprecated(since="0.0.1") public LoginOutput registerWorker(@Argument("workerInput") WorkerInput workerInput) throws RateLimitException, OfficeNotFoundException Deprecated.UseloginWorker(String, String)
instead.The worker is automatically registered by a system administrator.- Parameters:
workerInput
-WorkerInput
containing the worker's data- Returns:
LoginOutput
containing the access token and the refresh token- Throws:
RateLimitException
- if the rate limit is exceededOfficeNotFoundException
- if the office is not found
-
loginWorker(String, String)
instead.