Skip to content

Commit

Permalink
get from v3
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Carle <pablo.carle@broadcom.com>
  • Loading branch information
Pablo Carle committed Feb 19, 2025
1 parent 827216c commit dce55d4
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 7 deletions.
1 change: 1 addition & 0 deletions api-catalog-services/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ logging:
com.netflix: INFO
org.ehcache: INFO
com.netflix.discovery.shared.transport.decorator: DEBUG
org.apache.tomcat.util.net.jsse.JSSESupport: INFO

---
spring:
Expand Down
1 change: 1 addition & 0 deletions caching-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ logging:
org.springframework: INFO
org.apache: INFO
org.apache.http: DEBUG
org.apache.tomcat.util.net.jsse.JSSESupport: INFO
com.netflix: INFO
org.hibernate: INFO
org.springframework.web.servlet.PageNotFound: WARN
Expand Down
1 change: 1 addition & 0 deletions cloud-gateway-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ logging:
reactor.netty.http.client.HttpClient: DEBUG
reactor.netty.http.client.HttpClientConnect: DEBUG
com.netflix: DEBUG
org.apache.tomcat.util.net.jsse.JSSESupport: INFO

---
spring.config.activate.on-profile: attls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ public ErrorCode getErrorCode() {
}

protected String getMessage(String baseMessage) {
return baseMessage + ' ' + getErrorCode().getMessage();
return String.format("%s %s: safRc=%d, racfRc=%d, racfRsn=%d",
baseMessage,
getErrorCode().getMessage(),
this.safRc,
this.racfRc,
this.racfRsn
);
}

public int getHttpStatus() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.zowe.apiml.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Value;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
Expand All @@ -25,10 +25,12 @@
/**
* This class allows to get a PassTicket from SAF.
*/
@Slf4j
public class PassTicketService {

private final IRRPassTicket irrPassTicket;

@SuppressWarnings("unchecked")
public PassTicketService() {
this.irrPassTicket = ClassOrDefaultProxyUtils.createProxy(IRRPassTicket.class,
"com.ibm.eserver.zos.racf.IRRPassTicket", DefaultPassTicketImpl::new,
Expand All @@ -47,7 +49,12 @@ 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 IRRPassTicketGenerationException {
return irrPassTicket.generate(userId.toUpperCase(), applId.toUpperCase());
try {
return irrPassTicket.generate(userId.toUpperCase(), applId.toUpperCase());
} catch (IRRPassTicketGenerationException | RuntimeException e) {
log.debug("Error during pass ticket generation, userId={}, applid={}, exception={}", userId, applId, e);
throw e;
}
}

public boolean isUsingSafImplementation() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void testInit() {
assertEquals(12, exception.getRacfRc());
assertEquals(20, exception.getRacfRsn());
assertEquals(AbstractIRRPassTicketException.ErrorCode.ERR_8_12_20, exception.getErrorCode());
assertEquals("Error on evaluation of PassTicket: Invocation of the Security Server Network Authentication Service Program Call (PC) interface failed with an 'abend in the PC service routine' return code. The symptom record associated with this abend can be found in the logrec data set.", exception.getMessage());
assertEquals("Error on evaluation of PassTicket: Invocation of the Security Server Network Authentication Service Program Call (PC) interface failed with an 'abend in the PC service routine' return code. The symptom record associated with this abend can be found in the logrec data set.: safRc=8, racfRc=12, racfRsn=20", exception.getMessage());

IRRPassTicketEvaluationException exception2 = new IRRPassTicketEvaluationException(AbstractIRRPassTicketException.ErrorCode.ERR_8_16_28);
assertEquals(8, exception2.getSafRc());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void testInit() {
assertEquals(16, exception.getRacfRc());
assertEquals(32, exception.getRacfRsn());
assertEquals(AbstractIRRPassTicketException.ErrorCode.ERR_8_16_32, exception.getErrorCode());
assertEquals("Error on generation of PassTicket: " + AbstractIRRPassTicketException.ErrorCode.ERR_8_16_32.getMessage(), exception.getMessage());
assertEquals("Error on generation of PassTicket: " + AbstractIRRPassTicketException.ErrorCode.ERR_8_16_32.getMessage() + ": safRc=8, racfRc=16, racfRsn=32", exception.getMessage());

IRRPassTicketGenerationException exception2 = new IRRPassTicketGenerationException(AbstractIRRPassTicketException.ErrorCode.ERR_8_12_8);
assertEquals(8, exception2.getSafRc());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public String generate(String userId, String applId) {

@Test
void testProxy() throws IRRPassTicketGenerationException {
@SuppressWarnings("unchecked")
IRRPassTicket irrPassTicket = ClassOrDefaultProxyUtils.createProxy(
IRRPassTicket.class,
"notExistingClass",
Expand Down Expand Up @@ -157,7 +158,7 @@ void testDefaultPassTicketImpl_GenerateUnknownUser() {
assertEquals(16, e.getRacfRsn());
assertNotNull(e.getErrorCode());
assertEquals(AbstractIRRPassTicketException.ErrorCode.ERR_8_8_16, e.getErrorCode());
assertEquals("Error on generation of PassTicket: Not authorized to use this service. Verify that the user and the application name are valid, and check that corresponding permissions have been set up.", e.getMessage());
assertEquals("Error on generation of PassTicket: Not authorized to use this service. Verify that the user and the application name are valid, and check that corresponding permissions have been set up.: safRc=8, racfRc=8, racfRsn=16", e.getMessage());
}

@Test
Expand Down
1 change: 1 addition & 0 deletions discovery-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ logging:
org.springframework: INFO
org.apache: INFO
org.apache.http: DEBUG
org.apache.tomcat.util.net.jsse.JSSESupport: INFO
com.netflix: INFO
com.sun.jersey.server.impl.application.WebApplicationImpl: INFO
org.ehcache: INFO
Expand Down
1 change: 1 addition & 0 deletions gateway-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ logging:
org.springframework: INFO
org.apache: INFO
org.apache.http: DEBUG
org.apache.tomcat.util.net.jsse.JSSESupport: INFO
com.netflix: INFO
org.hibernate: INFO
org.springframework.web.servlet.PageNotFound: WARN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void givenPassTicketException_whenCreatingSafIdToken_thenExceptionThrown() throw
underTest.createSafIdTokenWithoutCredentials(VALID_USER_ID, VALID_ZOSMF_APPLID);
});

assertEquals("Error on generation of PassTicket: An internal error was encountered.", e.getMessage());
assertEquals("Error on generation of PassTicket: An internal error was encountered.: safRc=8, racfRc=8, racfRsn=8", e.getMessage());
}

@Test
Expand Down

0 comments on commit dce55d4

Please sign in to comment.