Mercurial > altnet-hispano
comparison Agendas/trunk/src/Agendas.Domain/IdentityContext.cs @ 115:7a2eeb9e9bf9
Crear cuenta interna asociada
author | Nelo@Kenia.neluz.int |
---|---|
date | Sun, 12 Jun 2011 01:40:09 -0300 |
parents | 0bca45e1e664 |
children | 1deccd6c3cb2 |
comparison
equal
deleted
inserted
replaced
114:1ce71844ffa4 | 115:7a2eeb9e9bf9 |
---|---|
25 } | 25 } |
26 } | 26 } |
27 | 27 |
28 public static string GetUserName() | 28 public static string GetUserName() |
29 { | 29 { |
30 string username = Current.GetUserName(); | 30 return Current.GetUserName(); |
31 if (string.IsNullOrWhiteSpace(username)) | 31 } |
32 throw new UsuarioNoAutenticadoException(); | 32 |
33 return username; | 33 public static bool IsAuthenticated() |
34 { | |
35 return !string.IsNullOrWhiteSpace(GetUserName()); | |
34 } | 36 } |
35 | 37 |
36 public static Persona GetUsuario() | 38 public static Persona GetUsuario() |
37 { | 39 { |
38 var identification = new Identification(GetUserName()); | 40 var userName = GetUserName(); |
41 if (string.IsNullOrWhiteSpace(userName)) | |
42 throw new UsuarioNoAutenticadoException(); | |
43 | |
44 var identification = new Identification(userName); | |
39 | 45 |
40 var cuenta = _personaRepository.GetCuenta(identification.IdentityProvider, identification.LogonName); | 46 var cuenta = _personaRepository.GetCuenta(identification.IdentityProvider, identification.LogonName); |
41 return cuenta != null ? cuenta.Persona : null; | 47 return cuenta != null ? cuenta.Persona : null; |
42 } | 48 } |
43 } | 49 } |