Skip to content

Commit

Permalink
Merge pull request #4 from MohamedBoukthir/keyclock
Browse files Browse the repository at this point in the history
implement : finish keycloak integration
  • Loading branch information
MohamedBoukthir authored Jun 8, 2024
2 parents df08b11 + 48b77f8 commit 7975b2d
Show file tree
Hide file tree
Showing 52 changed files with 2,406 additions and 387 deletions.
10 changes: 0 additions & 10 deletions .idea/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion .idea/dataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/discord.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 2 additions & 14 deletions .idea/readly.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions .idea/swagger-settings.xml

This file was deleted.

124 changes: 0 additions & 124 deletions .idea/uiDesigner.xml

This file was deleted.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ services:
ports:
- 1080:1080
- 1025:1025
networks:
- readly-network

keycloak:
container_name: keycloak-readly
image: quay.io/keycloak/keycloak:latest
ports:
- 9090:8080
environment:
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
networks:
- readly-network
command:
- "start-dev"

readly-api:
container_name: readly-api
Expand Down
23 changes: 23 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@auth0/angular-jwt": "^5.2.0",
"@fortawesome/fontawesome-free": "^6.5.2",
"angular-code-input": "^2.0.0",
"keycloak-js": "^24.0.5",
"ng-openapi-gen": "^0.51.0",
"rxjs": "~7.8.0",
"tailwind-scrollbar": "^3.1.0",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {ActivateAccountComponent} from "./pages/activate-account/activate-accoun
import {authGuard} from "./services/guard/auth.guard";

const routes: Routes = [
{path:'', redirectTo: 'books', pathMatch: 'full'},
{path: 'login', component: LoginComponent},
{path: 'register', component: RegisterComponent},
{path: 'activate-account', component: ActivateAccountComponent},
Expand Down
13 changes: 12 additions & 1 deletion frontend/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {NgModule} from '@angular/core';
import {APP_INITIALIZER, NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';

import {AppRoutingModule} from './app-routing.module';
Expand All @@ -11,6 +11,11 @@ import {ActivateAccountComponent} from './pages/activate-account/activate-accoun
import {CodeInputModule} from "angular-code-input";
import {NavbarComponent} from './components/navbar/navbar.component';
import {HttpTokenInterceptor} from "./services/interceptor/http-token.interceptor";
import {KeycloakService} from "./services/keycloak/keycloak.service";

export function kcFactory(kc: KeycloakService) {
return () => kc.init();
}

@NgModule({
bootstrap: [AppComponent],
Expand All @@ -36,6 +41,12 @@ import {HttpTokenInterceptor} from "./services/interceptor/http-token.intercepto
provide: HTTP_INTERCEPTORS,
useClass: HttpTokenInterceptor,
multi: true
},
{
provide: APP_INITIALIZER,
deps: [KeycloakService],
useFactory: kcFactory,
multi: true
}
]
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {Component} from '@angular/core';
import {KeycloakService} from "../../../../services/keycloak/keycloak.service";

@Component({
selector: 'app-navbar',
Expand All @@ -7,16 +8,19 @@ import {Component} from '@angular/core';
})
export class NavbarComponent {

constructor(
private keycloakService: KeycloakService,
) {}

menuHidden = true;
currentYear = new Date().getFullYear();

toggleMenu(): void {
this.menuHidden = !this.menuHidden;
}

logout() {
sessionStorage.clear();
window.location.reload();
async logout() {
this.keycloakService.logout();
}
}

Loading

0 comments on commit 7975b2d

Please sign in to comment.