Click here to Skip to main content
15,881,757 members
Home / Discussions / Java
   

Java

 
AnswerRe: 2d java graphics Pin
CHill601-Oct-20 2:09
mveCHill601-Oct-20 2:09 
AnswerRe: 2d java graphics Pin
Richard MacCutchan1-Oct-20 3:02
mveRichard MacCutchan1-Oct-20 3:02 
Questionjava programmimg Pin
Member 1494135617-Sep-20 19:36
Member 1494135617-Sep-20 19:36 
AnswerRe: java programmimg Pin
Member 1494135617-Sep-20 19:39
Member 1494135617-Sep-20 19:39 
AnswerRe: java programmimg Pin
Sandeep Mewara17-Sep-20 20:23
mveSandeep Mewara17-Sep-20 20:23 
AnswerRe: java programmimg Pin
Gerry Schmitz18-Sep-20 0:44
mveGerry Schmitz18-Sep-20 0:44 
GeneralRe: java programmimg Pin
Dave Kreskowiak18-Sep-20 4:33
mveDave Kreskowiak18-Sep-20 4:33 
QuestionIntegrating keycloak with spring security Pin
arunken16-Sep-20 21:30
arunken16-Sep-20 21: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 8:30
Member 1492738231-Aug-20 8:30 
AnswerRe: Help me! Pin
ZurdoDev31-Aug-20 9:37
professionalZurdoDev31-Aug-20 9:37 
AnswerRe: Help me! Pin
ZurdoDev31-Aug-20 9:38
professionalZurdoDev31-Aug-20 9:38 
AnswerRe: Help me! Pin
Afzaal Ahmad Zeeshan31-Aug-20 17:52
professionalAfzaal Ahmad Zeeshan31-Aug-20 17:52 
AnswerRe: Help me! Pin
Richard MacCutchan31-Aug-20 21:11
mveRichard MacCutchan31-Aug-20 21: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 18:41
Member 1469623621-Jul-20 18: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 21:41
mveRichard MacCutchan21-Jul-20 21: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 9:37
professionalZurdoDev31-Aug-20 9:37 
QuestionBLOB TO MySQL Pin
Member 1489223717-Jul-20 6:28
Member 1489223717-Jul-20 6:28 
QuestionJava tuition/courses Pin
jopag80003-Jul-20 8:54
jopag80003-Jul-20 8:54 
AnswerRe: Java tuition/courses Pin
Richard MacCutchan10-Jul-20 22:08
mveRichard MacCutchan10-Jul-20 22:08 
QuestionSSLSocket.getInputStream() hangs when called Java 11 Pin
nrmad1-Jul-20 8:35
nrmad1-Jul-20 8:35 
AnswerMessage Closed Pin
16-Feb-22 23:05
Weent1916-Feb-22 23:05 
AnswerMessage Closed Pin
16-Feb-22 23:05
Weent1916-Feb-22 23:05 
QuestionIntegration Pin
GauravSahu911-Jul-20 0:39
GauravSahu911-Jul-20 0:39 
AnswerRe: Integration Pin
OriginalGriff1-Jul-20 0:41
mveOriginalGriff1-Jul-20 0:41 
QuestionHow to dynamically RDF resources in java ? Pin
Member 1487416726-Jun-20 8:26
Member 1487416726-Jun-20 8: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.