Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ private <R> Mono<AuthorizationResponse<R>> handleMissingOrInvalidAuth(OtelReques
return createAuthorizationResponse((ErrorHeaders) response.getHeaders(), null);
}

private <R> Mono<AuthorizationResponse<R>> handleMissingApplicationName(OtelRequestContext context) {
private <R> Mono<AuthorizationResponse<R>> handleMissingApplicationName(String serviceId, OtelRequestContext context) {
context.authErrorType(ApplicationNameNotProvidedException.class.getName());
log.warn("Service '{}' is missing APPLID set", serviceId);
return createAuthorizationResponse(createErrorMessage("ApplicationName not provided."),null);
}

Expand All @@ -134,7 +135,7 @@ public Mono<AuthorizationResponse<TicketResponse>> passticket(RequestCredentials
var applicationName = requestCredentials.getApplId();
var otelRequestContext = OtelRequestContext.of(exchange);
if (StringUtils.isBlank(applicationName)) {
return handleMissingApplicationName(otelRequestContext);
return handleMissingApplicationName(requestCredentials.getServiceId(), otelRequestContext);
}

try {
Expand Down Expand Up @@ -186,7 +187,7 @@ public Mono<AuthorizationResponse<ZaasTokenResponse>> safIdt(RequestCredentials
var applicationName = requestCredentials.getApplId();
var otelRequestContext = OtelRequestContext.of(exchange);
if (StringUtils.isBlank(applicationName)) {
return handleMissingApplicationName(otelRequestContext);
return handleMissingApplicationName(requestCredentials.getServiceId(), otelRequestContext);
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ public synchronized void evaluate(String userId, String applId, String passTicke
// IRRPassTicket is not thread-safe, must be synchronized
public synchronized String generate(String userId, String applId) throws PassTicketException {
try {
log.debug("Generating PassTicket for user: {} and ZOSMF applid: {}", userId, applId);
validateUserIdAndApplId(userId, applId);
return irrPassTicket.generate(userId.toUpperCase(), applId.toUpperCase());
var passTicket = irrPassTicket.generate(userId.toUpperCase(), applId.toUpperCase());
log.debug("Generated PassTicket: {}", passTicket);
return passTicket;
} catch (RuntimeException e) {
log.debug("Error during pass ticket generation, userId={}, applid={}, exception={}", userId, applId, e);
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,7 @@

private String generatePassTicket(String user) {
try {
log.debug("Generating PassTicket for user: {} and ZOSMF applid: {}", user, zosmfApplId);
String passTicket = passTicketService.generate(user, zosmfApplId);

Check warning on line 106 in zaas-service/src/main/java/org/zowe/apiml/zaas/security/service/TokenCreationService.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Immediately return this expression instead of assigning it to the temporary variable "passTicket".

See more on https://sonarcloud.io/project/issues?id=zowe_api-layer&issues=AZ5pflmjC-MIXhLv8d-u&open=AZ5pflmjC-MIXhLv8d-u&pullRequest=4647
log.debug("Generated PassTicket: {}", passTicket);

return passTicket;
} catch (IRRPassTicketGenerationException e) {
throw new AuthenticationTokenException("Generation of PassTicket failed", e);
Expand Down
Loading