org.springframework.security.oauth2.provider.approval
Class TokenApprovalStore

java.lang.Object
  extended by org.springframework.security.oauth2.provider.approval.TokenApprovalStore
All Implemented Interfaces:
ApprovalStore

public class TokenApprovalStore
extends Object
implements ApprovalStore

An ApprovalStore that works with an existing TokenStore, extracting implicit Approvals from the content of tokens already in the store. Useful interface so that users can list and revoke approvals even if they are not really represented in such a way internally. For full fine-grained control of user approvals don't use a TokenStore at all, and don't use this ApprovalStore with Approval-based AuthorizationServerTokenServices implementations.

Author:
Dave Syer

Constructor Summary
TokenApprovalStore()
           
 
Method Summary
 boolean addApprovals(Collection<Approval> approvals)
          This implementation is a no-op.
 Collection<Approval> getApprovals(String userId, String clientId)
          Extract the implied approvals from any tokens associated with the user and client id supplied.
 boolean revokeApprovals(Collection<Approval> approvals)
          Revoke all tokens that match the client and user in the approvals supplied.
 void setTokenStore(TokenStore store)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TokenApprovalStore

public TokenApprovalStore()
Method Detail

setTokenStore

public void setTokenStore(TokenStore store)
Parameters:
store - the token store to set

addApprovals

public boolean addApprovals(Collection<Approval> approvals)
This implementation is a no-op. We assume that the TokenStore is populated elsewhere, by (for example) a token services instance that knows more about granted tokens than we could possibly infer from the approvals.

Specified by:
addApprovals in interface ApprovalStore
See Also:
ApprovalStore.addApprovals(java.util.Collection)

revokeApprovals

public boolean revokeApprovals(Collection<Approval> approvals)
Revoke all tokens that match the client and user in the approvals supplied.

Specified by:
revokeApprovals in interface ApprovalStore
See Also:
ApprovalStore.revokeApprovals(java.util.Collection)

getApprovals

public Collection<Approval> getApprovals(String userId,
                                         String clientId)
Extract the implied approvals from any tokens associated with the user and client id supplied.

Specified by:
getApprovals in interface ApprovalStore
See Also:
ApprovalStore.getApprovals(java.lang.String, java.lang.String)


Copyright © 2013. All rights reserved.