Make Spring-Boot's implicit autoconfiguration explicit
[examples/facebook-app] / src / main / java / de / juplo / yourshouter / AnonymousUserIdSource.java
diff --git a/src/main/java/de/juplo/yourshouter/AnonymousUserIdSource.java b/src/main/java/de/juplo/yourshouter/AnonymousUserIdSource.java
new file mode 100644 (file)
index 0000000..c09f400
--- /dev/null
@@ -0,0 +1,21 @@
+package de.juplo.yourshouter;
+
+import org.springframework.social.UserIdSource;
+
+
+/**
+ * Simple implementation of {@link UserIdSource}, that always returns the
+ * string <code>anonymous</code> as user-ID, like the UserIdSource, that is
+ * automatically configured by Spring-Boot, if Spring-Security is not
+ * present.
+ *
+ * @author Kai Moritz
+ */
+public class AnonymousUserIdSource implements UserIdSource
+{
+  @Override
+  public String getUserId()
+  {
+    return "anonymous";
+  }
+}