To access the api in this example, first we have to procure the Auth Token (using one of the OAuth2 Flows) containing a scope "canGreet".
Assumption is that the Authorization Server supports OpenId Connect 1.0 specifications.
To access the api in this example, first we have to procure the Auth Token (using one of the OAuth2 Flows) containing a scope "canGreet".
Assumption is that the Authorization Server supports OpenId Connect 1.0 specifications.
/* | |
* Self-Explanatory Protocol Buffer Lang Guide | |
*/ | |
/* | |
* Why Protocol Buffers? | |
* Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler. | |
* You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages. | |
* Protocol Buffers are Schema Of Messages. They are language agnostic. |
#include <iostream> | |
#include <stream_rt_handler.h> | |
/*https://github.com/gabime/spdlog*/ | |
#include "spdlog/spdlog.h" | |
/***Compile by ***/ | |
/** cd build **/ | |
/** g++ -DSPDLOG_FMT_PRINTF -std=c++11 ../sample_with_spdlog.cpp -lsrh -pthread **/ |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: nginx-conf | |
data: | |
nginx.conf: | | |
user nginx; | |
worker_processes 3; | |
error_log /var/log/nginx/error.log; | |
events { |
#include <stdio.h> | |
#include <pthread.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define THREAD_RUN 100 | |
typedef struct $ | |
{ | |
char s[50]; | |
} concurrent_update; |
from("timer://scheduler?period=30s") | |
.log("get access token") | |
.to("direct:authService"); | |
from("direct:authService").tracing() | |
.setHeader(Exchange.HTTP_PATH) | |
.simple("<auth service context>/oauth2/token") | |
.setHeader("CamelHttpMethod") | |
.simple("POST") | |
.setHeader("Content-Type") |
// Get all users | |
var url = "http://localhost:8080/api/v1/users"; | |
var xhr = new XMLHttpRequest() | |
xhr.open('GET', url, true) | |
xhr.onload = function () { | |
var users = JSON.parse(xhr.responseText); | |
if (xhr.readyState == 4 && xhr.status == "200") { | |
console.table(users); | |
} else { | |
console.error(users); |
#!/bin/bash | |
# | |
# Highligh Nginx config file in Vim | |
# Download syntax highlight | |
mkdir -p ~/.vim/syntax/ | |
wget http://www.vim.org/scripts/download_script.php?src_id=19394 -O ~/.vim/syntax/nginx.vim | |
# Set location of Nginx config file | |
cat > ~/.vim/filetype.vim <<EOF |