Package com.mustafaiev.tair.cts.service

Source Code of com.mustafaiev.tair.cts.service.CostsTrackingSystemUserDetailsService

package com.mustafaiev.tair.cts.service;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

import com.mustafaiev.tair.cts.dto.PayerDTO;
import com.mustafaiev.tair.cts.exeption.DataNotRetrievedException;

public class CostsTrackingSystemUserDetailsService implements
    UserDetailsService {

  private static final Logger LOGGER = Logger
      .getLogger(CostsTrackingSystemUserDetailsService.class);

  @Autowired
  private PayerService payerService;

  @Override
  public UserDetails loadUserByUsername(final String email)
      throws UsernameNotFoundException {
    PayerDTO payer = null;
    try {
      payer = this.payerService.retrieveActiveByEmail(email);
    } catch (final DataNotRetrievedException e) {
      LOGGER.error(e.getLocalizedMessage(), e);
    }
    return payer;
  }

}
TOP

Related Classes of com.mustafaiev.tair.cts.service.CostsTrackingSystemUserDetailsService

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.