Skip to content

Commit

Permalink
MULE-17662: Misnamed parameters in OAuth module generate invalid (#94)
Browse files Browse the repository at this point in the history
extension model
  • Loading branch information
elrodro83 authored Oct 17, 2019
1 parent 71f6137 commit 373eee3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.mule.runtime.api.lock.LockFactory;
import org.mule.runtime.api.tls.TlsContextFactory;
import org.mule.runtime.core.api.MuleContext;
import org.mule.runtime.extension.api.annotation.Alias;
import org.mule.runtime.extension.api.annotation.Expression;
import org.mule.runtime.extension.api.annotation.param.DefaultEncoding;
import org.mule.runtime.extension.api.annotation.param.Optional;
Expand Down Expand Up @@ -128,9 +127,8 @@ public abstract class AbstractGrantType implements HttpRequestAuthentication, Li
protected Literal<String> responseExpiresIn;

@Parameter
@Alias("custom-parameter-extractors")
@Optional
protected List<ParameterExtractor> parameterExtractors;
protected List<ParameterExtractor> customParameterExtractors;

/**
* After executing an API call authenticated with OAuth it may be that the access token used was expired, so this attribute
Expand All @@ -151,7 +149,7 @@ public abstract class AbstractGrantType implements HttpRequestAuthentication, Li
@Expression(NOT_SUPPORTED)
@DisplayName(TLS_CONFIGURATION)
@Placement(tab = SECURITY_TAB)
private TlsContextFactory tlsContextFactory;
private TlsContextFactory tlsContext;

@Parameter
@Optional
Expand Down Expand Up @@ -234,9 +232,9 @@ public boolean equals(Object obj) {
literalEquals(responseAccessToken, other.responseAccessToken) &&
literalEquals(responseRefreshToken, other.responseRefreshToken) &&
literalEquals(responseExpiresIn, other.responseExpiresIn) &&
Objects.equals(parameterExtractors, other.parameterExtractors) &&
Objects.equals(customParameterExtractors, other.customParameterExtractors) &&
literalEquals(refreshTokenWhen, other.refreshTokenWhen) &&
Objects.equals(tlsContextFactory, other.tlsContextFactory) &&
Objects.equals(tlsContext, other.tlsContext) &&
Objects.equals(proxyConfig, other.proxyConfig);
}

Expand All @@ -246,7 +244,7 @@ public boolean equals(Object obj) {
@Override
public int hashCode() {
return 31 * hash(
clientId, clientSecret, scopes, tokenManager, tokenUrl, parameterExtractors, tlsContextFactory, proxyConfig)
clientId, clientSecret, scopes, tokenManager, tokenUrl, customParameterExtractors, tlsContext, proxyConfig)
*
literalHashCodes(responseAccessToken, responseRefreshToken, responseExpiresIn, refreshTokenWhen);
}
Expand Down Expand Up @@ -288,11 +286,11 @@ public Literal<String> getResponseExpiresIn() {
}

public List<ParameterExtractor> getCustomParameterExtractors() {
return parameterExtractors != null ? parameterExtractors : emptyList();
return customParameterExtractors != null ? customParameterExtractors : emptyList();
}

public TlsContextFactory getTlsContextFactory() {
return tlsContextFactory;
return tlsContext;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public String retrieveState(@Expression(NOT_SUPPORTED) TokenManagerConfig tokenM
* @param resourceOwnerId The resource owner id to invalidate. This attribute is only allowed for authorization code grant type.
* @param key to look for in the elements that has been extracted after the previous OAuth dance.
* @return an element if there was previously introduced by the OAuth dance and the custom parameter extractor. Null otherwise
* @see AbstractGrantType#parameterExtractors
* @see AbstractGrantType#customParameterExtractors
*/
@MediaType(value = TEXT_PLAIN, strict = false)
public String retrieveCustomTokenResponseParam(@Expression(NOT_SUPPORTED) TokenManagerConfig tokenManager,
Expand Down

0 comments on commit 373eee3

Please sign in to comment.