-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JENKINS-55718 #218
JENKINS-55718 #218
Conversation
Roy-Lu
commented
Jan 22, 2019
- Change authentication tool to a singelton.
- Add ApiKeyAuthenticator to login to ALM through a new api. This is for ALM15SSO and ALM1260SSO.
- Enhance the RestAuthenticator to avoid be blocked by some problematic ALM env which generates wrong authenticate point.
Add ApiKeyAuthenticator to login to ALM through a new api. This is for ALM15SSO and ALM1260SSO. Enhance the RestAuthenticator to avoid be blocked by some problematic ALM env which generates wrong authenticate point.
@@ -34,59 +34,117 @@ | |||
import com.microfocus.application.automation.tools.sse.sdk.Logger; | |||
import com.microfocus.application.automation.tools.sse.sdk.ResourceAccessLevel; | |||
import com.microfocus.application.automation.tools.sse.sdk.Response; | |||
import sun.rmi.runtime.Log; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use classes from the Java API instead of Sun classes.
} | ||
|
||
private boolean isAlreadyAuthenticated(Response response, String authUser) { | ||
private boolean checkAuthResponse(Response response, String authUser, Logger logger) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method checkAuthResponse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
@@ -111,44 +168,58 @@ public boolean logout(Client client, String username) { | |||
* @param logger logger | |||
* @return null or authenticate point | |||
*/ | |||
private String isAuthenticated(Client client, Logger logger) { | |||
private boolean isAuthenticated(Client client, Logger logger) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method isAuthenticated
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
|
||
public boolean login(Client client, String username, String password, Logger logger) { | ||
public boolean login(Client client, String username, String password, String clientType, Logger logger) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method login
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
...a/com/microfocus/application/automation/tools/sse/sdk/authenticator/ApiKeyAuthenticator.java
Show resolved
Hide resolved
...ava/com/microfocus/application/automation/tools/sse/sdk/authenticator/RestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ava/com/microfocus/application/automation/tools/sse/sdk/authenticator/RestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ava/com/microfocus/application/automation/tools/sse/sdk/authenticator/RestAuthenticator.java
Outdated
Show resolved
Hide resolved
client.getServerUrl(), | ||
response.getStatusCode())); | ||
ret = false; | ||
if (!isAuthenticatePointRight(authenticationPoint, client.getServerUrl(), logger)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge this if statement with the enclosing one.
client.getServerUrl(), | ||
response.getStatusCode())); | ||
ret = false; | ||
if (!isAuthenticatePointRight(authenticationPoint, client.getServerUrl(), logger)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These nested if statements could be combined
...ava/com/microfocus/application/automation/tools/sse/sdk/authenticator/RestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ava/com/microfocus/application/automation/tools/sse/sdk/authenticator/RestAuthenticator.java
Show resolved
Hide resolved
Please merge this PR using 'Squash and merge'. |
Code Climate has analyzed commit 572ab27 and detected 0 issues on this pull request. View more on Code Climate. |