jhipster / generator-jhipster-ionic Goto Github PK
View Code? Open in Web Editor NEWIonic for JHipster ✨
Home Page: https://developer.okta.com/blog/2022/05/12/ionic-angular-jhipster
License: Apache License 2.0
Ionic for JHipster ✨
Home Page: https://developer.okta.com/blog/2022/05/12/ionic-angular-jhipster
License: Apache License 2.0
yo jhipster:server creates backend spring boot project (monolithic)
yo jhipster-ionic when trying to create checks for server application, and app-type and gives error:
"ERROR!
Your backend project must be a monolith or a gateway to work with this module! Found application type: undefined."
so i manually updated it like adding
"applicationType": "monolith",
to .yo-rc.json.
I think jhipster:server should do it itself or sth related should be done in ionic starter side.
such a little bug! Faced with updtodate version in Windows 10.
Thanks for such a helpful project!
I can upload a new photo in Web environment, but when I generate the apk and tried to save a photo in android device it gives this error.
o.z.problem.spring.common.AdviceTrait : Bad Request: JSON parse error: Cannot deserialize value of type
byte[] from String "image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBA....
The above exception comes in when the property is of type byte[] and json content is represented in String. Jackson thinks that in this case the json data is represented as base64 encoded and tries to decode it to a byte[]. If the string present in data field isn't a properly encoded base64 string, jackson raises the above exception.
Do I have to change something in the Spring class ? Like ...
return (Base64.getEncoder().encode(jsonParser.getText().getBytes()))
or
write images as text in database and send base64 string to server. Like described here
stackoverflow.com angular-5-how-can-i-save-a-user-with-a-blob-avatar
or save just the name of the avatar and get the image to show after like described here?
brianflove.com/2017/11/02/angular-http-client-blob/
All suggestions are very welcome :-)
:8100/assets/i18n/nb.json Failed to load resource: the server responded with a status of 404 (Not Found)
Was originally nb_NO.json
changed to correct filename worked..
See Crypto PWA for an example: https://github.com/oktadeveloper/okta-ionic-crypto-pwa/blob/master/src/pages/home/home.html#L25
Hi,
Like this issue #59 I'm unable to create a new ionic entity also after renaming my ionic directory by "ionic4j".
The error log :
Found the .jhipster/Country.json configuration file, entity can be automatically generated!
? Do you want to update the entity? This will replace the existing files for this entity, all your custom code will be overwritten Yes, re generate the entity
events.js:167
throw er; // Unhandled 'error' event
^
TypeError: this.insight is not a function
at module.exports.insight (/usr/lib/node_modules/generator-jhipster-ionic/generators/entity/index.js:630:38)
at Object.<anonymous> (/usr/lib/node_modules/generator-jhipster-ionic/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:418:27)
at /usr/lib/node_modules/generator-jhipster-ionic/node_modules/run-async/index.js:25:25
at new Promise (<anonymous>)
at /usr/lib/node_modules/generator-jhipster-ionic/node_modules/run-async/index.js:24:19
at self.env.runLoop.add.completed (/usr/lib/node_modules/generator-jhipster-ionic/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:419:13)
at processImmediate (timers.js:632:19)
Emitted 'error' event at:
at Immediate.setImmediate (/usr/lib/node_modules/generator-jhipster-ionic/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:427:22)
at processImmediate (timers.js:632:19)
Country.json file :
{
"name": "Country",
"fields": [
{
"fieldName": "countryName",
"fieldType": "String"
}
],
"relationships": [],
"changelogDate": "20181217152023",
"entityTableName": "country",
"dto": "no",
"pagination": "no",
"service": "no",
"jpaMetamodelFiltering": false,
"fluentMethods": true,
"clientRootFolder": "",
"applications": "*"
}
When I call writeFiles.call(this)
, it doesn't finish executing before install
is called.
Figure out how to make install
execute after writeFiles
.
All options from ion-select are being selected for options created from relationship.
Not sure if it breaks other thing but removing [compareWith]
from respective ion-select
works for me.
Hi,
i have installed this generator but when i select ionic 4 I have this error:
[INFO] You are about to create an Ionic 3 app. Would you like to try Ionic 4 (beta)?
Ionic 4 uses the power of the modern Web and embraces the Angular CLI and Angular Router to bring you the best
version of Ionic ever. See our blog announcement[1] and documentation[2] for more information. We'd love to hear
your feedback on our latest version!
[1]: https://blog.ionicframework.com/announcing-ionic-4-beta/
[2]: https://beta.ionicframework.com/docs/
? Try Ionic 4? Yes
√ Preparing directory .\ionic4j - done!
Looking up starter
[ERROR] Unable to find starter template for oktadeveloper/jhipster
If this is not a typo, please make sure it is a valid starter template within the starters repo:
https://github.com/ionic-team/starters
events.js:183
throw er; // Unhandled 'error' event
^
TypeError: Cannot set property 'author' of undefined
at module.exports.install (C:\Users\user\AppData\Roaming\npm\node_modules\generator-jhipster-ionic\generators\app\index.js:153:28)
at Object. (C:\Users\user\AppData\Roaming\npm\node_modules\generator-jhipster-ionic\node_modules\generator-jhipster\node_modules\yeoman-generator\lib\index.js:418:27)
at C:\Users\user\AppData\Roaming\npm\node_modules\generator-jhipster-ionic\node_modules\run-async\index.js:25:25
at new Promise ()
at C:\Users\user\AppData\Roaming\npm\node_modules\generator-jhipster-ionic\node_modules\run-async\index.js:24:19
at self.env.runLoop.add.completed (C:\Users\user\AppData\Roaming\npm\node_modules\generator-jhipster-ionic\node_modules\generator-jhipster\node_modules\yeoman-generator\lib\index.js:419:13)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
Can you help me?
Thank you!!
Since the jhipster ionic starter supports ionic V4, the formatting is 2 spaces for all files (see .editorconfig file).
Whereas the generator uses 4 spaces for indentation.
We have to align both starter and generator.
@mraible I think we should use 2 spaces also for the generator. I checked .editorconfig from popular project on github (Angular, React, VueJS, JHipster, ...) and all uses this config. WDYT?
Hi! 👋
I always encounter this problem while running a fresh new generated Ionic app.
After generating my Ionic app as specified in the README.md it can't run it without error.
It says:
Typescript Error
Subsequent variable declarations must have the same type. Variable 'process' must be of type '{ env: { [key: string]: string; }; }', but here has type 'Process'.
node_modules/@types/node/index.d.ts
Ionic Framework: 3.9.2
Ionic App Scripts: 3.1.9
Angular Core: 5.2.10
Angular Compiler CLI: 5.2.10
Node: 8.11.3
OS Platform: macOS High Sierra
Navigator Platform: MacIntel
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
##### **JHipster Version(s)**
[email protected] /Users/crivasgomez/jhipster/myapp/ionic4j
├── [email protected]
└─┬ [email protected]
└── [email protected] deduped
cat: no such file or directory: .yo-rc.json
##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**
<details>
<summary>.yo-rc.json file</summary>
<pre>
</pre>
</details>
##### **JDL for the Entity configuration(s) `entityName.json` files generated in the `.jhipster` directory**
<details>
<summary>JDL entity definitions</summary>
<pre>
</pre>
</details>
##### **Environment and Tools**
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
git version 2.15.2 (Apple Git-101.1)
node: v8.11.3
npm: 6.4.0
gulp:
[14:23:14] CLI version 2.0.1
yeoman: 2.0.5
yarn: 1.7.0
Docker version 18.06.0-ce, build 0ffa825
docker-compose version 1.22.0, build f46880f
Congratulations, JHipster execution is complete!
I can't generate runnable Ionic apps from JHipster generated runnable apps.
mkdir -p myapp/backend
cd myapp/backend
jhipster
(...)
cd ..
yo jhipster-ionic
(...)
cd ionic4j
ionic serve
No.
The screenshot shows a suspicious part of code inside node_modules/@types/node/index.d.ts
.
JHipster Version(s) - is it a regression?
4.14.5
JHipster configuration, a .yo-rc.json file generated in the root folder - this will help us to replicate the scenario, you can remove the rememberMe key.
{
"generator-jhipster": {
"promptValues": {
"packageName": "com.mycompany.myapp",
"nativeLanguage": "en"
},
"jhipsterVersion": "5.1.0",
"applicationType": "monolith",
"baseName": "backend",
"packageName": "com.mycompany.myapp",
"packageFolder": "com/mycompany/myapp",
"serverPort": "8080",
"authenticationType": "jwt",
"cacheProvider": "ehcache",
"enableHibernateCache": true,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "mysql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "maven",
"enableSwaggerCodegen": false,
"jwtSecretKey": "******************************************",
"enableTranslation": true,
"nativeLanguage": "en",
"languages": [
"en"
]
}
}
If you click on entities, it prompts you to log in. But otherwise, it returns to the home screen and it looks like you're still logged in.
Best guide I found so far is this comment.
I think solving this issue will be a good improvement for this project (and my project:)). so I will try to update this issue as I do progress forward, and please let me know if someone else have done this before? or you know a better way for solving this issue? thanks.
Uncaught (in promise): TypeError: Cannot read property 'id' of undefined TypeError: Cannot read property 'id' of undefined
With latest jhipster version 6.0.0, yo jhipster-ionic
fail with following error.
MacBookPro:pmverma sierra$ yo jhipster-ionic
events.js:167
throw er; // Unhandled 'error' event
^
TypeError: this.getJhipsterAppConfig is not a function
at module.exports.readConfig (/usr/local/lib/node_modules/generator-jhipster-ionic/generators/app/index.js:63:47)
at Object.<anonymous> (/usr/local/lib/node_modules/generator-jhipster-ionic/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:424:27)
at /usr/local/lib/node_modules/generator-jhipster-ionic/node_modules/run-async/index.js:25:25
at new Promise (<anonymous>)
at /usr/local/lib/node_modules/generator-jhipster-ionic/node_modules/run-async/index.js:24:19
at self.env.runLoop.add.completed (/usr/local/lib/node_modules/generator-jhipster-ionic/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:425:13)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
Emitted 'error' event at:
at Immediate.setImmediate (/usr/local/lib/node_modules/generator-jhipster-ionic/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:433:22)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
INFO! Using JHipster version installed globally
INFO! Executing jhipster:info
INFO! Options: from-cli: true
Welcome to the JHipster Information Sub-Generator
/Users/sierra/gitlab/pmverma
└── (empty)
cat: no such file or directory: .yo-rc.json
.yo-rc.json
file generated in the root folderentityName.json
files generated in the .jhipster
directoryjava version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
git version 2.20.1 (Apple Git-117)
node: v10.14.2
npm: 6.7.0
yeoman: 2.0.6
Docker version 18.09.1, build 4c52b90
docker-compose version 1.23.2, build 1110ad01
Great to integrate JHipster with Ionic !!!
I created JHipster nms (Monolithic dev: MySQL) & ionic4j, but gave it another name ionms .
When I run
cd nms && ./gradlew
cd ionms && ionic serve.
But when I try to create an entity that is running fine in nms app
an error ...
$ yo jhipster-ionic:entity hospital
If I create ionic4j. It generates the entities
Ionic app scripts 3.2.0 introduced configuration via process.env.VAR.
Currently the oktadeveloper/jhipster
starter add ionic app scripts 3.1.9 dependency.
I've already done it on my JH Ionic app for the API_URL variable (fleboulch/fast-msg-heroku@26b960d).
I could submit a PR to use this feature but I don't know how to update the oktadeveloper/jhipster
starter
Welcome to the Ionic JHipster generator! v3.0.0
? What do you want to name your Ionic application? ionic4j
? Enter the directory where your JHipster app is located: backend
fromPath backend/.yo-rc.json
Creating Ionic app with command: ionic start ionic4j oktadeveloper/jhipster
events.js:183
throw er; // Unhandled 'error' event
^
Error: spawnSync ionic ENOENT
at _errnoException (util.js:1024:11)
at spawnSync (child_process.js:579:20)
at execFileSync (child_process.js:616:13)
at module.exports.writing (C:\Users\Thomas Rabelo\AppData\Roaming\npm\node_modules\generator-jhipster-ionic\generators\app\index.js:67:9)
at Object. (C:\Users\Thomas Rabelo\AppData\Roaming\npm\node_modules\generator-jhipster-ionic\node_modules\generator-jhipster\node_modules\yeoman-generator\lib\index.js:399:25)
at C:\Users\Thomas Rabelo\AppData\Roaming\npm\node_modules\generator-jhipster-ionic\node_modules\generator-jhipster\node_modules\run-async\index.js:25:25
at new Promise ()
at C:\Users\Thomas Rabelo\AppData\Roaming\npm\node_modules\generator-jhipster-ionic\node_modules\generator-jhipster\node_modules\run-async\index.js:24:19
at self.env.runLoop.add.completed (C:\Users\Thomas Rabelo\AppData\Roaming\npm\node_modules\generator-jhipster-ionic\node_modules\generator-jhipster\node_modules\yeoman-generator\lib\index.js:400:11)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
I run "yo jhipster-ionic" command and ionic app is created. But my entities which already locate in my existing jhipster project doesn't be generated. Also, when i try to run "yo jhipster-ionic:entity" command console says
Just found a `.yo-rc.json` in a parent directory.
Setting the project root at: /home/can
Found the .jhipster/Course.json configuration file, entity can be automatically generated!
The entity Course is being updated.
Error jhipster-ionic:entity Course
ERROR!
The entity configuration file could not be read!
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder
'security.oauth2.client.access-token-uri' in value "${security.oauth2.client.access-token-uri}"
Hello,
First of all thanks for this amazing work.
I was trying to test my jhipster-ionic app on my phone using the new Ionic DevApp but I wasn't able to log in.
Is there some extra configuration (proxy, CORS) to add in order to have HTTP requests working on a real device?
Hi,
module.js:487
throw err;
^
Error: Cannot find module '/usr/local/lib/node_modules/generator-jhipster-ionic/generators/app/../../node_modules/generator-jhipster/generators/util.js'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object. (/usr/local/lib/node_modules/generator-jhipster-ionic/generators/app/index.js:8:21)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
Encrypt the credentials to show folks how to do it
Error: Cannot find module 'C:\Users\Zeral\AppData\Roaming\npm\node_modules\generator-jhipster-ionic\generators\app/../../node_modules/generator-jhipster/generators/util.js'
at Function.Module._resolveFilename (module.js:489:15)
at Function.Module._load (module.js:439:25)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object. (C:\Users\Zeral\AppData\Roaming\npm\node_modules\generator-jhipster-ionic\generators\app\index.js:8:21)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
This is my environment :
Node: v8.4.0
npm: v5.3.0
yarn : v1.3.2
jhipster generator: v4.10.2
Hi there!
i need to use ionic 4 in my project
When will it be updated??????
I added OIDC Support to the Ionic module in #20. Along the way, I discovered that I wasn't able to use a cookie-based solution for storing the access token. With a basic JHipster monolith, cookies work because the Angular client is either embedded in the Spring Boot app (when running on 8080), or webpack proxies the request to the server (when using yarn start
), carrying the cookies with it along the way.
Ionic runs on port 8100 when developing locally. We could configure its server to proxy as well, but in production, Ionic will most likely be deployed on a phone and it won't be able to leverage the cookies. Or, in other words, I was unable to make it work.
The solution I came up with is to add two classes to the backend JHipster app:
ResourceServerConfiguration
: This class has an EnableResourceServer
annotation that makes JHipster capable of receiving and parsing access tokens for authentication. Unfortunately, this also seems to override the EnableOAuth2Sso
annotation in SecurityConfiguration
, so the JHipster app will no longer be able to serve up its Angular client.AuthInfoResource
: This class exposes the OAuth settings for Spring Security at an api/auth-info
endpoint, which allows the angular-oauth2-oidc library to configure its settings from the server's settings.In Ionic, I added angular-oauth2-oidc to handle authentication with OAuth's implicit flow (when running in a browser). Since you can't redirect to a website when running in Cordova, I used its Inappbrowser plugin.
I made some updates to the default realm in Keycloak to add Ionic's URI (http://localhost:8100
) as an allowed redirect uri, and to enable implicit flow in the web_app
client.
To fix this bug, I think one of the following needs to happen:
if (this.jhipsterAppConfig.authenticationType === 'oauth2') {
let resourceServerWarning = `${chalk.yellow('NOTE:')} To integrate OIDC into Ionic, I added a ResourceServerConfiguration class `;
resourceServerWarning += `to your ${this.directoryPath} project. This will cause the Angular client on your server to stop `;
resourceServerWarning += 'functioning. Please check this project\'s documentation to learn more: ';
resourceServerWarning += `${chalk.bold('https://github.com/oktadeveloper/generator-jhipster-ionic\n')}`;
this.log(resourceServerWarning);
}
EnableOAuth2Sso
and EnableResourceServer
in the same project. I tried this solution, but was unable to make it work. I also thought it might be possible to enable the resource server on /mobile
endpoints and then proxy those requests to /api
, but I'm guessing Spring Security would still intercept those requests; causing it to fail./cc @bdemers @jhipster/developers @danielpetisme @deepu105 @jdubois @xetys @ruddell
In the 3.x version of Ionic for JHipster, the entity list screen allowed for deleting and editing entities by swiping left. This functionality seems to be lost in 4.x. This issue is to track adding it back in. See this blog post for visuals.
It seems the call to /api/auth-info
takes to long when redirecting back to the application.
Hi,
it look's like there is a small bug in _entity-dialog.ts [131].
I have a entity with the relationships:
"relationships": [
{
"relationshipName": "creator",
"otherEntityName": "user",
"relationshipType": "many-to-one",
"relationshipValidateRules": [
"required"
],
"otherEntityField": "login",
"ownerSide": true,
"otherEntityRelationshipName": "group"
}
]
and I get an exception:
typescript: src/pages/entities/group/group-dialog.ts, line: 38
Property 'user' does not exist on type 'Group'.
L37: name: [params.get('item') ? this.group.name : null, Validators.required],
L38: user: [params.get('item') ? this.group.user : '',Validators.required],
L39: });
but it should be this.group.creator !
fix:
const relatedFieldName = (uniqueRel.relationshipType === 'many-to-many') ?
uniqueRel.otherEntityNamePlural : uniqueRel.otherEntityName;
uniqueRel.otherEntityName should be uniqueRel.relationshipName.
With jhipster version 6.1.1, yo jhipster-ionic:entity NmsAlertLog fail with following error:
events.js:167
throw er; // Unhandled 'error' event
^
TypeError: this.insight is not a function
at module.exports.insight (/Users/mirg/Workspace/ionic4j/node_modules/generator-jhipster-ionic/generators/entity/index.js:630:38)
at Object. (/Users/mirg/Workspace/ionic4j/node_modules/yeoman-generator/lib/index.js:424:27)
at /Users/mirg/Workspace/ionic4j/node_modules/run-async/index.js:25:25
at new Promise ()
at /Users/mirg/Workspace/ionic4j/node_modules/run-async/index.js:24:19
at self.env.runLoop.add.completed (/Users/mirg/Workspace/ionic4j/node_modules/yeoman-generator/lib/index.js:425:13)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
Emitted 'error' event at:
at Immediate.setImmediate (/Users/mirg/Workspace/ionic4j/node_modules/yeoman-generator/lib/index.js:433:22)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
===
I created a new Jhispter app and
new Ionic4 app with
$yo jhipster-ionic
WARNING! This method is deprecated. Use getAllJhipsterConfig
Entity
entity NmsAlertLog {
logTime ZonedDateTime,
text String maxlength(255),
aceptedBy String,
comment String,
status String maxlength(16)
}
Environment and Tools
(MacOS Monjave 10.14.5)
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
git version 2.20.1 (Apple Git-117)
node: v10.14.2
npm: 6.9.0
yeoman: 2.0.6
yarn: 1.12.3
In relationship section, for validation, editForm
is used while the actual name is form
.
To fix this, need to chnage editForm
to form
yo jhipster:entity
Hi
First of all congratulations for this great work. This is very useful for me, the only thing I am missing in this is social login. Any plans for social login.
If you create a blog.jh app using JDL, saving entries doesn't work.
Request payload:
{
"id":null,
"title":"First",
"content":"post",
"date":"2018-03-20",
"blog":{
"id":1,
"name":"New blog",
"handle":"new",
"user":{
"id":4,
"login":"user",
"firstName":"User",
"lastName":"User",
"email":"user@localhost",
"activated":true,
"langKey":"en",
"imageUrl":""
}
},
"tags":""
}
Response:
{
"type" : "http://www.jhipster.tech/problem/problem-with-message",
"title" : "Bad Request",
"status" : 400,
"detail" : "JSON parse error: Can not deserialize value of type java.time.ZonedDateTime from String \"2018-03-20\": Text '2018-03-20' could not be parsed at index 10; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not deserialize value of type java.time.ZonedDateTime from String \"2018-03-20\": Text '2018-03-20' could not be parsed at index 10\n at [Source: java.io.PushbackInputStream@53ce1cec; line: 1, column: 52] (through reference chain: com.mycompany.myapp.domain.Entry[\"date\"])",
"path" : "/api/entries",
"message" : "error.http.400"
}
Hi,
I create a jHipster web monolithic/OAuth 2.0/OIDC Keycloak application with jHipster 4.14.4 version, see attachment.
And the application works fine.
After i create a jHipster Ionic app basead on my web monolithic backend.
And i cant login from ionic app.
Backend dont have ResourceServerConfiguration class, and the class SecurityConfiguration have a method below:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf()
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.and()
.addFilterBefore(corsFilter, CsrfFilter.class)
.exceptionHandling()
.authenticationEntryPoint(problemSupport)
.accessDeniedHandler(problemSupport)
.and()
.logout()
.logoutUrl("/api/logout")
.logoutSuccessHandler(ajaxLogoutSuccessHandler())
.permitAll()
.and()
.headers()
.frameOptions()
.disable()
.and()
.authorizeRequests()
.antMatchers("/api/profile-info").permitAll()
.antMatchers("/api/**").authenticated()
.antMatchers("/management/health").permitAll()
.antMatchers("/management/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/v2/api-docs/**").permitAll()
.antMatchers("/swagger-resources/configuration/ui").permitAll()
.antMatchers("/swagger-ui/index.html").hasAuthority(AuthoritiesConstants.ADMIN);
}
My Ionic app try access (in login) the endpoint:
POST http://localhost:8080/api/authenticate
The result in chrome for Ionic is: 403 (Forbidden)
The log in application is:
2018-05-28 18:56:35.000 DEBUG 14454 --- [ XNIO-16 task-2] o.s.b.w.f.OrderedRequestContextFilter : Bound request context to thread: HttpServletRequestImpl [ POST /api/authenticate ]
2018-05-28 18:56:35.001 WARN 14454 --- [ XNIO-16 task-2] o.z.p.spring.web.advice.AdviceTrait : Forbidden: Invalid CSRF Token 'null' was found on the request parameter '_csrf' or header 'X-XSRF-TOKEN'.
2018-05-28 18:56:35.004 WARN 14454 --- [ XNIO-16 task-2] .m.m.a.ExceptionHandlerExceptionResolver : Resolved exception caused by Handler execution: org.springframework.security.web.csrf.InvalidCsrfTokenException: Invalid CSRF Token 'null' was found on the request parameter '_csrf' or header 'X-XSRF-TOKEN'.
2018-05-28 18:56:35.004 DEBUG 14454 --- [ XNIO-16 task-2] o.s.b.w.f.OrderedRequestContextFilter : Cleared thread-bound request context: HttpServletRequestImpl [ POST /api/authenticate ]
If you point to a gateway when generating an entity, the JSON file is not found. You have to specify the path to the microservice app to find the JSON file. For a monolith, the path to the API is /api/{entityName}
. For a microservice, the path to the API is /api/{microserviceName}/{entityName}
.
I followed temporary steps to run at #4 on Windows :
git clone [email protected]:oktadeveloper/generator-jhipster-ionic.git
cd generator-jhipster-ionic
npm link
cd ~
yo jhipster-ionic
What might be the cause of the problem? Thank you.
E:\project\generator-jhipster-ionic\generators\app\index.js:55
this.jhipsterAppConfig = this.fs.readJSON(fromPath)['generator-jhipster'
];
^
TypeError: Cannot read property 'readJSON' of undefined
at get writing [as writing] (E:\project\generator-jhipster-i
onic\generators\app\index.js:55:41)
at addInQueue (E:\project\generator-jhipster-ionic\node_modu
les\generator-jhipster\node_modules\yeoman-generator\lib\index.js:414:47)
at Array.forEach (native)
at run (E:\project\generator-jhipster-ionic\node_modules\gen
erator-jhipster\node_modules\yeoman-generator\lib\index.js:437:18)
at Environment.run (C:\Users\Laboratory\AppData\Roaming\npm\node_modules\yo
node_modules\yeoman-environment\lib\environment.js:451:22)
at env.lookup (C:\Users\Laboratory\AppData\Roaming\npm\node_modules\yo\lib\c
li.js:156:11)
at Environment.resolver.lookup (C:\Users\Laboratory\AppData\Roaming\npm\node
_modules\yo\node_modules\yeoman-environment\lib\resolver.js:51:12)
at init (C:\Users\Laboratory\AppData\Roaming\npm\node_modules\yo\lib\cli.js:
117:7)
at pre (C:\Users\Laboratory\AppData\Roaming\npm\node_modules\yo\lib\cli.js:7
6:3)
at Object. (C:\Users\Laboratory\AppData\Roaming\npm\node_modules
yo\lib\cli.js:205:3)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
For some reason, this code never calls the success callback:
this.user.signup(this.account).subscribe((resp) => {
this.navCtrl.push(MainPage);
}, (err) => {
//console.log('error in signup', err);
// ^^ results in 'You provided 'undefined' where a stream was expected'
//this.navCtrl.push(MainPage);
// Unable to sign up
let toast = this.toastCtrl.create({
message: this.signupErrorString,
duration: 3000,
position: 'top'
});
toast.present();
});
Hi,
I have a standard JHipster v5.8.1 app generated called "eMedic". I then tried to generate the ionic app alongside the eMedic app. However, I'm getting the error as seen in the screenshot.
Note: I'm running the "yo jhipster-ionic" command from /Users/john/workspace/temp
JHipster info:
`
INFO! Using JHipster version installed locally in current project's node_modules
INFO! Executing jhipster:info
INFO! Options: from-cli: true
Welcome to the JHipster Information Sub-Generator
[email protected] /Users/john/workspace/temp/eMedic
└── [email protected]
.yo-rc.json
file generated in the root folder{ "generator-jhipster": { "promptValues": { "packageName": "com.test", "nativeLanguage": "en" }, "jhipsterVersion": "5.8.1", "applicationType": "monolith", "baseName": "eMedic", "packageName": "com.test", "packageFolder": "com.test", "serverPort": "8080", "authenticationType": "jwt", "cacheProvider": "ehcache", "enableHibernateCache": true, "websocket": false, "databaseType": "sql", "devDatabaseType": "h2Disk", "prodDatabaseType": "postgresql", "searchEngine": "elasticsearch", "messageBroker": false, "serviceDiscoveryType": false, "buildTool": "maven", "enableSwaggerCodegen": false, "jwtSecretKey": "bXktc2VjcmV0LXRva2VuLXRvLWNoYW5nZS1pbi1wcm9kdWN0aW9uLWFuZC10by1rZWVwLWluLWEtc2VjdXJlLXBsYWNl", "clientFramework": "angularX", "useSass": true, "clientPackageManager": "npm", "testFrameworks": ["gatling", "cucumber", "protractor"], "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", "otherModules": [], "enableTranslation": true, "nativeLanguage": "en", "languages": ["en", "zh-cn"] } }
entityName.json
files generated in the .jhipster
directoryjava version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
git version 2.17.2 (Apple Git-113)
node: v8.12.0
npm: 6.4.1
yeoman: 2.0.5
Docker version 18.09.1, build 4c52b90
docker-compose version 1.23.2, build 1110ad01
INFO! Congratulations, JHipster execution is complete!
`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.