com.github.inspektr.common.spi
Interface PrincipalResolver


public interface PrincipalResolver

An SPI interface needed to be implemented by individual applications requiring an audit trail record keeping functionality, to provide a currently authenticated principal performing an audit-able action.

Since:
1.0
Version:
$Revision$ $Date$
Author:
Dmitriy Kopylenko, Scott Battaglia

Field Summary
static String ANONYMOUS_USER
          Default String that can be used when the user is anonymous.
static String UNKNOWN_USER
          Default String that can be used when the user cannot be determined.
 
Method Summary
 String resolve()
          Called when there is no other way to resolve the principal (i.e.
 String resolveFrom(org.aspectj.lang.JoinPoint auditTarget, Exception exception)
          Resolve the principal performing an audit-able action that has incurred an exception.
 String resolveFrom(org.aspectj.lang.JoinPoint auditTarget, Object returnValue)
          Resolve the principal performing an audit-able action.
 

Field Detail

ANONYMOUS_USER

static final String ANONYMOUS_USER
Default String that can be used when the user is anonymous.

See Also:
Constant Field Values

UNKNOWN_USER

static final String UNKNOWN_USER
Default String that can be used when the user cannot be determined.

See Also:
Constant Field Values
Method Detail

resolveFrom

String resolveFrom(org.aspectj.lang.JoinPoint auditTarget,
                   Object returnValue)
Resolve the principal performing an audit-able action.

Note, this method should NEVER throw an exception *unless* the expectation is that a failed resolution causes the entire transaction to fail. Otherwise use UNKNOWN_USER.

Parameters:
auditTarget - the join point where we're auditing.
returnValue - the returned value
Returns:
The principal as a String. CANNOT be NULL.

resolveFrom

String resolveFrom(org.aspectj.lang.JoinPoint auditTarget,
                   Exception exception)
Resolve the principal performing an audit-able action that has incurred an exception.

Note, this method should NEVER throw an exception *unless* the expectation is that a failed resolution causes the entire transaction to fail. Otherwise use UNKNOWN_USER.

Parameters:
auditTarget - the join point where we're auditing.
exception - The exception incurred when the join point proceeds.
Returns:
The principal as a String. CANNOT be NULL.

resolve

String resolve()
Called when there is no other way to resolve the principal (i.e. an error was captured, auditing was not called, etc.)

Note, this method should NEVER throw an exception *unless* the expectation is that a failed resolution causes the entire transaction to fail. Otherwise use UNKNOWN_USER.

Returns:
the principal. CANNOT be NULL.


Copyright © 2007-2012 Rutgers, the State University of New Jersey. All Rights Reserved.