Skip to content

Authentication and Authorization#2

Open
tumilok wants to merge 62 commits intomasterfrom
auth
Open

Authentication and Authorization#2
tumilok wants to merge 62 commits intomasterfrom
auth

Conversation

@tumilok
Copy link
Owner

@tumilok tumilok commented Dec 25, 2020

This pull request will be merged as soon as the whole authentication part would be finished.

Uladzislau Tumilovich added 14 commits December 25, 2020 15:12
Added TestController class which would help in a further development of
the app.
In order to send notification emails faster.
Implemented signup and sendMail controllers.
Overrode the standart implementation of spring boot security.
Implemented AuthService with saving new users to the database. Added
MailService and MailContentBuilder which are responsible for sending
the activation mail to the user after registration.
@tumilok
Copy link
Owner Author

tumilok commented Dec 26, 2020

Registration is ready

Uladzislau Tumilovich added 8 commits December 26, 2020 13:31
Login method returns AuthenticationResponse which is provided by login method of AuthService.
.his class represents data of client login request.
This class represents data which server sends to the client after login.
LoadUserByUsername method was implemented using email as username and only with one 'USER' role. Moreover getAuthorities method was implemented which provides us with a singleton list of given role.
Authenticates user and then sends a JWT token with email as response.
This class is responsible for the generation of a new token.
@tumilok
Copy link
Owner Author

tumilok commented Dec 26, 2020

Sends JWT token as a response for user login request

Uladzislau Tumilovich added 6 commits December 26, 2020 19:07
Changed test api permissions. Added JWT Authentication Filter
Overrode doFilterInternal method so unauthorized users couldn't reach api without bearer token. Implemented getJwtFromRequest method which return bearer token from the client request.
Implemented validateToken method responsible for a token validation. This method uses getPublicKey method which provides public key. Moreover getUsernameFromJwt method was implemented in order to be able to extract username from the token.
Added roles and operations to the database. Added Builder annotation to all the model classes. Added createDateTime and UpdateDateTime fields to some models. Implement dependencies from the second side. Introduced small code refactoring.
Uladzislau Tumilovich added 4 commits December 27, 2020 03:57
Introduced UserDetailsImpl class to the loadUserByUsername method and removed getAuthorities method.
I did it because during authentication Role was looping with User model.
Add pre authorization for all the apis accordingly to its names.
@tumilok tumilok changed the title Authentication Authentication and Authorization Dec 27, 2020
@tumilok
Copy link
Owner Author

tumilok commented Dec 27, 2020

Authorization is ready

@tumilok
Copy link
Owner Author

tumilok commented Dec 27, 2020

Introduce some small changes. Fix some bugs. Remove deprecated code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants