All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ar4k.agent.spring.EdgeUserDetailsService Maven / Gradle / Ivy

There is a newer version: 0.9.1014
Show newest version
package org.ar4k.agent.spring;

import org.ar4k.agent.core.Homunculus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.ReactiveUserDetailsService;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Component;

import reactor.core.publisher.Mono;

@Component
public class EdgeUserDetailsService implements ReactiveUserDetailsService {

  @Autowired
  Homunculus homunculus;

  @Override
  public Mono findByUsername(String username) {
    UserDetails result = null; // anonymous for spring
    for (EdgeUserDetails q : homunculus.getLocalUsers()) {
      if (q.getUsername().equals(username)) {
        result = q;
        break;
      }
    }
    return Mono.just(result);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy