io.buji.oauth
Class OAuthRealm

java.lang.Object
  extended by org.apache.shiro.realm.CachingRealm
      extended by org.apache.shiro.realm.AuthenticatingRealm
          extended by org.apache.shiro.realm.AuthorizingRealm
              extended by io.buji.oauth.OAuthRealm
All Implemented Interfaces:
org.apache.shiro.authc.LogoutAware, org.apache.shiro.authz.Authorizer, org.apache.shiro.authz.permission.PermissionResolverAware, org.apache.shiro.authz.permission.RolePermissionResolverAware, org.apache.shiro.cache.CacheManagerAware, org.apache.shiro.realm.Realm, org.apache.shiro.util.Initializable, org.apache.shiro.util.Nameable

public class OAuthRealm
extends org.apache.shiro.realm.AuthorizingRealm

This realm implementation is dedicated to OAuth authentication. It acts on OAuth credential after user authenticates at the OAuth provider (Facebook, Twitter...) and finishes the OAuth authentication process by getting the user profile from the OAuth provider.

Since:
1.0.0
Author:
Jerome Leleu

Constructor Summary
OAuthRealm()
           
 
Method Summary
protected  org.apache.shiro.authc.AuthenticationInfo doGetAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken authenticationToken)
          Authenticates a user and retrieves its user profile.
protected  org.apache.shiro.authz.AuthorizationInfo doGetAuthorizationInfo(org.apache.shiro.subject.PrincipalCollection principals)
          Retrieves the AuthorizationInfo for the given principals.
 void setDefaultPermissions(String defaultPermissions)
           
 void setDefaultRoles(String defaultRoles)
           
 void setProvider(org.scribe.up.provider.OAuthProvider provider)
           
protected  List<String> split(String s)
          Split a string into a list of not empty and trimmed strings, delimiter is a comma.
 
Methods inherited from class org.apache.shiro.realm.AuthorizingRealm
afterCacheManagerSet, checkPermission, checkPermission, checkPermission, checkPermissions, checkPermissions, checkPermissions, checkRole, checkRole, checkRoles, checkRoles, checkRoles, clearCachedAuthorizationInfo, doClearCache, getAuthorizationCache, getAuthorizationCacheKey, getAuthorizationCacheName, getAuthorizationInfo, getPermissionResolver, getRolePermissionResolver, hasAllRoles, hasRole, hasRole, hasRoles, hasRoles, isAuthorizationCachingEnabled, isPermitted, isPermitted, isPermitted, isPermitted, isPermitted, isPermittedAll, isPermittedAll, isPermittedAll, onInit, setAuthorizationCache, setAuthorizationCacheName, setAuthorizationCachingEnabled, setName, setPermissionResolver, setRolePermissionResolver
 
Methods inherited from class org.apache.shiro.realm.AuthenticatingRealm
assertCredentialsMatch, clearCachedAuthenticationInfo, getAuthenticationCache, getAuthenticationCacheKey, getAuthenticationCacheKey, getAuthenticationCacheName, getAuthenticationInfo, getAuthenticationTokenClass, getCredentialsMatcher, init, isAuthenticationCachingEnabled, isAuthenticationCachingEnabled, setAuthenticationCache, setAuthenticationCacheName, setAuthenticationCachingEnabled, setAuthenticationTokenClass, setCredentialsMatcher, supports
 
Methods inherited from class org.apache.shiro.realm.CachingRealm
clearCache, getAvailablePrincipal, getCacheManager, getName, isCachingEnabled, onLogout, setCacheManager, setCachingEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.shiro.util.Initializable
init
 

Constructor Detail

OAuthRealm

public OAuthRealm()
Method Detail

doGetAuthenticationInfo

protected org.apache.shiro.authc.AuthenticationInfo doGetAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken authenticationToken)
                                                                     throws org.apache.shiro.authc.AuthenticationException
Authenticates a user and retrieves its user profile.

Specified by:
doGetAuthenticationInfo in class org.apache.shiro.realm.AuthenticatingRealm
Parameters:
authenticationToken - the authentication token
Throws:
org.apache.shiro.authc.AuthenticationException - if there is an error during authentication.

doGetAuthorizationInfo

protected org.apache.shiro.authz.AuthorizationInfo doGetAuthorizationInfo(org.apache.shiro.subject.PrincipalCollection principals)
Retrieves the AuthorizationInfo for the given principals.

Specified by:
doGetAuthorizationInfo in class org.apache.shiro.realm.AuthorizingRealm
Parameters:
principals - the primary identifying principals of the AuthorizationInfo that should be retrieved.
Returns:
the AuthorizationInfo associated with this principals.

split

protected List<String> split(String s)
Split a string into a list of not empty and trimmed strings, delimiter is a comma.

Parameters:
s - the input string
Returns:
the list of not empty and trimmed strings

setProvider

public void setProvider(org.scribe.up.provider.OAuthProvider provider)

setDefaultRoles

public void setDefaultRoles(String defaultRoles)

setDefaultPermissions

public void setDefaultPermissions(String defaultPermissions)


Copyright © 2012. All Rights Reserved.