- 60
- 23 743
Java Rush
Приєднався 16 тра 2023
Hi everyone!
I will be making free Programming Videos, mainly related to Java and related technologies. But, I will cover other technologies as well whenever required. You will find many useful and informative videos shortly. I will try to teach you whatever I can. I need your support and suggestions.
Please, like my videos and subscribe to the channel. That would be a great motivation for me to make more videos with improved quality.
I will be making free Programming Videos, mainly related to Java and related technologies. But, I will cover other technologies as well whenever required. You will find many useful and informative videos shortly. I will try to teach you whatever I can. I need your support and suggestions.
Please, like my videos and subscribe to the channel. That would be a great motivation for me to make more videos with improved quality.
🚢 Containerize Your Spring Boot App 🍃 with Buildpacks | No Dockerfile Needed! 🤔
Learn how to effortlessly create a Docker image for your Spring Boot application using Buildpacks - no Dockerfile required! In this step-by-step tutorial, we dive into the power of Buildpacks to simplify the containerization process for your Spring Boot applications. You'll also discover how Spring Boot automatically optimizes your Docker images using layered JARs, allowing for efficient caching and faster builds.
📌 Topics covered:
Understanding layered Docker images and layered JAR for optimal performance
Creating a Docker image for a Spring Boot app using Buildpacks without a Dockerfile
Best practices for Dockerizing Spring Boot applications
Update gradle / maven build system to configure creation of Docker image
By the end of this video, you'll have a fully containerized Spring Boot app with a lightweight, layered Docker image-ready for seamless deployment and quick updates!
Resources:
Blogs:
blog.javarush.dev/creating-docker-image-of-spring-boot-application-using-buildpacks
dev.to/himanshu-pareek/creating-docker-image-of-spring-boot-application-using-buildpacks-5dbo
Buildpacks: buildpacks.io/
Container Images - Spring Boot: docs.spring.io/spring-boot/reference/packaging/container-images/index.html
#spring #springboot #docker #buildpacks #gradle #maven #tutorial #coding #springboottutorial #container #layeredjar #layeredimage
📌 Topics covered:
Understanding layered Docker images and layered JAR for optimal performance
Creating a Docker image for a Spring Boot app using Buildpacks without a Dockerfile
Best practices for Dockerizing Spring Boot applications
Update gradle / maven build system to configure creation of Docker image
By the end of this video, you'll have a fully containerized Spring Boot app with a lightweight, layered Docker image-ready for seamless deployment and quick updates!
Resources:
Blogs:
blog.javarush.dev/creating-docker-image-of-spring-boot-application-using-buildpacks
dev.to/himanshu-pareek/creating-docker-image-of-spring-boot-application-using-buildpacks-5dbo
Buildpacks: buildpacks.io/
Container Images - Spring Boot: docs.spring.io/spring-boot/reference/packaging/container-images/index.html
#spring #springboot #docker #buildpacks #gradle #maven #tutorial #coding #springboottutorial #container #layeredjar #layeredimage
Переглядів: 91
Відео
OAuth2 Best Practices - Key Tips to implement OAuth2 Solutions
Переглядів 532 місяці тому
🔐 OAuth2 Best Practices | Secure Your API with These Essential Guidelines In this video, we dive into the key best practices for implementing OAuth2 securely. Whether you're a beginner or an experienced developer, these practical tips will help you improve the security and efficiency of your OAuth2 flows. From understanding different grant types to securing tokens and managing client secrets, t...
OpenID Connect: Everything You Need to Know + Spring Boot Implementation
Переглядів 3493 місяці тому
In this video, we dive deep into OpenID Connect, explaining what it is and why it’s essential for modern authentication. You’ll learn about ID tokens, including what information they carry and how they differ from other tokens in the OAuth2 framework. We’ll then move on to a hands-on implementation of OpenID Connect in an Authorization Server using Spring Boot. You’ll see how to create an ID to...
PKCE: Understand and Implement - Java + Spring Boot + JavaScript - Auth Server & OAuth2 Client
Переглядів 2583 місяці тому
Dive into the world of secure authorization with this comprehensive guide on the Proof Key for Code Exchange (PKCE) mechanism in OAuth2! 🚀 In this video, you'll learn: - What PKCE is and why it's crucial for OAuth2 security - Detailed explanations of the OAuth2 Authorization Grant flow with PKCE protection - Step-by-step implementation of PKCE in both an OAuth2 client and an OAuth2 Authorizatio...
Build a Resource Server from Scratch with Spring Boot: Step-by-Step Guide
Переглядів 3304 місяці тому
Welcome to my channel! In this video, I'll guide you through the process of creating a Resource Server from scratch using Spring Boot. Whether you're a beginner or looking to enhance your Spring Boot skills, this tutorial will provide you with a clear and comprehensive approach. We'll cover everything from setting up the project to implementing security features and testing the server. 📚 What Y...
Enable CORS in Authorization Server for Secure Access Tokens by Public Clients
Переглядів 744 місяці тому
In this video, I demonstrate how to enable Cross-Origin Resource Sharing (CORS) in your authorization server, allowing public clients to securely request and retrieve access tokens. Follow along as I guide you through the necessary updates to your server configuration, ensuring safe and efficient cross-origin requests. 🎯 What You'll Learn: Server Configuration: Step-by-step instructions to upda...
Mastering Access Tokens: Secure Implementation & Signing with Private Key using Spring & Java
Переглядів 805 місяців тому
🔐 Welcome to comprehensive guide on Access Tokens! In this video, we dive deep into the world of access tokens, exploring their purpose, generation, and secure implementation in an authorization server. You'll learn: What are access tokens and why they are crucial for API security Step-by-step guide to generating access tokens How to securely sign access tokens using a private key Creating and ...
All you need to know about access tokens...
Переглядів 655 місяців тому
Want to understand the mystery behind access tokens? In this video, we will deep dive into Access tokens. We will look at how the client application requests for it, how the authorization server generates them and how they are signed and sent back to client application. We will look how to generate access token as JWT (JSON Web Tokens). You can find the presentation here - docs.google.com/prese...
How to build Authorization Server? All about scopes - What the application can access?
Переглядів 1066 місяців тому
In this video, we continue building an authorization server from scratch using Spring Boot. We look at the definition and use of scopes. We also look at the flow of scopes and how to handle that at Authorization Server. We are not using any library to build it. We build everything from scratch. Find the below useful links: GitHub Repository - github.com/himanshu-pareek/OAuth2
How to Build Authorization Server? Handle allow auth request
Переглядів 1006 місяців тому
In this video, we continue building an authorization server from scratch using Spring Boot. When user clicks on Allow button on Authorization interface, authorization server needs to create an authorization code, encrypt it, encode it and send it back to the client application in query parameters of redirect uri along with state parameter. We are not using any library to build it. We build ever...
How to Build Authorization Server? Handle deny auth request
Переглядів 406 місяців тому
In this video, we continue building an authorization server from scratch using Spring Boot. When user clicks on Deny button on Authorization interface, authorization server needs to tell the Client Application that the user has denied the authorization request. We redirects the user to sign in redirect uri with error code and error description in that case. We are not using any library to build...
How to Build Authorization Server? Handling Login Request and Displaying Authorization Interface
Переглядів 876 місяців тому
In this video, we continue building an authorization server from scratch using Spring Boot. We handle login request. If the user provides correct username and password, we present the user with authorization interface, where the user can see the details of client and the permissions the client application is asking for. We are not using any library to build it. We build everything from scratch....
How to Build Authorization Server? Handling Auth Request and Displaying Login Page to the User
Переглядів 1376 місяців тому
In this video, we continue building an authorization server from scratch using Spring Boot. We handle and validate Authorization Request. If the request is invalid, we either show the error or redirect the used to redirect uri with the error depending on the type of error. If the request is valid, we present the user with login form. We are not using any library to build it. We build everything...
How to build an authorization server from scratch using Spring Boot - Realms, Clients and Secrets
Переглядів 3518 місяців тому
In this video, we will start building an authorization server from scratch using Spring Boot. We will cover creating Realms, Registering new Client and Generating Client Secrets in this video. We are not using any library to build it. We build everything from scratch. Find the below useful links: GitHub Repository - github.com/himanshu-pareek/OAuth2 SecureRandom - docs.oracle.com/javase/8/docs/...
Building a Public OAuth2 Client - Single Page Application using Javascript and Keycloak
Переглядів 1718 місяців тому
In this video, we develop a OAuth2 client application (Single Page Application) using Javascript. We will use Keycloak as authorization server. We are not using any library to build it. We build everything from scratch. Find the below useful links: GitHub Repository - github.com/himanshu-pareek/OAuth2 Keycloak - www.keycloak.org/ 00:00 Introduction 01:17 Registering Public OAuth2 Client 09:34 R...
Building a Confidential (Server Rendered) OAuth2 Client Application using Spring Boot
Переглядів 2409 місяців тому
Building a Confidential (Server Rendered) OAuth2 Client Application using Spring Boot
Introduction to Confidential (Server Rendered) OAuth2 Client Applications - Authorization Code Grant
Переглядів 1259 місяців тому
Introduction to Confidential (Server Rendered) OAuth2 Client Applications - Authorization Code Grant
Introduction to OAuth 2 - What, Why and How?
Переглядів 2209 місяців тому
Introduction to OAuth 2 - What, Why and How?
Create a Todo App using Spring Boot + HTMX + Thymeleaf + MySQL + Bootstrap
Переглядів 7259 місяців тому
Create a Todo App using Spring Boot HTMX Thymeleaf MySQL Bootstrap
Logout from OAuth2 Client Server - Local Logout and OIDC Provider Logout
Переглядів 44810 місяців тому
Logout from OAuth2 Client Server - Local Logout and OIDC Provider Logout
Replying to some comments related to Spring Security, Angular, OAuth2, Logout, CSRF Token, Session
Переглядів 9510 місяців тому
Replying to some comments related to Spring Security, Angular, OAuth2, Logout, CSRF Token, Session
Spring Core - Episode 19 - Publishing and Receiving Events using EventPublisher and @EventListener
Переглядів 4910 місяців тому
Spring Core - Episode 19 - Publishing and Receiving Events using EventPublisher and @EventListener
Spring Framework Core - Episode 18 - Internationalization (i18n) using MessageSource
Переглядів 9510 місяців тому
Spring Framework Core - Episode 18 - Internationalization (i18n) using MessageSource
Spring Framework Core - Episode 17 - Environment - Profiles & Properties - @Profile @PropertySource
Переглядів 6310 місяців тому
Spring Framework Core - Episode 17 - Environment - Profiles & Properties - @Profile @PropertySource
Spring Framework Core - Episode 16 - Composing Java Based Configuration - @Import annotation
Переглядів 15310 місяців тому
Spring Framework Core - Episode 16 - Composing Java Based Configuration - @Import annotation
Spring Framework Core - Episode 15 - @Configuration and @Bean annotations
Переглядів 4211 місяців тому
Spring Framework Core - Episode 15 - @Configuration and @Bean annotations
Spring Framework Core - Episode 14 - @ComponentScan, @Component, @Service, @Repository
Переглядів 4811 місяців тому
Spring Framework Core - Episode 14 - @ComponentScan, @Component, @Service, @Repository
Spring Framework Core - Episode 13 - @Value, @PostConstruct and @PreDestroy annotations
Переглядів 83Рік тому
Spring Framework Core - Episode 13 - @Value, @PostConstruct and @PreDestroy annotations
Spring Framework Core - Episode 12 - Bean Qualifiers - @Qualifier annotation and qualifier tag
Переглядів 21Рік тому
Spring Framework Core - Episode 12 - Bean Qualifiers - @Qualifier annotation and qualifier tag
whats the name of the IDE theme?
This is Codely Blue theme - plugins.jetbrains.com/plugin/12891-codely-theme
I am unable to connect to client app, I have implemented the same code provided in the video, but still face the below error when I enter username and password "Login with OAuth 2.0 [authorization_request_not_found] Login With Spring Provider" Please help me with a solution.
Hi Bro, I am getting same error. kindly help us
@RajeshR-u8t @selvalakshmi5074 Can you try to open the client at url 127.0.0.1 instead of localhost. This may be the issue related to cookies.
Let me know if above solution works or not for you guys. Meanwhile, I will also try to reproduce the issue.
Almost same concept have used in my application but it's implemented in spring boot backend with angularjs frontend. I got the challenge to migrate to angular18 latest version. Thank you for your video. It will help me a lot. I have other files like gulpfile.js, bower.json configuration files. You have very good ideas in frontend with backend, if you could help me some part of my project, I would be very grateful.
Hi @deepakbal841. I am glad you liked the video. You can contact me on Linkedin. The profile link is in channel description.
Hi. Thanks for your videos. I need some help. I cannot get the "code" in the callback. window.location.search is empty. // 2. Retrieve state and code from query parameters in redirect uri const query = new URLSearchParams(window.location.search); const code = query.get('code'); const state = query.get('state'); 1. localhost:8180/realms/eazybankdev/protocol/openid-connect/auth?client_id=eazybankjavascriptclient&response_type=code&state=ZUF7PcfjqV2ng6f4&redirect_uri=127.0.0.1:5500/oauth/callback&scope=openid%20email%20profile&code_challenge=o827NdXQ3j11TiA2B82pe3xZdxJeVl8mJm5OrLAypEE&code_challenge_method=S256 2. 127.0.0.1:5500/oauth/callback?state=ZUF7PcfjqV2ng6f4&session_state=a4091866-cedc-4afe-a061-bcf18858220d&iss=http%3A%2F%2Flocalhost%3A8180%2Frealms%2Feazybankdev&code=49f65e88-486d-4cbc-a30c-15c973369927.a4091866-cedc-4afe-a061-bcf18858220d.45b2c0fb-7a71-48d1-a707-fdb32b86358c 3. 127.0.0.1:5500/oauth/callback/ Why cannot get the code from the 2.?
I have implemented Azure ad in spring cloud gateway as mentioned in this video, I'm able to authenticate and getting oauth2 code in browser inspect, but after authentication it is redirecting to too many times , not sure why it's happening, can you please help ?
Can you mention the steps you took to integrate it and what is happening. Also, it would be helpful if you could provide some code to see what you are doing. If not, provide some dummy code.
Can you please provide your emailid, so that I can provide more information
You can message me on LinkedIn. You can find the LinkedIn link in description.
We have azure ad oauth2 registered in azure portal, i want to implement client gateway, resource server, my question is do we really need to create Authorization server separately as we already have axure ad credentials like clientid and client-secret etc.. Can we directly interact with azure ad from client gateway ?
Yes, you can directly interact with azure I'd from client gateway. You don't need to create another Authorization Server. Azure ID will act as Authorization Server in this case. I hope this answers your question.
Thanks 👍
Can you use same code for Azure ad SSO oauth2 server ?
You can connect client directly with Azure Id. You don't need another Authorization Server.
Thanks for your great knowledge, In the ending you mentioned like we will create a client using spring boot.. can you please provide the video link of that
ua-cam.com/video/9PY_Z5h16Js/v-deo.html
Do you know, how to customize this default page for confirmation logout?
You can create your own Logout Confirmation page / modal. And, on clicking on "Confirm Logout" button, just send a POST /logout request.
Bro you are the best! for real
Thank you for your kind words.
HI, I am getting 400 error for "/oauth2/authorize" I did all the configuration. Can you please tell me why?
You can do following: Find the port where your authorization server is running. Let's say it is running on port 8081. You you need to find the authorization endpoint. You can do so by visiting URL localhost:8081/.well-known/openid-configuration. You will see Authorize endpoint, use that.
does it only works on forms ?
No, CSRF token is required for all POST/PUT... requests, if you have not disabled csrf token on server side. Generally, in api server developers disable csrf, since api servers are accessed by all type of clients (not only browsers).
video is blurred
No, it is not. Try increasing the resolution of the video.
Hii ,is password grant type supported in spring boot 3 version?
The OAuth 2.0 Client dependency is used in Spring applications to make OAuth client which supports Resource Owner Password Credentials grant type. If you want to use it, the Authorization Server should also support it. But it is highly recommended not to use this grant type. I hope that helps. docs.spring.io/spring-security/reference/reactive/oauth2/client/index.html
@@java-rush thank you for your reply. I have one more doubt in spring boot 3.2.1 version oauth2 token store is removed right? Is their any replacement of that token store?
Will it build to native image?
@007arek It should. I have not tested that. You can give it a try.
@Configuration @EnableWebSecurity public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter { /*@Autowired private CustomAuthenticationProvider authProvider; @Bean protected AuthenticationManager getAuthenticationManager() throws Exception { return super.authenticationManagerBean(); } @Bean PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); } @Override protected void configure(AuthenticationManagerBuilder auth) { auth.authenticationProvider(authProvider); } @Override public void configure(WebSecurity web) throws Exception { web.ignoring().antMatchers(HttpMethod.OPTIONS, "/**").antMatchers("/api/v1/forgotpassword", "/api/v1/otp", "/api/v1/login/token", "/api/v1/login/authorize", "/api/v1/credentials/token", "/api/v1/vpa/token", "/api/v1/redirect", "/api/v1/logout", "/api/v1/authorize/open","/api/v1/authorization/token", "/vpa/authorize", "/assetlinks.json","/apple-app-site-association");//"/api/v1/vpa/code", } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/oauth/**").authenticated().and().httpBasic(); http.csrf().disable(); } }*/ Can you help me above code in spring 3 version
Is @enableauthorizationserver and @enableresourceerver annotations are working or not in spring 3 version?
@jyothimammula9154 You don't need these annotations any more. They are enabled by default whenever we have the corresponding dependencies.
@@java-rush what dependecies are used?
@@jyothimammula9154 For OAuth2Client, we need spring-boot-starter-oauth2-client dependency. For OAuth2Resource Server, we need spring-boot-starter-oauth2-resource-server dependency. For OAuth2 Authorization Server, we need spring-boot-starter-oauth2-authorization-server dependency. While creating the project using spring initializer website, you can specify OAuth2 Client, OAuth2 Resource or OAuth2 Authorization Server dependencies.
@@java-rush spring cloud starter oauth2 dependecy is changing in spring 3 version?
@@jyothimammula9154 I am using Spring Boot version 3. If need help setting up the project, you can watch the playlist from beginning or from whatever video you want. From the beginning, I am using Spring Boot 3.1 or 3.2.
please create the codes for production-ready because while implementing the code for production it is showing error.
when logout . should I delete csrf token and sessionId on client or server ?
I have replied to your commend in this video - ua-cam.com/video/EUyUJQKxlK4/v-deo.htmlsi=yc8jq14g3Tsy0vJC Also checkout this video to understand OIDC logout - ua-cam.com/video/3ucYJaMAgzQ/v-deo.htmlsi=gt6BY3hlFug3B1c8
Thanks Himanshu for nice explanation. In this architecture of authorization server, resource server and client server (with angular app within it); is it not possible to have angular application running outside of client server on a separate port, let's say 4200?
@aashiyana618 Yes, it is possible. You can have a standalone Angular Application which interacts directly with Authorization Server and Resource Server. But, don't store sensitive information in angular application, like - client secret or anything.
Thanks for the video. Can you provide real time example of postconstruct and predestroy annotations
I found that you got really good understand and knowledge on maven and shell scripting so can you please create separate videos just to cover maven and shell scripting.
Hello and great cours! I have one question, how can i extract custom claims from ressource server. Thanks!
Вроде бы английский, но не понятно ни хрена
I have 3 microservices A,B,C and 1 gateway i want implement security to gateway after successfull authentication it route the request to other services like service A, in service A i have implemented role based REST end points now my question is how the service A perform authentication and authorization. and again i want to request for data from service A to service B, in service B i want to validate the incoming request and perform operations based on user role. how to implement this i want to know how the real world and it companies implement this. if you clarify this it will be helpful to me to learn. and -> you will get 20 Subscribers.
Thanks for watching the video. That's a good use case. I will try to make a video around it.
@@java-rush Thanks for the reply. can you just tell me how to implement this ?
@memsofgamers9479 First of all, in authorization server, you can create custom claims. Each Identity Provider has different ways to do it. I have not used Spring Authorization Server much, so I don't know how to do that with it. But, if you use something like Okta, there you can add additional properties in claims, like role. Then that claim will be available in the access token. In Spring Security Context, you can access that using JwtAuthenticationToken. @PreAuthorize("#token.tokenAttributes.get('role') == 'Admin'") public Map<String, String> postHello( JwtAuthenticationToken token ) { In the above code snippet, the method postHello will be invoked only if the access token has "Admin" as the value of claim "role". Or you can throw custom exception using java code as well. Again, how to set the role claim in token(s) depends on the Identity Provider you are using. For that, you can refer to the documentation of the corresponding provider. Let me know if it helps or if you want to know something else.
@java-rush - I want to use same for the Rest API, Please explain what is authorization server & resource configuration.
Can you explain the question in more details. It is not clear to me.
Thank you for the video, it pointed me in the right direction to solve my issue 🙌
You're welcome! What was the issue you were facing btw?
@@java-rush aha good question :D I was following an older tutorial on Spring Security and was trying to learn by upgrading it as I went along.. The tutorial was using the old WebSecurityConfigurerAdapter so I was learning by setting up the SecurityFilterChain. The problem was that the frontend was not receiving a CSRF token from the backend, which was caused by the updates in Spring Security 6 (You point this out at around 7:14 in the video). I'm new to the Java + Spring world so i'm missing a lot of context :) In any case you completely solved the problem 🙌 Thanks again!
Hi, i have a question, how we have logout session, or implementation of logout authorization server, because JSESSIONID still present in chrome after calling /revoke api
I will try to create a video regarding this.
Awesome video! I learned a lot, thank you for sharing!
Thank you. I am glad you liked it.
Is a little hard to understand what you are talking because you talk too much close from microphone but you content still fire, thanks for the content. Leaving my like .
Noted. I am using headphone to record the videos. I am planning to get a microphone. If you can suggest good device (microphone or anything), that would be great. I am glad you like the content.
Its great explanation..can you please explain Authorization code PKCE how its works.
I will create a video related to that for sure.
Great Video! Explained very well
Glad it was helpful!
If I have 2 client's application. I try to get access to client1 , redirect to authorization server , get succesful authentication for client 1. And next from browser I try to get access to client2 link , and getting successful result without authentication process. My tocen from client1 is vallid for client2. How to avoid this behavior ?
That will happen. Since the Authorization Server is same for both clients and you are already logged in to the Authorization Server, next time when you ask for Authorization Code, the Authorization Server uses the session and gives the Authorization Code back. But these codes are different for both clients and when the clients ask for access token using corresponding client secrets and Authorization Code, that will be different as well. This is the expected behaviour as well. For example, when you try to login to any website using Google account you don't login again and again to Google for different applications. But the code you get will be different for each application. I hope this helps. Let me know.
how to logout this session from angular, or logout from angular
Getting 404 error while using through postman { "timestamp": "2023-07-26T10:52:27.769+00:00", "status": 404, "error": "Not Found", "path": "/oauth2/authorize" } but in web browser it works fine
It should have worked. I just tried it. My auth server is running on port 8083 and I tried this URL in postman - localhost:8083/oauth2/authorize. You will get an HTML response. Make sure the url is correct in postman (check the port specifically). Let me know whether it works or not.
👍
Thanks for the support.