annotate Agendas/trunk/src/Agendas.Domain/IdentityContext.cs @ 54:3059a5f8930f

Code cleanup
author nelopauselli
date Sat, 14 May 2011 13:01:24 -0300
parents 3ebe89c88caa
children db4b1e2cae49
rev   line source
50
3ebe89c88caa Agregando propiedad al Evento sobre el Usuario que lo crea o que realizó la
nelopauselli
parents:
diff changeset
1 using AltNetHispano.Agendas.Domain.Exceptions;
3ebe89c88caa Agregando propiedad al Evento sobre el Usuario que lo crea o que realizó la
nelopauselli
parents:
diff changeset
2
3ebe89c88caa Agregando propiedad al Evento sobre el Usuario que lo crea o que realizó la
nelopauselli
parents:
diff changeset
3 namespace AltNetHispano.Agendas.Domain
3ebe89c88caa Agregando propiedad al Evento sobre el Usuario que lo crea o que realizó la
nelopauselli
parents:
diff changeset
4 {
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
5 public class IdentityContext
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
6 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
7 private static ISeguridad _current;
50
3ebe89c88caa Agregando propiedad al Evento sobre el Usuario que lo crea o que realizó la
nelopauselli
parents:
diff changeset
8
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
9 public static ISeguridad Current
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
10 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
11 private get
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
12 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
13 if (_current == null)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
14 throw new IdentityContextNotConfiguredException();
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
15 return _current;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
16 }
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
17 set { _current = value; }
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
18 }
50
3ebe89c88caa Agregando propiedad al Evento sobre el Usuario que lo crea o que realizó la
nelopauselli
parents:
diff changeset
19
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
20 public static string GetUserName()
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
21 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
22 string username = Current.GetUserName();
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
23 if (string.IsNullOrWhiteSpace(username))
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
24 throw new UsuarioNoAutenticadoException();
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
25 return username;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
26 }
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
27 }
50
3ebe89c88caa Agregando propiedad al Evento sobre el Usuario que lo crea o que realizó la
nelopauselli
parents:
diff changeset
28 }