This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Observable } from 'rxjs/Observable'; | |
import { KeycloakApiService } from './keycloak/keycloak-api.service'; | |
import { IsLoggedInCheck } from './keycloak/keycloak.actions'; | |
import { selectKeycloakModel } from './keycloak/keycloak.reducer'; | |
import { AppState } from './reducers'; | |
import { Store } from '@ngrx/store'; | |
import { Injectable } from '@angular/core'; | |
import { | |
CanActivate, Router, | |
ActivatedRouteSnapshot, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Observable } from 'rxjs/Observable'; | |
import { KeycloakApiService } from '../keycloak/keycloak-api.service'; | |
import { HttpClient, HttpHeaders } from '@angular/common/http'; | |
import { Injectable } from '@angular/core'; | |
@Injectable() | |
export class CustomHttp { | |
private apiBaseUrl = `Your API Endpoint`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface KeycloakModel { | |
readonly isLoggedIn: boolean; | |
readonly showLoading: boolean; | |
readonly id: string; | |
readonly needsLogin: boolean; | |
} | |
export interface KeycloakLoginCheckResponse { | |
loggedIn: boolean; | |
idmId: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" | |
src="<%= htmlWebpackPlugin.options.keycloakUrl %>/auth/js/keycloak.min.js"></script> |
NewerOlder