Skip to content

Instantly share code, notes, and snippets.

@ShankarSumanth
ShankarSumanth / Git-log-commands
Last active August 11, 2017 13:40
Git Log commands
# From https://coderwall.com/p/euwpig/a-better-git-log
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
# add it to globalconfig
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
# rest head
git reset --hard HEAD^
# reset head by number of commits
@ShankarSumanth
ShankarSumanth / ng-keycloak-setup.txt
Last active April 22, 2018 04:11
angular-keycloak-tutorial
git clone https://github.com/qdouble/angular-webpack-starter.git angular-keycloak
cd angular-keycloak
npm install
npm run start:hmr
<script type="text/javascript"
src="<%= htmlWebpackPlugin.options.keycloakUrl %>/auth/js/keycloak.min.js"></script>
{
"realm": "name of the realm",
"auth-server-url": "keycloak authorization endpoint",
"ssl-required": "external",
"resource": "name of the resource",
"public-client": true,
"use-resource-role-mappings": true
}
import { KeycloakLoginCheckResponse } from './../keycloak/keycloak.model';
import { Observable } from 'rxjs/Observable';
import { Injectable } from '@angular/core';
import './keycloak';
import { Observer } from 'rxjs/Observer';
declare const Keycloak: any;
@Injectable()
export class KeycloakApiService {
import { KeycloakLoginCheckResponse } from './keycloak.model';
import { Response } from '@angular/http';
import { Action } from '@ngrx/store';
export enum KeycloakActionTypes {
IsLoggedInCheck = '[Keycloak] Is Loggedin Check',
IsLoggedInCheckSuccess = '[Keycloak] Is Logged In Check Success',
IsLoggedInCheckFail = '[Keycloak] Is Logged In Check Fail',
Login = '[Keycloak] Login',
LoginSuccess = '[Keycloak] Login Success',
import { KeycloakActionTypes, IsLoggedInCheckSuccess, LoginSuccess } from './keycloak.actions';
import { KeycloakApiService } from './keycloak-api.service';
/* tslint:disable: member-ordering */
import { Injectable } from '@angular/core';
import { Actions, Effect } from '@ngrx/effects';
import { Store } from '@ngrx/store';
import { Observable } from 'rxjs/Observable';
import {
IsLoggedInCheck
import { AppState } from '../reducers';
/* tslint:disable: no-switch-case-fall-through */
import { Action } from '@ngrx/store';
import { KeycloakActions, KeycloakActionTypes, LoginSuccess } from './keycloak.actions';
import { KeycloakModel } from './keycloak.model';
export interface KeycloakState {
keycloakModel: KeycloakModel;
checkingKeycloakStatus: boolean;
export interface KeycloakModel {
readonly isLoggedIn: boolean;
readonly showLoading: boolean;
readonly id: string;
readonly needsLogin: boolean;
}
export interface KeycloakLoginCheckResponse {
loggedIn: boolean;
idmId: string;
import {
StoreModule,
ActionReducerMap,
MetaReducer,
createFeatureSelector,
createSelector
} from '@ngrx/store';
import { Params, RouterStateSnapshot } from '@angular/router';
import { compose } from '@ngrx/store';
import { ActionReducer, combineReducers } from '@ngrx/store';