Questions tagged spring-security

Explore the latest questions and answers asked by our top developers.

Angular Interceptor: headers added in the request not set properly, can’t fetch them from the API

I’m trying to add some custom headers in my angular interceptor as follow: @Injectable() export class HttpJwtAuthInterceptor implements HttpInterceptor { constructor() {} intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> { localStorage.setItem(‘token’, ‘qsdfqsdfqsdfqsdf’); if (localStorage.getItem(‘cuid’) && localStorage.getItem(‘token’)) { request = request.clone({ setHeaders: { ‘sm_universalid’:’blablabla’, Authorization: `Bearer ${localStorage.getItem(‘token’)}`, }, }); } return next.handle(request); } } The above interceptor was […]

Looking to byepass a security for a webpage using AngularJS and Springboot

Using AngularJS  stateProvider with Springboot. So when user hits any page URL it comes to AngularJS controller firstly and then to Spring Controller which renders the page. $stateProvider         .state(‘registration’, {             url: ‘/registration’,             templateUrl: ‘registration’,           […]

How to pass angular login form to spring security

I have a CRUD project and I’m attempting to implement an angular frontend, and want to know how to pass the login form to spring security correctly. Currently the post request gets performed, but in the loadUserByUsername method the username is null and I think it has to do with how I’m trying to send […]

By montre131
Published
Categorized as angular, spring, spring-boot, spring-security Tagged , , ,

Spring boot error despite adding @CrossOrigin(origins = "*") *No ‘Access-Control-Allow-Origin’ header is present on the requested resource*

The solution here for CORS error dashboard:1 Access to XMLHttpRequest at ‘http://localhost:8080/getUser’ from origin ‘http://localhost:4200’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. seems to be a @CrossOrigin(origins = "*") annotation on the controller. But the error is still […]

By VARUN N RAO
Published
Categorized as angular, cors, spring-boot, spring-security Tagged , , ,

SOLVED – Spring boot error despite adding @CrossOrigin(origins = "*") *No ‘Access-Control-Allow-Origin’ header is present on the requested resource*

[SOLVED] The error was from browser, on opening a browser from Run by executing and running Angular application from that browser works fine chrome.exe –user-data-dir="C://Chrome dv session" –disable-web-security The solution here for CORS error dashboard:1 Access to XMLHttpRequest at ‘http://localhost:8080/getUser’ from origin ‘http://localhost:4200’ has been blocked by CORS policy: Response to preflight request doesn’t pass […]

By VARUN N RAO
Published
Categorized as angular, cors, spring-boot, spring-security Tagged , , ,

Spring Boot error 403 when sending request

My system consists of 3 parts. Spring Boot app, Angular app and Android app. When my Android app sends request to reset password (if don’t remember it) then Spring Boot app receives this request with this method: @PostMapping("/forgot_password") public String processForgotPassword(@RequestBody String email, HttpServletRequest request) { try { String token = RandomString.make(30); userService.updateResetPasswordToken(token, email); String […]

By qbi
Published
Categorized as angular, java, spring, spring-boot, spring-security Tagged , , , ,

Return validation of the login from Spring Boot to Angular

I have implemented a WebUI with Angular that has a login form, to verify the credentials I have implemented a custom Spring Boot microservice that checks the credentials based on Unix credentials. The login form sends the credentials to an APIGateway and then the APIGateway forwards the datas to an AuthenticationService, that is the service […]

By luca
Published
Categorized as angular, spring, spring-boot, spring-security Tagged , , ,

Secure a route on the frontend AND the backend

I am building a Spring Boot + Angular app. Using Guards i can make sure that only logged-in users can access my Angular application (via JWT). But that is just a frontend convenience that can be bypassed. Can i additionally secure my app in the backend so that users that are not loggen cannot acces […]

Retrieve token (body) from spring with an angular(12) post

i’m trying to retrieve a token from my spring boot security application with an angular 12 frontend. When I try in postman i get my token but when i do the same with angular (12) i have an "undefined error". My response is in a Json body(with a refresh token in it) , not headers […]

By SlashUzero
Published
Categorized as angular, http, spring-security Tagged , ,

Spring security with custom login (from Angular FE) keeps trying to login

So I am having this issue where I want to login from Angular (localhost:4200) while my backend runs on localhost:8080. When I try to access some secured endpoint I am redirected to the Login page. When I log in I can access the needed secured endpoint. I tried the same approach from localhost:4200, but it […]

By Marek Klement
Published
Categorized as angular, cors, java, spring, spring-security Tagged , , , ,
1 2 3 10

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq