Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.orchestra.portale.externalauth; import java.util.Collection; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetails; /** * * @author barnap */ public class FbAuthentication implements Authentication { UserDetails user; Boolean authenticated; public FbAuthentication(User user) { this.user = user; this.authenticated = true; } @Override public Collection<? extends GrantedAuthority> getAuthorities() { return user.getAuthorities(); } @Override public Object getCredentials() { return user.getPassword(); } @Override public Object getDetails() { return user.getUsername(); } @Override public Object getPrincipal() { return user.getUsername(); } @Override public boolean isAuthenticated() { return this.authenticated; } @Override public void setAuthenticated(boolean bln) throws IllegalArgumentException { this.authenticated = bln; } @Override public String getName() { return user.getUsername(); } }