summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/kernel
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-09-06 07:45:00 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-09-06 07:45:00 +0000
commit2d574d2281d05383e646f20147adbc3ca8934430 (patch)
tree194c6dcfdfb0bbbaf6dd439dcd95bb6235b9a3eb /sca-cpp/trunk/kernel
parente6c50210013371ca5c1e45e4c86178a1fc212d49 (diff)
Strawman implementation of the OAuth 2.0 protocol. Minor improvements to the OpenID support and changes to enable it to co-exist with OAuth.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@992963 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/kernel')
-rw-r--r--sca-cpp/trunk/kernel/value.hpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/sca-cpp/trunk/kernel/value.hpp b/sca-cpp/trunk/kernel/value.hpp
index 24688648d2..211873ef0c 100644
--- a/sca-cpp/trunk/kernel/value.hpp
+++ b/sca-cpp/trunk/kernel/value.hpp
@@ -28,6 +28,8 @@
#include <stdlib.h>
#include <apr_uuid.h>
+#include <apr_time.h>
+
#include "string.hpp"
#include "sstream.hpp"
#include "gc.hpp"
@@ -601,5 +603,22 @@ const value mkuuid() {
return value(string(buf, APR_UUID_FORMATTED_LENGTH));
}
+/**
+ * Make a random alphanumeric value.
+ */
+const int intrand() {
+ const apr_uint64_t now = apr_time_now();
+ srand((unsigned int)(((now >> 32) ^ now) & 0xffffffff));
+ return rand() & 0x0FFFF;
+}
+
+const value mkrand() {
+ char buf[32];
+ const char* an = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ for (int i =0; i < 32; i++)
+ buf[i] = an[intrand() % 62];
+ return value(string(buf, 32));
+}
+
}
#endif /* tuscany_value_hpp */