external Login with Spring Security

I got my simple spring security login:

@Configuration

public class ServiceConfig extends GlobalAuthenticationConfigurerAdapter {

public void init(AuthenticationManagerBuilder auth) throws Exception {

auth.inMemoryAuthentication()

.withUser("username").password("{noop}"+ "key").roles("USER");

}

}

@Override

protected void configure(HttpSecurity http) throws Exception {

http

.authorizeRequests()

.antMatchers("/cont/**").access("hasRole('USER')")

.and()

.formLogin()

.loginPage("/login").defaultSuccessUrl("/login-success", true)

.failureUrl("/failLogin.html")

.permitAll()

.and()

.logout().logoutUrl("/logout").permitAll()

.and()

.csrf()

.disable();

}

My problem is, I got an external login that I need to use:

//Do KeydoxLogin

@PostMapping("/doLogon")

public void doLogonKdx(@RequestBody KeyData msg) {

KdxFunctions logon = new KdxFunctions();

//My external login on keydox server - works just fine

boolean doLogon = logon.doLogon(msg.getName(), msg.getKey());

// Hand over my login data through angularJS

if(doLogon) {

System.out.println("success!");

// Shows success if logon returns true - just so I can see

}else {

System.out.println("failed!");

// Shows faield if logon returns false...

Read More »

By: StackOverFlow - Wednesday, 7 November

Related Posts