Click here to Skip to main content
15,845,598 members
Home / Discussions / Java
   

Java

 
AnswerRe: 2d java graphics Pin
CHill601-Oct-20 3:09
mveCHill601-Oct-20 3:09 
AnswerRe: 2d java graphics Pin
Richard MacCutchan1-Oct-20 4:02
mveRichard MacCutchan1-Oct-20 4:02 
Questionjava programmimg Pin
Member 1494135617-Sep-20 20:36
Member 1494135617-Sep-20 20:36 
AnswerRe: java programmimg Pin
Member 1494135617-Sep-20 20:39
Member 1494135617-Sep-20 20:39 
AnswerRe: java programmimg Pin
Sandeep Mewara17-Sep-20 21:23
mveSandeep Mewara17-Sep-20 21:23 
AnswerRe: java programmimg Pin
Gerry Schmitz18-Sep-20 1:44
mveGerry Schmitz18-Sep-20 1:44 
GeneralRe: java programmimg Pin
Dave Kreskowiak18-Sep-20 5:33
mveDave Kreskowiak18-Sep-20 5:33 
QuestionIntegrating keycloak with spring security Pin
arunken16-Sep-20 22:30
arunken16-Sep-20 22:30 
I have created a spring boot + thymeleaf application with spring security for securing the requests. The application should also be providing a rest api to communicate with other applications(other front-end framework, mobile app). For this I chose to go with OAuth2 for securing the rest api and I stumbled across keycloak which I think suits my interest.

As of now the security configuration class extends WebSecurityConfigurerAdapter and not KeycloakWebSecurityConfigurerAdapter and hence I am using the following security constraints in my application.properties :

keycloak.security-constraints[0].authRoles[0]=user
keycloak.security-constraints[0].securityCollections[0].patterns[0]=/hello/*


I am thinking of using spring security to secure the normal requests and use keycloak for the rest api. I want each of them to work independent of the other. That is, even if I do not have the keycloak server running I need my web app to serve the web pages(secured by spring security) and the rest API will only work when keycloak is running(secured by keycloak). Currently, the keycloak client is setup with access type : public and a redirect will be made to keycloak authentication page when I try to access any request with pattern /hello/*(these are not rest api's as of now). I will be changing the access type to bearer-only for the rest api's. I have permitted the request to /hello/ without any authentication in the configure method in spring security settings :

http.authorizeRequests()
    .antMatchers("/user").hasAnyRole("ADMIN", "USER")
    .antMatchers("/admin").hasRole("ADMIN")
    .requestMatchers(PathRequest.toStaticResources().atCommonLocations()).permitAll()
    .antMatchers("/hello").permitAll().anyRequest().authenticated().and().formLogin()//permit all requests
    .loginPage("/login")
    .defaultSuccessUrl("/", true)
    .failureUrl("/login-error").permitAll().and()
    .logout()
    .invalidateHttpSession(true)
    .logoutSuccessUrl("/login")
    .logoutUrl("/logout");


Is this the right way to deal with my requirement? Should I use microservices to accomplish the same?. I am more concerned about whether it is the right way to do things regardless of whether the way I am doing would work or not. Any suggestions and/or improvements are welcome. Thanks.
QuestionHelp me! Pin
Member 1492738231-Aug-20 9:30
Member 1492738231-Aug-20 9:30 
AnswerRe: Help me! Pin
ZurdoDev31-Aug-20 10:37
professionalZurdoDev31-Aug-20 10:37 
AnswerRe: Help me! Pin
ZurdoDev31-Aug-20 10:38
professionalZurdoDev31-Aug-20 10:38 
AnswerRe: Help me! Pin
Afzaal Ahmad Zeeshan31-Aug-20 18:52
professionalAfzaal Ahmad Zeeshan31-Aug-20 18:52 
AnswerRe: Help me! Pin
Richard MacCutchan31-Aug-20 22:11
mveRichard MacCutchan31-Aug-20 22:11 
QuestionHow can I solve the following error: javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext; Pin
Member 1469623621-Jul-20 19:41
Member 1469623621-Jul-20 19:41 
AnswerRe: How can I solve the following error: javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext; Pin
Richard MacCutchan21-Jul-20 22:41
mveRichard MacCutchan21-Jul-20 22:41 
AnswerRe: How can I solve the following error: javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext; Pin
ZurdoDev31-Aug-20 10:37
professionalZurdoDev31-Aug-20 10:37 
QuestionBLOB TO MySQL Pin
Member 1489223717-Jul-20 7:28
Member 1489223717-Jul-20 7:28 
QuestionJava tuition/courses Pin
jopag80003-Jul-20 9:54
jopag80003-Jul-20 9:54 
AnswerRe: Java tuition/courses Pin
Richard MacCutchan10-Jul-20 23:08
mveRichard MacCutchan10-Jul-20 23:08 
QuestionSSLSocket.getInputStream() hangs when called Java 11 Pin
nrmad1-Jul-20 9:35
nrmad1-Jul-20 9:35 
AnswerMessage Closed Pin
17-Feb-22 0:05
Weent1917-Feb-22 0:05 
AnswerMessage Closed Pin
17-Feb-22 0:05
Weent1917-Feb-22 0:05 
QuestionIntegration Pin
GauravSahu911-Jul-20 1:39
GauravSahu911-Jul-20 1:39 
AnswerRe: Integration Pin
OriginalGriff1-Jul-20 1:41
mveOriginalGriff1-Jul-20 1:41 
QuestionHow to dynamically RDF resources in java ? Pin
Member 1487416726-Jun-20 9:26
Member 1487416726-Jun-20 9:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.