Hi,
to integrate our project into another environment we needed to change the serverUrl of the clientConfig for uaa to “/” from “/api” and the same in the config-auth-shared.yaml (context-path property). When attempting to log in locally now the login request is made to “/user/local/login” instead to “/api/user/local/login” which results in a not found error.
How can I set the loginRelativeUrl for the local auth to use an url defined by us instead of the default path definded in the request.ts file of the uaa-authentication-client?
Thanks in advance,
Nick
hello @nick-linked-tensor
I assume you’re looking for a front-end configuration when your application in backend runs in /api context.
Within your front-end setup, looking for UaaClientConfiguration and modify the property serverURL: "/api" then the request login should go throught that context.
Hope this helps.
Hi @tuan-stable-gale
I probably did not phrase my question right. The local login seems to run in the api context while our application runs in the “/” context. So the serverURL has to be “/” for the rest to work but then the local login still does not work because it expects the /api in the path. I want to change the loginRelativeUrl to a value specified by me and not the value “/user/local/login” that gets set by default in uaa.
hi @nick-linked-tensor
Please separate front-end and back-end configurations.
If you application is running in the / context then login url will be registered in /user/local/login
If your application is running in the /api context then login url will be registered in /api/user/local/login
These are back-end configurations
Changing serverUrl in UaaClientConfiguration from uaa-authentication-client is front-end configuration to point to backend endpoints which I mentioned before.
If you implement your own backend login, please make sure the endpoint are match to what it’s actually requested from front-end.
I believe we do not have our own login implementation for the local login. This should use the default uaa local login logic. mgmtp.a12.uaa.authentication.context-path in the backend configuration yaml is also set to “/” but the response still is “Not found”. What else do i have to change for the application to use “/” and not “/api”?
The com.mgmtp.a12.uaa.authentication.security.login.internal.UAAAuthenticationFilter is taking context into account when building the pattern match. If you configure mgmtp.a12.uaa.authentication.context-path to / then it’s enough for UAA Login Endpoint.
Probably you can try to debug the application:
-
Please try to rebuild and run within your terminal instead of IDE to make sure there is no caches problem.
-
Enable specific mvc mapping: logging.level.org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping=TRACE for debugging purposes to see if the endpoint logged correctly in the console when you start application.
-
Using Postman/Bruno to simulate the request directly to your server.
Hi, I tried this but it does not seem to work. Where can I find the POST mapping that accepts the relativeUrl user/local/login?
Without /api in the configuration i get a Not Found.
Both UAA authentication context and Data Services context are based on servlet context. Do you configure in your project with servlet context to /api somehow ? Otherwise default value from UAA is “/” and data services is “/api”
From my understanding you already override these 2 values to “/” so the endpoints should be under “/” context.
You can use postman/bruno tooling to construct the request send to backend. If you don’t know how the request looks like, you can start preview-application in SME/A12 Installer then you have LOCAL authentication type as default in preview-application, press Login and look at Network tab in your browser console
I have found the issue. /user was missing from out webpack dev proxy configuration. It works fine now 