₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,330,959 members, 8,447,958 topics. Date: Sunday, 19 July 2026 at 12:00 PM

Toggle theme

Richebony's Posts

Nairaland ForumRichebony's ProfileRichebony's Posts

1 2 3 (of 3 pages)

ProgrammingRe: Created And Deployed My First Express Js Website. by richebony: 5:27pm On Jun 20, 2024
Great work!!!
BusinessRe: NIMC Clears Over 2.5m Backlog Of NIN Modification – DG by richebony: 12:50pm On Nov 10, 2023
Their servers have been down for over a month now ...so what are they even saying
ProgrammingRe: Immersive 3D Art Gallery (Three.js) by richebony: 5:27pm On Sep 30, 2023
stankelz:
Thanks man.

Threejs Journey by Bruno Simon
So you paid the $100 fee? Because I haven't been able to access a free upload. If you did ..Kudos
ProgrammingRe: Immersive 3D Art Gallery (Three.js) by richebony: 11:24am On Sep 28, 2023
This is really nice .Hope u dont mind my asking , whats the name of the course ?
ProgrammingRe: Java Spring Boot Needed Urgently by richebony: 5:09pm On Sep 25, 2023
InteliJ:
Hello there,

I'm not a pro yet, but I believe I would valuable to you.

You don't have to pay me too...Thanks

Looking forward to working with you.
Nice one bro ...I really wish u all the best
ProgrammingRe: Please Help, @requestparam(required=false) Not Working by richebony: 4:57pm On Sep 15, 2023
From the stack trace your error seems to be coming from the productService class and the updateProduct method, seems you are trying to unbox a Double to its primitive value when it is apparently null ...

What is the code snippet in line 86 of your ProductService?

Apparently, you can make a null check before that line

if(weight!=null) {
//Perform business logic
}
ProgrammingRe: Please Help, @requestparam(required=false) Not Working by richebony: 10:56pm On Sep 13, 2023
InteliJ:
If I get your question right. The code is working, no exception is thrown in the terminal. The issue is that all parameters must be used. Or else, I get an internal server error in postman. Despite the fact that I set all requestparams required to false
yea, iits not supposed to act like that, that's why I asked what the class of the exception being thrown is , if it's an IllegalStateException then the error must have been thrown from the service layer and propagated to the controller class
ProgrammingRe: Please Help, @requestparam(required=false) Not Working by richebony: 9:53pm On Sep 12, 2023
What is the class of the exception being thrown

And besides why dont you place all those request params asides the id inside the request body wrapped around a dto
ProgrammingRe: Google Oauth With Spring Boot Security by richebony: 2:14pm On Sep 10, 2023
BurnerMan:
Thanks bro, but i understand this flow but it doesn't fit into the context of what i am trying to do. Maybe I should give a bit more background on what I'm trying to do..

So I had custom configurations for some of the filters in the securityFilterChain. I customized the AuthenticationFilter(UsernamePasswordFilter), the authenticationManager, and an AuthenticationProvider - which loads the user from the database, dao stuff.

Now, what I want to do configure another authenticationProvider that implements OpenID connect, and then add this to the authenticatonManager. I have searched spring docs but they don't seem to provide a flow for that. So that's what im struggling with bro.

I hope you understand what I am saying boss?
So what you are saying is that you want a customOAuth2 service

you would need to add these properties
spring.security.oauth2.client.provider.google.authorization-uri=
spring.security.oauth2.client.provider.google.token-uri =
spring.security.oauth2.client.provider.google.user-info-uri=
spring.security.oauth2.client.provider.google.user-name-attribute= email

add this dependency


<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-jose</artifactId>
</dependency>



create a customOauth2UserService


import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Service
@RequiredArgsConstructor
public class CustomOAuth2UserService implements OAuth2UserService<OAuth2UserRequest, OAuth2User> {

@Value("${spring.security.oauth2.client.provider.google.user-info-uri}"wink
private String userInfoUri;

private final RestTemplate restTemplate;

@Override
public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2AuthenticationException {
String accessToken = userRequest.getAccessToken().getTokenValue();

GoogleUserInfo userInfo = restTemplate.getForObject(userInfoUri, GoogleUserInfo.class, accessToken);

if (userInfo == null) {
throw new UsernameNotFoundException("User not found"wink;
}
Map<String, Object> attributes = new HashMap<>();
attributes.put("email", userInfo.getEmail());
attributes.put("name", userInfo.getName());

return new DefaultOAuth2User(
Collections.singleton(new OAuth2UserAuthority(attributes)),
attributes, "email"wink;
}
}


create your customAuth2Provider




@Component
@RequiredArgsConstructor
public class CustomOAuth2AuthenticationProvider implements AuthenticationProvider {

private final CustomOAuth2UserService customOAuth2UserService;

@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
OAuth2User oauth2User = (OAuth2User) authentication.getPrincipal();

UserDetails userDetails = customOAuth2UserService.loadUser(oauth2User.getRequest());
return new UsernamePasswordAuthenticationToken(
userDetails, null, userDetails.getAuthorities());
}

@Override
public boolean supports(Class<?> authentication) {
return OAuth2UserAuthenticationToken.class.isAssignableFrom(authentication);
}
}







@Configuration
@RequiredArgsConstructor
public class SecurityConfig {

private final CustomOAuth2AuthenticationProvider customOAuth2AuthenticationProvider;

@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception {
return httpSecurity.authorizeHttpRequests(auth ->
auth.requestMatchers("/"wink.permitAll()
.anyRequest().authenticated())
.oauth2Login((oauth2Login) -> oauth2Login
.userInfoEndpoint((userInfo) -> userInfo.userService(customOAuth2UserService)) // this is authoInjected with the provider
// you can also configure the login uri/page here
)
.formLogin(Customizer.withDefaults())
.build();
}
}
PS : The code might not work ,didnt test it ...i am actually wondering why you chose this approach,you can run test cases on the service layer ,if that works, then extra configuration tweaking might fix it
ProgrammingRe: Google Oauth With Spring Boot Security by richebony: 8:44am On Sep 10, 2023
InteliJ:
Hello richebony, I've been learning spring security on youtube but most tutorials I've watched are not explanatory enough.

It always look like they're doing magic, some are oudated especially implementing basic auth, the way to do this as shown in the tutorials is depreciated. If you don't mind, could you please recommend a good spring security video you know? Thank you.

I see that you're good with this stuff, could you please mentor me? I need some guidance as this whole stuff is broad and I don't want to go the wrong way.

I promise not to waste your time or stress you. Thank you!
Lol, you are not alone in this, I also had this issue, especially with the introduction of Spring Security 6, it made most of my prior knowledge deprecated, I would recommend Dan Vega's Spring Security course on YouTube, he works with the Spring team and gets most of his resources directly from the docs .So just search for his channel on YouTube [Dan Vega]..if you have any questions u can holla
ProgrammingRe: Google Oauth With Spring Boot Security by richebony: 9:00pm On Sep 09, 2023
you need this dependency in your maven pom


dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-client</artifactId>
</dependency>




in your applications.properties add these

#GOOGLE OAUTH

# You need additional settings to configure your OAUTH service ..just check youtube
spring.security.oauth2.client.registration.google.client-id= your-client-id
spring.security.oauth2.client.registration.google.client-secret=your-secret



in your SecurityConfig class


@Configuration
public class SecurityConfig {

@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception {
return httpSecurity.authorizeHttpRequests(auth ->
auth.requestMatchers("/"wink.permitAll()
.anyRequest().authenticated())
.oauth2Login(Customizer.withDefaults())
.formLogin(Customizer.withDefaults()) // u can replace this with httpBasic and configure the URL
.build();
}
}
ProgrammingRe: How Do They Verify? by richebony: 3:44pm On Sep 02, 2023
most don't give two bleeps though ,esp if you are working as an IC
ProgrammingRe: What Advice Would You Give To Someone Who Wants to Start Learning JAVA by richebony: 7:21pm On Aug 30, 2023
I think what sets reactive libraries like quarkus, vert.x, and webflux apart, is the fact that they are nonblocking [asynchronous]. Spring boot applications use an embedded Tomcat server which spins a new thread from your thread pool on each concurrent request [Thread per request model ], The number of threads that can be spawned is finite and when they are all in a busy state, any further request would be blocked pending the completion of the other threads, creating idle time, introducing latency, memory overhead. if you are familiar with the nodejs runtime, reactive libraries employ the same approach, I think webflux and vert.x uses Netty [i don't really know about the internal workings].
ProgrammingRe: Why Most Of 9ja Programmers Are Broke by richebony: 2:19pm On Aug 24, 2023
omor! people dey talk oh
ProgrammingRe: Why Is This Try Catch Not Working by richebony: 12:23am On Aug 21, 2023
chukwuebuka65:
This worked. But why ?
I think I explained in the preceding text, the setTimeout function is asynchronous and isn't a native js function, and your callback function is invoked on a different execution context because its the libuv [c++] APIs that nodejs delegates the timer function to. So your try-catch block isn't bound to your callback function because it exists in a different execution context
ProgrammingRe: Why Is This Try Catch Not Working by richebony: 10:34pm On Aug 20, 2023
I think set timeout() is asynchronous and registers an event that is handled by the libuv . Place another try-catch inside your setTimeout async block
ProgrammingRe: What Advice Would You Give To Someone Who Wants to Start Learning JAVA by richebony: 3:33pm On Aug 16, 2023
The learning curve is pretty steep and it would take you years to master if you aren't patient enough I would suggest you learn alternative languages like Golang or probably C# which are also quite performant, if you are, start with Java SE, [Basic language syntax, core packages like [utils, lang, streams], generics, the collection framework, lambda expressions, reflections, and annotations, file handling[io/Nio] , exception handling, multithreading, and concurrency], then just have basic understanding of the web container [ web servlets and web servers] and the MVC architecture, Object Mappers like Jackson would come in handy when developing web services, running unit tests using JUnit and Mockito, build tools such as maven or gradle, JDBC to create the persistent layer (this would be abstracted by other libraries such has Hibernate and SpringJDBC when you study further , but the rudiments are still handy ),then you can enter the world of Spring and dive into spring projects ..which can also be overwhelming, alternatively u can decide to focus on reactive services like Micronaut or Vertx
ProgrammingRe: Why Such Scarcity In Online Resources by richebony: 11:58am On Aug 14, 2023
If you understand basic Java and understand the concept of web servlets and MVC architecture, then try java techie's channel on youtube, if you want a more in-depth understanding buy Spring Framework guru courses [John Thompson] on Udemy. But the most beginner-friendly course for me is chad darby's Spring Boot course on Udemy
ProgrammingRe: Reactjs Challenge - Fun Edition by richebony: 10:53am On Jul 27, 2023
Deicide:
I try https://multiform-nougat-907969.netlify.app/
Wow this is really nice ,can you share the source code
ProgrammingRe: Java Programming Language Is A Money Ritual Language by richebony: 12:19pm On Jul 12, 2023
Thermodynamics:
I've been applying for jobs on linkedin, mostly foreign jobs though.
The problem with most jobs is that they are looking for someone with at least 3-5years working experience NOT FREELANCING, MY EXPERIENCE AS A FREELANCER DOESN'T SEEM TO MATTER TO THEM
If you were able to build that app u listed from scratch, Baba na to fake experience oh .. use what u did in your mini projects and freelance gigs as job description, just state that you were employed as a contractor
ProgrammingRe: Java Programming Language Is A Money Ritual Language by richebony: 11:58am On Jul 12, 2023
Thermodynamics:
I sent you a private message, accept on your mail so I can share my GitHub and personal portfolio website.
Thanks i have sent u a reply
ProgrammingRe: Java Programming Language Is A Money Ritual Language by richebony: 11:28pm On Jul 11, 2023
Thermodynamics:
Yes, and I'm good at it, I once built a bank web application that registers/login users and perform operations like transfer, withdraw and deposit. The app automatically generates a bank account number and an ATM card details and store these details in a MySQL database.
The Frontend of the app was built with react while the back end was built with Java Spring Boot
can u share u github profile
ProgrammingRe: Java Programming Language Is A Money Ritual Language by richebony: 9:45pm On Jul 11, 2023
Thermodynamics:
I know java very very well, I've been freelancing with it for over 2years now, yet I haven't gotten any job.
Ah .....that's strange oh ...can u share ur github link ..and like my oga asked ..do u code Springboot?
ProgrammingRe: Java Programming Language Is A Money Ritual Language by richebony: 2:36pm On Jul 11, 2023
Purvan:
Very soon Java will depreciate and no one will use it again just like COBOL
That's the second funniest thing I see in tech communities after PHP is dead, I think you probably are still using JDK 1.7, Java has evolved and would keep evolving to a more programmer-friendly language
ProgrammingRe: Who Knows How To Connect Javascript To Php Server Live Socket Side? See My Code by richebony: 7:01am On Jul 11, 2023
You didn't specify what the error is being thrown, if it established a connection , or if the client and server have the same origin

if the latter is the case

Allow CORS
ws.on('headers', (headers, request) => {
headers.push('Access-Control-Allow-Origin: *');
headers.push('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
});

To check if your websocket is even connected on Bootstrap

if (ws.readyState === ws.OPEN) {
console.log('WebSocket is open ');
} else {
console.log('WebSocket is closed');
}

PS : if you aren't limited by tech specifications I would suggest using Sockets.io ...it offers a lot of abstraction over cross-cutting concerns that might come up when your application scales
ProgrammingRe: I Need A Nodejs Or Fullstack Mentor by richebony: 5:48pm On Jul 05, 2023
I think u should be the one reaching out though
ProgrammingRe: Am A Flutter Developer Looking For A Job by richebony: 9:45am On Jun 19, 2023
With your skill level, getting a job shouldn't really be a problem for you, at least getting invites . Your portfolio actually has more detail than your actual LinkedIn profile which is totally wrong, Your LinkedIn profile should have as much information as your CV does, also under your projects you should share a screenshot of your mobile applications that would give recruiters an insight on your competence, Also update your readme files on your GitHub repos, recruiters sometimes spend more time on your repos than even your portfolio especially those with some technical expertise. I wish you good luck
ProgrammingNestjs Microservices Docker Live Reload by richebony(op): 2:14pm On Jun 09, 2023
I have been playing around with nestjs microservices and I encountered an issue when using containerized services. Standalone nestjs applications are usually configured with a file watcher on dev mode( i think it uses ts-node under the hood ). The issue I am facing is that, despite my local environment clearly being mounted to the container( i ssh into the containers so i actually see changes being reflected) , the watcher refuses the restart the service on file changes.I tried to update the[b] watch [/b]attribute of ts-config.json in the root application to true, and also passed CHOKIDAR_USEPOLLING=true as a global env variable in my docker-compose file for the service, all to no avail.I think the issue lies with the WSL in Windows OS(i use docker for Windows).If anyone has a workaround on this please kindly direct me. Because I had to improvise by restarting each container anytime I make any file changes ..which is fucking frustrating
PoliticsRe: Fuel Subsidy Is Gone - President Bola Tinubu by richebony: 4:55pm On May 29, 2023
People wey never even chop belle full dey shout Nice one ...lmao grin
ProgrammingRe: Please Rate My Portfolio Website by richebony: 10:02am On May 14, 2023
Nice job bro ... I see lots of improvements and you have also added Nest to your skillset .Hope u are currently engaged now ..Wish you the best , I admire your resilience
Music/RadioRe: Mention A Song That's Not Popular But Impacts You Greatly by richebony: 2:58pm On May 08, 2023
Don't Panic by Coldplay
ProgrammingRe: So There Are Devs That Earn Up To 30k USD. by richebony: 6:10pm On Apr 13, 2023
tosinhtml:
I would be interested in how people move from one niche path to another because once you move from a $55k/yr dev, it means you are already a Senior and that means moving to Blockckchain developer will be starting over again from a Junior position, except you have been doing both for some years.
how many people are truthful about their exprience/ position . Once you have gained some competency level and built some apps in a new tech and also have vast provable experience in other tech you can easily migrate . My friend has been moving from one field to another , there was even an RN job he got [remote], he actually started learning the library on the job(though he already knew react).They just wanna see that you have worked for a reputable company and have some knowledge in the required tech

1 2 3 (of 3 pages)