Run grails 3 project at customized url - grails

I have a project which uses Grails 3 on Intellij IDE. When I run my project I get my URL like this:
Now I want to run by project at http://localhost:8080/login/auth where I have a login page.
I tried changing server Context path and urlMapping. But both didn't work. I am using Spring Security Core-3 as authentication plugin.

Related

Adding a module to web config causes runtime error - mini Orange SSO package

I'm using the MiniOrange SSO DLL with a .NET Umbraco MVC app, and although it seems to work fine locally, as soon as it's deployed to test I get a "server error in '/' application" runtime error. It looks like it's down to adding the following entry under system.webserver, modules:
<add name="APIFilter" type="miniorangesamlsso.APIFilter" preCondition="managedHandler"/>
Has anyone used this, or have any info that may help?
Update
Looks like the miniOrage DLL is missing from bin when I look at it in Azure (it's not a nuget install). I've manually added it to the packages.confige and redeploying now to see if it resolves it.

grails3 static picture request get 404

I want to inject angular6.0 to grails 3.3.0,the detail is I have 2 project,the first is angular6.0 project for frontend,and the second is grails3.3.0 for backend provide http service.
angular project have some simple pages,just like
http://localhost:8080/
http://localhost:8080/project-list
http://localhost:8080/download
I get some idea from this article.
when the angular project finished,I run build and get a dist folder,I copy all files and folders under dist to grails under src/main/webapp
enter image description here
then start grails service in IDE.OK I can visit http://localhost:8080/, but all request for static pictures I get 404.
enter image description here
when I run grails war script and run it use 'java -jar',I can visit http://localhost:8080/ and all request for pictures is OK,great.
but if i refresh the page of 'http://localhost:8080/project-list',I get 404 and I know why,but I do't know how to resolve it.
anybody help?thx
some days later,I get some idea,not good but can resolve some problem.
first of all,the angular project should run with #(maybe means hash,sorry I'm not sure)in url,just do this
RouterModule.forRoot(routes, {useHash: true})
it's not enough,if you just do like that,you may get some error when you run your angular project in dev env,just like https://github.com/angular/angular-cli/issues/10582, I have no idea,but if you start the project with -aot just like
ng serve --aot
error is gone.
build the angular project and copy the dist folder in to grails,and start grails project,the static pic is still not ok,no idea. when you execute 'war' and use 'java -jar' to run the war file,when you visit http://localhost:8080,everything is ok.
that's all,if you have some good idea,please tell me,thx before.

How to work with angular 2 profile for grails

it's great news that Grails 3.2.1 now comes with an Angular2 profile, but I don't know how to use it.
The profile description tells me that there should be the standard command like create-domain-class, but when I create an app through
grails create-app test-ng --profile angular2
I get a working angular2 project, but it even seems that this project is not recognized as grails app. When I enter the grails cli, I only get the commands like create-app which are available outside of projects.
What am I doing wrong?
your grails create-app test-ng --profile angular2
command should have created three folders in your test-ng-project-folder:
client
gradle
server
change to server and start grails command
now you should have the wellknown grails project.
but i am still on the first steps of examining the new grails-profile. so i hope i could help you.
Nowadays this layout is called "multi-project". Separate 4 the client and server applications. To make things easier, the tasks test, integrationTest, and bootRun have been created in the client application to make executing those tasks easier across the whole application.
Since Gradle executes tasks synchronously, and the bootRun task will never finish, it is important to execute it in parallel. At the root of the project:
./gradlew bootRun --parallel
Opening things also separately by 2 instances of your IDE or preferred text processor.
see the docs
grails list-profiles
show list of available profiles, I suggest you use this because for example now angular2 profile is angular and angular1 is angularJS.

Grails 3.0 and Spring Security

I'm using Grails 3.0.1 with IntelliJ Idea and I'm trying to use Spring Security plugin on my project.
I know that old spring-seurity-core plugin is not compatible with Grails 3.0 version. Thus I've tried to follow this tutorial: http://spiesdavid.blogspot.fi/2015/03/grails-3-app-with-security-part-1.html
I've added the compile line in build.gradle file in dependencies. I've also added the logger line in logback.groovy file.
Problems start after that. There is no such file as SecurityConfiguration.groovy and there is no org.springframework.security package so I can't import them and it gives an error. So I can't create the file either.
So I am assuming that your question is: «How do I get this to work?»
spring security plugin 3.0.0 (for grails 3.x) was released just a few days ago. Documentation is quite good. Start here: https://grails-plugins.github.io/grails-spring-security-core/
There are some problems with Intellij. I tried to add spring security to a slightly older grails project (started with intellij 15.0.1 and grails 3.0.9). Adding the dependencies was successful and rebuilding it made the plugin available, also in the grails console. But when I launched a debug instance of the application directly from the IDE, it would not show spring security among the loaded/installed plugins. I made a pristine project with IntelliJ 15.02, grails 3.0.10 and just copied my code over to the new project. Now it works.
Note there are some issue with IntelliJ not major. do the following it will work:
on your build.gradle add compile 'org.grails.plugins:spring-security-core:3.0.0.M2'
run command compile
run comand s2-quickstart yourAppName User Role
now you should see "application.groovy" file under conf folder
as usual use #Secured annotation in your controller

Grails/aNimble on Windows : Getting cannot find the specified path

I am trying to setup aNimble on Windows following this article.
I have setup the Java and MySQL (xampp) on Windows and both are working properly.
Now, as the final step I need to execute
grails prod execute-database-scripts-all
but I am getting cannot find the specified path. Even when I type grails only I get the same error. I have zero experience in Grails, but it seems that I need to install Grails first on the PC. Until I do this, I want to know is there anything else that I need to do this to successfully execute this command.
What are the three portions of this command grails, prod and execute-database-scripts-all
This error means that Windows is unable to find grails executable anywhere it looks (in any paths specified in PATH system property) when you typing grails command. You may have to follow this guide in order to install grails application framework properly in your system (also, make sure you are installing a correct version of grails compatible with your distribution of aNimble) and then retry.
Grails is a web application framework and which provides a set of tools to develop, build and run web applications like aNimble, prod is a command line option for grails telling it to run in a production mode and execute-database-scripts-all is aNimble-specific command to initialize it's database.

Resources