Skip to content

Instantly share code, notes, and snippets.

@tecsyscom
tecsyscom / gist:f0b5cce84821ad715d89532865376074
Created April 12, 2017 14:01
sample SAML request from keyCloak
<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Destination="https://signin.aws.amazon.com/saml" ID="ID_15d519a5-88ac-4d2d-8206-409e570a0987" IssueInstant="2017-04-12T09:36:17.883Z" Version="2.0"><saml:Issuer>http://127.0.0.1:8080/auth/realms/aws</saml:Issuer><dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:SignedInfo><dsig:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><dsig:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><dsig:Reference URI="#ID_15d519a5-88ac-4d2d-8206-409e570a0987"><dsig:Transforms><dsig:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/><dsig:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><dsig:DigestValue>3cCxC7wj/4NIZAvVdU1xdlbfihU7q5OllDCLJ1TdbUw=</dsig:DigestValue></dsig:Reference></dsig:SignedInfo><dsig:Si
@tecsyscom
tecsyscom / component.js
Last active April 14, 2017 14:59
no ES6
import React from 'react';
var SomeMixin = {
doSomething() {
}
};
const App = React.createClass({
getInitialState: function() {
@tecsyscom
tecsyscom / App.js
Created April 14, 2017 14:44
component App with ES6 or not with ES6
import React from 'react';
const App = () => (
<div>
<AddTodo />
<VisibleTodoList />
<Footer />
</div>
)
//or
@tecsyscom
tecsyscom / configStore.js
Created April 14, 2017 16:03
configstore for redux
import { createStore, applyMiddleware } from 'redux'
import thunkMiddleware from 'redux-thunk'
import createLogger from 'redux-logger'
import rootReducer from './reducers'
const loggerMiddleware = createLogger()
export default function configureStore(preloadedState) {
return createStore(
rootReducer,
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="https://fb.me/react-0.14.0.min.js"></script>
<script src="https://fb.me/react-dom-0.14.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.5.2/redux.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-redux/4.4.5/react-redux.min.js"></script>
<script src="https://npmcdn.com/xstream@9.0.0/dist/xstream.min.js"></script>
[INFO]
[INFO] --- maven-shade-plugin:2.3:shade (default) @ keycloak-admin-cli ---
[INFO] Including org.jboss.aesh:aesh:jar:0.66.15 in the shaded jar.
[INFO] Including org.fusesource.jansi:jansi:jar:1.11 in the shaded jar.
[INFO] Including org.keycloak:keycloak-core:jar:3.1.0.CR1-SNAPSHOT in the shaded jar.
[INFO] Including org.keycloak:keycloak-common:jar:3.1.0.CR1-SNAPSHOT in the shaded jar.
[INFO] Including org.bouncycastle:bcprov-jdk15on:jar:1.52 in the shaded jar.
[INFO] Including org.bouncycastle:bcpkix-jdk15on:jar:1.52 in the shaded jar.
[INFO] Including com.fasterxml.jackson.core:jackson-core:jar:2.5.4 in the shaded jar.
[INFO] Including com.fasterxml.jackson.core:jackson-databind:jar:2.5.4 in the shaded jar.
at org.keycloak.adapters.saml.profile.AbstractSamlAuthenticationHandler.handleLoginResponse(AbstractSamlAuthenticationHandler.java:360)
at org.keycloak.adapters.saml.profile.AbstractSamlAuthenticationHandler.handleSamlResponse(AbstractSamlAuthenticationHandler.java:213)
at org.keycloak.adapters.saml.profile.webbrowsersso.SamlEndpoint.handle(SamlEndpoint.java:44)
at org.keycloak.adapters.saml.SamlAuthenticator.authenticate(SamlAuthenticator.java:48)
at org.keycloak.adapters.saml.undertow.AbstractSamlAuthMech.authenticate(AbstractSamlAuthMech.java:115)
at io.undertow.security.impl.SecurityContextImpl$AuthAttempter.transition(SecurityContextImpl.java:233)
at io.undertow.security.impl.SecurityContextImpl$AuthAttempter.transition(SecurityContextImpl.java:250)
at io.undertow.security.impl.SecurityContextImpl$AuthAttempter.access$100(SecurityContextImpl.java:219)
at io.undertow.security.impl.SecurityContextImpl.attemptAuthentication(SecurityContextImpl.java:121)
at io.undertow.security.impl.SecurityContext
lient_id=customer-portal&redirect_uri=http%3A%2F%2Flocalhost%3A8082%2Fcustomer-portal&state=c44f4753-9c18-416d-be48-d3e82af5d64e&login=true&scope=openid
20:15:21,519 ERROR [org.keycloak.adapters.BearerTokenRequestAuthenticator] Failed to verify token
org.keycloak.common.VerificationException: Token type is incorrect. Expected 'Bearer' but was 'Refresh'
at org.keycloak.TokenVerifier.verify(TokenVerifier.java:160)
at org.keycloak.RSATokenVerifier.verify(RSATokenVerifier.java:89)
at org.keycloak.adapters.rotation.AdapterRSATokenVerifier.verifyToken(AdapterRSATokenVerifier.java:56)
at org.keycloak.adapters.rotation.AdapterRSATokenVerifier.verifyToken(AdapterRSATokenVerifier.java:37)
at org.keycloak.adapters.BearerTokenRequestAuthenticator.authenticateToken(BearerTokenRequestAuthenticator.java:87)
at org.keycloak.adapters.BearerTokenRequestAuthenticator.authenticate(BearerTokenRequestAuthenticator.java:82)
at org.keycloak.adapters.RequestAuthenticator.authenticate(RequestAuthenticator.java:68)
➜ saml ls
README.md post-with-encryption redirect-with-signature testsaml.json
pom.xml post-with-signature servlet-filter
➜ saml mvn install wildfly:deploy
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] SAML Examples
[INFO] Keycloak SAML Adapter Example POST Binding and Signatures
@tecsyscom
tecsyscom / gist:54e2380ba35ee66d73ad62b5c05a6adb
Created April 17, 2017 07:38
fail to install keycloak app in wildfly
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.700 s
[INFO] Finished at: 2017-04-17T15:33:51+08:00
[INFO] Final Memory: 27M/242M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.1.0.Final:deploy (default-cli) on project examples-basicauth: Execution default-cli of goal org.wildfly.plugins:wildfly-maven-plugin:1.1.0.Final:deploy failed: WFLYCTL0379: System boot is in process; execution of remote management operations is not currently available -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.