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

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

Merge branch...

Merge branch '100-download-von-ergebnissen-mit-guest-user-funktioniert-mit-geschutzten-usern-nicht-mehr' into 'development'

Resolve "Download von Ergebnissen mit Guest User funktioniert mit geschützten Usern nicht mehr"

See merge request sharing/codeability-sharing-platform!22
parents 82e13c73 fac2358e
2 merge requests!188Merging Peer Reviewing et. al to Master,!164211 peer reviewing functionality
......@@ -14,6 +14,7 @@ import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
......@@ -25,6 +26,7 @@ import org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import at.ac.uibk.gitsearch.config.ApplicationProperties;
import io.github.jhipster.config.JHipsterProperties;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.JwtBuilder;
......@@ -88,10 +90,14 @@ public class TokenProvider {
private long tokenValidityInMillisecondsForRememberMe;
@Autowired
private final JHipsterProperties jHipsterProperties;
@Autowired
private final ApplicationProperties applicationProperties;
public TokenProvider(JHipsterProperties jHipsterProperties) {
public TokenProvider(JHipsterProperties jHipsterProperties, ApplicationProperties applicationProperties) {
this.jHipsterProperties = jHipsterProperties;
this.applicationProperties = applicationProperties;
}
@PostConstruct
......@@ -261,7 +267,7 @@ public class TokenProvider {
if(accessToken.isPresent()) {
final Optional<String> accessIssuer = getGitLabAccessIssuer();
if(accessIssuer.isPresent()) {
return Optional.of(new GitLabAccessInfo(accessToken.get(), accessIssuer.get(), getCurrentPrincipal()) );
return Optional.of(new GitLabAccessInfo(accessToken.get(), applicationProperties.getGitLab().getUrl(), getCurrentPrincipal()) );
}
}
return Optional.empty();
......
......@@ -40,7 +40,7 @@ export class SearchService {
}
downloadFile(projectID: string): Observable<Object> {
return this.http.post(SERVER_API_URL + 'download/${projectID}', {
return this.http.post(SERVER_API_URL + 'download/' + projectID, {
observe: 'response',
responseType: 'blob',
});
......
......@@ -39,9 +39,10 @@
</form>
<br/>
<div *ngFor="let config of configs">
<img src="{{'oauth2.'+config.registrationId + '.icon'| translate}}" alt="oAuth2Image"/>
<img src="{{'oauth2.'+config.registrationId + '.icon'| translate}}" alt="oAuth2Image" style="width: 50px;"/>
<button type="submit" class="btn btn-primary" (click)="loginWithGitLab(config.registrationId)" jhiTranslate="oauth2.{{config.registrationId}}.text">Login With GitLab</button>
</div>
<!--
<div class="mt-3 alert alert-warning">
<a class="alert-link" (click)="requestResetPassword()" jhiTranslate="login.password.forgot">Did you forget your password?</a>
</div>
......@@ -50,6 +51,7 @@
<span jhiTranslate="global.messages.info.register.noaccount">You don't have an account yet?</span>
<a class="alert-link" (click)="register()" jhiTranslate="global.messages.info.register.link">Register a new account</a>
</div>
-->
</div>
</div>
</div>
package at.ac.uibk.gitsearch.security.jwt;
import at.ac.uibk.gitsearch.config.ApplicationProperties;
import at.ac.uibk.gitsearch.security.AuthoritiesConstants;
import io.github.jhipster.config.JHipsterProperties;
import io.jsonwebtoken.io.Decoders;
......@@ -29,7 +30,8 @@ public class JWTFilterTest {
@BeforeEach
public void setup() {
JHipsterProperties jHipsterProperties = new JHipsterProperties();
tokenProvider = new TokenProvider(jHipsterProperties);
ApplicationProperties appProperties = new ApplicationProperties();
tokenProvider = new TokenProvider(jHipsterProperties, appProperties);
ReflectionTestUtils.setField(tokenProvider, "key",
Keys.hmacShaKeyFor(Decoders.BASE64
.decode("fd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8")));
......
package at.ac.uibk.gitsearch.security.jwt;
import at.ac.uibk.gitsearch.config.ApplicationProperties;
import at.ac.uibk.gitsearch.security.AuthoritiesConstants;
import java.security.Key;
......@@ -30,7 +31,8 @@ public class TokenProviderTest {
@BeforeEach
public void setup() {
tokenProvider = new TokenProvider( new JHipsterProperties());
ApplicationProperties appProperties = new ApplicationProperties();
tokenProvider = new TokenProvider( new JHipsterProperties(), appProperties);
key = Keys.hmacShaKeyFor(Decoders.BASE64
.decode("fd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8"));
......
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