Accessing the registration page with UAA [v4.9.0]
See original GitHub issueOverview of the issue
When using JHipster 4.9.0 and UAA, there is an issue with accessing the registration page. There is 401 Unauthorized
error in the browser’s console (as the result of the GET request to http://localhost:8080/uaa/api/account).
Motivation for or Use Case
Registrations should be possible in the out of the box, generated version.
Reproduce the error
You have to generate an app with UAA through JHipster 4.9.0.
Related issues
I’m not aware of this.
Suggest a Fix
There were a changes in UAA recently. From the first overview I found generator-jhipster/generators/client/templates/angular/src/main/webapp/app/shared/auth/_user-route-access-service.ts
as the reason of the problem.
Previously when the route had no authorities
, checkLogin
was not executed. Problem has to be related with principal.identity()
, executed inside checkLogin
.
The quickfix for me was to copy
if (!authorities || authorities.length === 0) {
return true;
}
back to its original place, but it was moved from there for a purpose
// We need to call the checkLogin / and so the principal.identity() function, to ensure,
// that the client has a principal too, if they already logged in by the server.
// This could happen on a page refresh.
I’d say, the target solution requires a better understanding of principal.identity()
and rethinking it with the recently registered user in mind.
JHipster Version(s)
4.9.0
JHipster configuration
JHipster configuration, a .yo-rc.json
file generated in the root folder
.yo-rc.json file
{ "generator-jhipster": { "promptValues": { "packageName": "io.github.mat3e.jhipster.taskr", "nativeLanguage": "pl" }, "jhipsterVersion": "4.9.0", "baseName": "uaa", "packageName": "io.github.mat3e.jhipster.taskr", "packageFolder": "io/github/mat3e/jhipster/taskr", "serverPort": "9999", "authenticationType": "uaa", "hibernateCache": "no", "clusteredHttpSession": false, "websocket": false, "databaseType": "mongodb", "devDatabaseType": "mongodb", "prodDatabaseType": "mongodb", "searchEngine": false, "messageBroker": "kafka", "serviceDiscoveryType": "consul", "buildTool": "maven", "enableSocialSignIn": false, "enableSwaggerCodegen": false, "enableTranslation": true, "applicationType": "uaa", "testFrameworks": [ "cucumber" ], "jhiPrefix": "jhi", "skipClient": true, "nativeLanguage": "pl", "languages": [ "pl", "en" ], "clientPackageManager": "yarn" } }
Entity configuration(s) entityName.json
files generated in the .jhipster
directory
No entities in UAA.
Environment and Tools
java version “1.8.0_121” Java™ SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot™ Client VM (build 25.121-b13, mixed mode)
git version 2.9.0.windows.1
node: v8.2.1
npm: 5.3.0
bower: 1.7.9
yeoman: 2.0.0
yarn: 0.27.5
Docker version 17.06.2-ce, build cec0b72
docker-compose version 1.14.0, build c7bdf9e3
Browsers and Operating System
I’m working on Windows.
- Checking this box is mandatory (this is just to show you read everything)
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (9 by maintainers)
So…option 3: “AntiUserRouteAccessService” 😆
I’ve moved the lines, because of #6190 and #6413 . The register route should have an opposite rule - if the user logged in, they shouldn’t be allowed to see the page