This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit c9887a39 authored by Michael Breu's avatar Michael Breu :speech_balloon:
Browse files

NavigationBar aufräumen, Imports poliert

parent bfa4d71c
2 merge requests!17Initial Merge to Prepare Release 1.0.0,!1Resolve "Metadaten konsolideren"
...@@ -21,9 +21,7 @@ import org.springframework.security.core.authority.SimpleGrantedAuthority; ...@@ -21,9 +21,7 @@ import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.User;
import org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken;
import org.springframework.security.oauth2.client.authentication.OAuth2LoginAuthenticationToken; import org.springframework.security.oauth2.client.authentication.OAuth2LoginAuthenticationToken;
import org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
......
...@@ -4,25 +4,21 @@ import java.io.File; ...@@ -4,25 +4,21 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.security.Principal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.gitlab4j.api.Constants.TokenType;
import org.gitlab4j.api.GitLabApi; import org.gitlab4j.api.GitLabApi;
import org.gitlab4j.api.GitLabApiException; import org.gitlab4j.api.GitLabApiException;
import org.gitlab4j.api.models.AccessLevel; import org.gitlab4j.api.models.AccessLevel;
import org.gitlab4j.api.models.Permissions; import org.gitlab4j.api.models.Permissions;
import org.gitlab4j.api.models.Project; import org.gitlab4j.api.models.Project;
import org.gitlab4j.api.Constants.TokenType;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.oauth2.client.registration.ClientRegistration.ProviderDetails;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.FileCopyUtils; import org.springframework.util.FileCopyUtils;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
...@@ -31,8 +27,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -31,8 +27,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import at.ac.uibk.gitsearch.repository.search.MetaDataRepository; import at.ac.uibk.gitsearch.repository.search.MetaDataRepository;
import at.ac.uibk.gitsearch.repository.search.SearchRepositoryConstants;
import at.ac.uibk.gitsearch.security.SecurityUtils;
import at.ac.uibk.gitsearch.security.jwt.TokenProvider; import at.ac.uibk.gitsearch.security.jwt.TokenProvider;
import at.ac.uibk.gitsearch.service.dto.SearchInputDTO; import at.ac.uibk.gitsearch.service.dto.SearchInputDTO;
import at.ac.uibk.gitsearch.service.dto.SearchResultsDTO; import at.ac.uibk.gitsearch.service.dto.SearchResultsDTO;
......
...@@ -43,15 +43,16 @@ ...@@ -43,15 +43,16 @@
<!-- Menu Entities --> <!-- Menu Entities -->
<!--
<div class="nav-item dropdown"> <div class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#"> <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">
<!-- Icon --> <!-X- Icon -X->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-collection-fill" viewBox="0 0 16 16"> class="bi bi-collection-fill" viewBox="0 0 16 16">
<path <path
d="M0 13a1.5 1.5 0 0 0 1.5 1.5h13A1.5 1.5 0 0 0 16 13V6a1.5 1.5 0 0 0-1.5-1.5h-13A1.5 1.5 0 0 0 0 6v7zM2 3a.5.5 0 0 0 .5.5h11a.5.5 0 0 0 0-1h-11A.5.5 0 0 0 2 3zm2-2a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 0-1h-7A.5.5 0 0 0 4 1z"/> d="M0 13a1.5 1.5 0 0 0 1.5 1.5h13A1.5 1.5 0 0 0 16 13V6a1.5 1.5 0 0 0-1.5-1.5h-13A1.5 1.5 0 0 0 0 6v7zM2 3a.5.5 0 0 0 .5.5h11a.5.5 0 0 0 0-1h-11A.5.5 0 0 0 2 3zm2-2a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 0-1h-7A.5.5 0 0 0 4 1z"/>
</svg> </svg>
<!-- Icon End --> <!-X- Icon End -X->
Entities Entities
</a> (Vorlage) </a> (Vorlage)
<div class="dropdown-menu"> <div class="dropdown-menu">
...@@ -63,17 +64,18 @@ ...@@ -63,17 +64,18 @@
<span class="spawn-submenu">This is a short description of the link 3</span> <span class="spawn-submenu">This is a short description of the link 3</span>
</div> </div>
</div> </div>
-->
<!-- Menu Programs --> <!-- Menu Programs -->
<!--
<div class="nav-item dropdown"> <div class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#"> <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">
<!-- Icon --> <!-X- Icon -X->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-grid-3x3-gap-fill" viewBox="0 0 16 16"> class="bi bi-grid-3x3-gap-fill" viewBox="0 0 16 16">
<path <path
d="M1 2a1 1 0 0 1 1-1h2a1 1 0 0 1 1 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0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1v-2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2z"/>
</svg> </svg>
<!-- Icon End --> <! -X- Icon End -X- >
Programs Programs
</a> (Vorlage) </a> (Vorlage)
<div class="dropdown-menu dropdown-large"> <div class="dropdown-menu dropdown-large">
...@@ -115,7 +117,7 @@ ...@@ -115,7 +117,7 @@
</div> </div>
</div> </div>
</div> </div>
-->
<!-- Search --> <!-- Search -->
<div class="nav-item" > <div class="nav-item" >
<span class="nav-link"> <span class="nav-link">
...@@ -221,14 +223,14 @@ ...@@ -221,14 +223,14 @@
</a> </a>
<div class="dropdown-menu"> <div class="dropdown-menu">
<div class="search-container" *ngSwitchCase="false"> <div class="search-container" *ngSwitchCase="false">
<div *ngSwitchCase="false"> <div *ngSwitchCase="false" >
<!-- Quick Search --> <!-- Quick Search -->
<div class="dropdown-item"> <div class="dropdown-item" *ngFor="let config of configs">
<img src="/content/img/gitLab.png" style="width: 50px;"/> <img src="{{'oauth2.'+config.registrationId + '.icon'| translate}}" style="width: 50px;"/>
<button type="submit" class="btn btn-outline-secondary" <button type="submit" class="btn btn-outline-secondary"
*ngSwitchCase="false" (click)="loginWithGitLab()" *ngSwitchCase="false" (click)="loginWithGitLab(config.registrationId)"
jhiTranslate="global.menu.account.loginViaGitLab">Sign in with GitLab jhiTranslate="oauth2.{{config.registrationId}}.text">Sign in with GitLab
Account Account
</button> </button>
</div> </div>
<!-- Menu Divider --> <!-- Menu Divider -->
......
...@@ -11,6 +11,8 @@ import { LANGUAGES } from 'app/core/language/language.constants'; ...@@ -11,6 +11,8 @@ import { LANGUAGES } from 'app/core/language/language.constants';
import { AccountService } from 'app/core/auth/account.service'; import { AccountService } from 'app/core/auth/account.service';
import { LoginService } from 'app/core/login/login.service'; import { LoginService } from 'app/core/login/login.service';
import { ProfileService } from 'app/layouts/profiles/profile.service'; import { ProfileService } from 'app/layouts/profiles/profile.service';
import { OAuth2ConfigService } from 'app/core/auth/oauth2-config.service';
import { OAuth2Config } from 'app/core/auth/oauth2-config.model';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
...@@ -35,6 +37,9 @@ export class NavbarComponent implements OnInit { ...@@ -35,6 +37,9 @@ export class NavbarComponent implements OnInit {
rememberMe: [false], rememberMe: [false],
}); });
public configs: OAuth2Config[] ;
constructor( constructor(
private loginService: LoginService, private loginService: LoginService,
public searchComponent: SearchComponent, public searchComponent: SearchComponent,
...@@ -45,9 +50,17 @@ export class NavbarComponent implements OnInit { ...@@ -45,9 +50,17 @@ export class NavbarComponent implements OnInit {
// private loginModalService: LoginModalService, // private loginModalService: LoginModalService,
private profileService: ProfileService, private profileService: ProfileService,
private router: Router, private router: Router,
private location: Location // for redirect in OAuth2 private location: Location, // for redirect in OAuth2
) { public oAuth2ConfigService: OAuth2ConfigService) {
this.version = VERSION ? (VERSION.toLowerCase().startsWith('v') ? VERSION : 'v' + VERSION) : ''; this.configs = [];
this.oAuth2ConfigService.getAllConfigs().subscribe(
(loadedConfigs: OAuth2Config[]) => {
this.configs = loadedConfigs;
});
this.version = VERSION ? (VERSION.toLowerCase().startsWith('v') ? VERSION : 'v' + VERSION) : '';
} }
ngOnInit(): void { ngOnInit(): void {
...@@ -97,13 +110,12 @@ export class NavbarComponent implements OnInit { ...@@ -97,13 +110,12 @@ export class NavbarComponent implements OnInit {
} }
loginWithGitLab(): void { loginWithGitLab(registrationId:string): void {
// If you have configured multiple OIDC providers, then, you can update this URL to /login. location.href = `${location.origin}${this.location.prepareExternalUrl('oauth2/authorization/'+ registrationId)}`;
// If you have configured multiple OIDC providers, then, you can update this URL to /login.
// It will show a Spring Security generated login page with links to configured OIDC providers. // It will show a Spring Security generated login page with links to configured OIDC providers.
location.href = `${location.origin}${this.location.prepareExternalUrl('oauth2/authorization/gitlabOidc')}`;
}
}
searchChanged(): void { searchChanged(): void {
this.searchComponent.searchChanged(); this.searchComponent.searchChanged();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment