Package org.beangle.security.monitor.impl

Source Code of org.beangle.security.monitor.impl.AuthorityListener

package org.beangle.security.monitor.impl;

import org.beangle.security.monitor.Authentication;
import org.beangle.security.monitor.AuthorityManager;
import org.beangle.security.monitor.OnlineActivity;
import org.beangle.security.monitor.auth.provider.AbstractAuthenticationListener;
import org.beangle.security.monitor.auth.ui.UserDetails;

public class AuthorityListener extends AbstractAuthenticationListener {
  protected AuthorityManager authorityManager;

  public void afterAuthenticate(Authentication auth) {
    UserDetails details = (UserDetails) auth.getDetails();
    authorityManager.registerAuthorities(details.getUserid());
  }

  public void afterRemove(OnlineActivity activity) {
    if (!authenticationManager.getSessionController().isRegisted(activity.getPrincipal())) {
      authorityManager.removeAuthorities(activity.getUserid());
    }
  }

  public AuthorityManager getAuthorityManager() {
    return authorityManager;
  }

  public void setAuthorityManager(AuthorityManager authorityManager) {
    this.authorityManager = authorityManager;
  }

}
TOP

Related Classes of org.beangle.security.monitor.impl.AuthorityListener

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.