Changeset 902


Ignore:
Timestamp:
11/15/10 14:44:05 (14 years ago)
Author:
oschonef
Message:
  • store Principal in session
File:
1 edited

Legend:

Unmodified
Added
Removed
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/ApplicationSession.java

    r877 r902  
    1414    private static final Roles ROLES_ADMIN =
    1515        new Roles(new String[] { Roles.USER, Roles.ADMIN});
    16     private String user = null;
     16    private Principal principal;
    1717    private boolean isAdmin;
    1818   
     
    2525        if (principal != null) {
    2626            result = signIn(principal.getName(), null);
    27             // XXX: possibly do something with attributes
     27            if (result) {
     28                // XXX: possibly do something with attributes
     29                this.principal = principal;
     30                this.isAdmin =
     31                    ((Application) getApplication()).isAdmin(getUser());
     32            }
    2833        }
    2934        return result;
     
    3338    public boolean authenticate(String username, String password) {
    3439        if (username != null) {
    35             user = username;
    36             isAdmin = ((Application) getApplication()).isAdmin(username);
    3740            replaceSession();
    3841            return true;
     
    4952    }
    5053
     54    public Principal getPrincipal() {
     55        return principal;
     56    }
     57
    5158    public String getUser() {
    52         return user;
     59        return principal.getName();
    5360    }
    5461
Note: See TracChangeset for help on using the changeset viewer.