|  |  |  | 
|---|
|  |  |  | package com.genersoft.iot.vmp.conf.security; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.genersoft.iot.vmp.conf.security.dto.LoginUser; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.storager.dao.dto.User; | 
|---|
|  |  |  | import gov.nist.javax.sip.address.UserInfo; | 
|---|
|  |  |  | import org.springframework.security.authentication.AuthenticationManager; | 
|---|
|  |  |  | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; | 
|---|
|  |  |  | import org.springframework.security.core.Authentication; | 
|---|
|  |  |  | 
|---|
|  |  |  | Authentication authentication = getAuthentication(); | 
|---|
|  |  |  | if(authentication!=null){ | 
|---|
|  |  |  | Object principal = authentication.getPrincipal(); | 
|---|
|  |  |  | if(principal!=null){ | 
|---|
|  |  |  | if(principal!=null && !"anonymousUser".equals(principal)){ | 
|---|
|  |  |  | LoginUser user = (LoginUser) authentication.getPrincipal(); | 
|---|
|  |  |  | return user; | 
|---|
|  |  |  | } | 
|---|