[java-opensaml COMMIT] /trunk/opensaml-profile-api/src/main/java/org/opensaml/profile/context/ProfileRequestContext.java
noreply at shibboleth.net
noreply at shibboleth.net
Mon Aug 11 21:45:33 EDT 2014
Author: scantor
Date: Mon Aug 11 21:45:33 2014
New Revision: 3998
URL: http://svn.shibboleth.net/view/java-opensaml?rev=3998&view=rev
Log:
Add a logging label to each request.
Modified:
trunk/opensaml-profile-api/src/main/java/org/opensaml/profile/context/ProfileRequestContext.java
Modified: trunk/opensaml-profile-api/src/main/java/org/opensaml/profile/context/ProfileRequestContext.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-profile-api/src/main/java/org/opensaml/profile/context/ProfileRequestContext.java?rev=3998&r1=3997&r2=3998&view=diff
==============================================================================
--- trunk/opensaml-profile-api/src/main/java/org/opensaml/profile/context/ProfileRequestContext.java (original)
+++ trunk/opensaml-profile-api/src/main/java/org/opensaml/profile/context/ProfileRequestContext.java Mon Aug 11 21:45:33 2014
@@ -45,12 +45,16 @@
/** Unique identifier for the profile/operation/function of the current request. */
private String profileId;
+ /** Logging label for the profile/operation/function . */
+ private String loggingId;
+
/** Whether the current profile request is browser-based. */
private boolean browserProfile;
/** Constructor. */
public ProfileRequestContext() {
profileId = ANONYMOUS_PROFILE_ID;
+ loggingId = ANONYMOUS_PROFILE_ID;
}
/**
@@ -72,10 +76,39 @@
if (trimmedId == null) {
profileId = ANONYMOUS_PROFILE_ID;
} else {
- profileId = id;
+ profileId = trimmedId;
}
}
+ /**
+ * Get the logging ID of the profile used by the current request.
+ *
+ * <p>The logging ID is used for audit logging and may be used for other
+ * logging-related functions such as in diagnostic contexts.</p>
+ *
+ * @return ID of the profile used for logging
+ */
+ @Nonnull @NotEmpty public String getLoggingId() {
+ return loggingId;
+ }
+
+ /**
+ * Set the logging ID of the profile used by the current request.
+ *
+ * <p>The logging ID is used for audit logging and may be used for other
+ * logging-related functions such as in diagnostic contexts.</p>
+ *
+ * @param id ID of the profile used for logging
+ */
+ public void setLoggingId(@Nullable final String id) {
+ final String trimmedId = StringSupport.trimOrNull(id);
+ if (trimmedId == null) {
+ loggingId = ANONYMOUS_PROFILE_ID;
+ } else {
+ loggingId = trimmedId;
+ }
+ }
+
/**
* Get whether the current profile request is browser-based (defaults to false).
*
More information about the commits
mailing list