
Build an authentication app with Java and Angular, including registration, login with two-factor authentication and Google sign-in, token-based sessions, and password reset via email.
Build an authorization authentication API in Java with the Spring framework, configured via start.spring.io using Maven and Spring Boot 2.6.4, including Spring Web, data, H2, Spring Security, mail, and Lombok.
Build the user table and a spring schema file to define the database, then configure the h2 data source and set server port to 8000.
Map a database table to a Java user entity using Lombok for getters and setters, a private constructor with a factory method, and Spring Data id and persistence constructor annotations.
Create a user repository interface, annotated as a repository, extending CrudRepository for the User entity with a long key, and enable JPA repositories in the main class.
Create a rest controller for /api, map get /hello to a hello method returning a string, then disable spring security with a security config to permit all requests.
Create a spring registration endpoint with a post mapping to register new users, returning the created user via a request body and user repository; disable csrf for jwt authentication.
Use Java records as data transfer objects to separate request and response payloads, mapping with JSON properties and underscores for the API, while keeping passwords out of responses.
Learn how to raise a response status exception with a bad request when passwords do not match, add validation, and handle exceptions in Spring MVC with clear error messages.
Refactor the authentication flow by relocating validation into a dedicated service layer in Spring MVC, organizing data, repository, and service packages, and implementing register logic with request/response models.
Implement a password encoder bean in spring security to encode passwords before saving, ensuring stored hashes can't reveal the original password.
Implement a login endpoint with a post mapping, using distinct login request and login response records, and verify credentials by finding the user by email and comparing encoded passwords.
Implement and handle a unique email constraint to prevent duplicate users, create centralized error classes (email already exists, invalid credentials) and map them to proper http responses.
Implement JWT based authentication by adding JWT dependencies, creating a token class, issuing tokens with user id and expiration, and validating signatures using a base64 encoded secret.
Configure cross-origin resource sharing in spring to permit front-end apps from different origins. Define allowed origins and methods via application properties, enabling localhost:4200 and 8080 to load resources.
Define a logging class with access and refresh tokens, configure access and refresh secrets, and return access token while setting a refresh token cookie during login.
Implement a spring interceptor that validates bearer jwt tokens to identify the authenticated user and secure endpoints using a token-based authentication flow.
Create a get endpoint to fetch the authenticated user, using an interceptor to retrieve the user from the request and return id, first name, last name, and email.
Implement a refresh token flow using a Spring post mapping and a cookie named refresh token to issue a new access token in the refresh response.
Implement a logout endpoint in this Java and Angular course by deleting the refresh token cookie with a zero max age and returning a logout response.
Model a token entity and a tokens table linked to users to track refresh tokens. Implement add, remove, and filter operations and map tokens to a JWT representation.
Implement revoking tokens through a logout flow and refresh token handling, using repository and service changes, including manual query fixes and unauthenticated error handling.
Build a forgot password endpoint by creating a password recovery table linked to the user via a foreign key, and implement a PasswordRecovery token in Java.
Implement a forgot password flow by capturing the user email, generating and storing a password recovery token, and sending a reset link using the origin url.
Implement a Spring email service to send forgot password reset emails using Java mail sender and configured properties. Configure a reset link with a token and test sending with MailHog.
Implement a password reset flow using a token, validating password and confirmation, encoding the new password, clearing password recovery tokens, and handling invalid links for secure resets.
Create a new Angular project with routing, run the dev server on port 4200, and integrate bootstrap by updating the sign-in form and applying global styling to the up component.
Generate login, register, and home components in a pages folder; angular updates declarations automatically. Build and connect forms with email, password, first name, and last name fields for authentication flows.
Build header navigation in an angular app using bootstrap, router-outlet, and router-link to switch between home, login, and register components.
Use Angular reactive forms to build a registration form; import module and form builder, create a form group with first name, last name, email, password, and connect controls with formControlName.
Send a post request to the register endpoint via an Angular service and the http client, passing reactive form values and navigating to the log in page after success.
Implement a login flow with email and password, post credentials, navigate to the homepage on success, and handle access and refresh tokens from the response stored in a service.
Implement interceptors to attach the access token as a bearer header for every request, enabling the authenticated user data in the home component. Handle unauthorized errors and wire in providers.
Master refresh token workflow in Angular by intercepting 401 errors, calling the refresh endpoint with credentials, updating the access token, and retrying the original request.
Learn to implement a logout flow with refresh tokens, manage authentication state, and prevent infinite refresh loops by guarding with a refresh flag, while clearing tokens.
Learn to use a static event emitter to propagate authentication state across components, emitting true or false on login and logout, and subscribe in navigation to update the UI.
Create a forgot password flow by linking the login component to a forgot route, posting the email to api/forgot via a forgot service, then show success or error alerts.
The lecture shows a reset password flow: build a reset component, extract the token from the URL, send the token with the reset request, and navigate to login on success.
Implement multi-factor authentication by updating the user table with an OTP secret, incorporating an OTP URL in login responses, and generating base32 encoded secrets with Guava.
Implement a two-factor authentication endpoint to validate the provided id, secret, and code, and return a token upon successful authentication.
Refactor the login component to support two forms—normal login and the health indicator form—for two-factor authentication, using an output event emitter to pass backend responses and a QR code.
Implement a two-factor authentication flow by collecting a six-digit code, displaying a QR code, posting to the factor endpoint for a token, and navigating to the main page.
Implement Google authentication in a Spring and Angular app by configuring Google credentials, verifying Google ID tokens, and creating or linking users with token-based login.
Implement Google sign-in in an Angular app using the angular ex social login package. Configure the Google client id, add a login button, and handle token authentication with the backend.
Welcome to this course where you will learn everything you need to know to secure your Angular and Spring Boot app.
In Java you will learn:
Use Spring Boot Framework
Connect Spring Boot with H2 Database
Use Access & Refresh Tokens
Use HttpOnly Cookies
Send Emails
Login using 2 Factor Authentication (2FA) with Google Authenticator
Social Authentication using your Google Account
In Angular you will learn:
Use Angular CLI
Create components and routes
Consume API calls
Use Event Emitters
Create QRCodes
Social Authentication using your Google Account
If these are what you are looking for then this course is for you.
I'm a FullStack Developer with 10+ years of experience. I'm obsessed with clean code and I try my best that my courses have the cleanest code possible.
My teaching style is very straightforward, I will not waste too much time explaining all the ways you can create something or other unnecessary information to increase the length of my lectures. If you want to learn things rapidly then this course is for you.
If you have any coding problems I will offer my support within 12 hours when you post the question. I'm very active when trying to help my students.
So what are you waiting for, give this course a try and you won't get disappointed.