Skip to content

Commit

Permalink
profileMethod -> profileVerb
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérôme LELEU committed Dec 12, 2016
1 parent 085c35f commit 917f1c8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@


import java.util.Map; import java.util.Map;
import java.util.logging.Logger; import java.util.logging.Logger;

import com.github.scribejava.core.model.Verb;
import org.pac4j.core.context.WebContext; import org.pac4j.core.context.WebContext;
import org.pac4j.oauth.profile.OAuth20Profile; import org.pac4j.oauth.profile.OAuth20Profile;
import org.pac4j.oauth.profile.generic.GenericOAuth20ProfileDefinition; import org.pac4j.oauth.profile.generic.GenericOAuth20ProfileDefinition;
Expand All @@ -22,7 +24,7 @@ public class GenericOAuth20Client extends OAuth20Client<OAuth20Profile> {
private String tokenUrl; private String tokenUrl;
private String profileUrl; private String profileUrl;
private String profilePath; private String profilePath;
private String profileMethod; private Verb profileVerb;
private Map<String, String> profileAttrs; private Map<String, String> profileAttrs;
private Map<String, String> customParams; private Map<String, String> customParams;


Expand All @@ -43,7 +45,7 @@ protected void internalInit(final WebContext context) {


GenericOAuth20ProfileDefinition profileDefinition = new GenericOAuth20ProfileDefinition(); GenericOAuth20ProfileDefinition profileDefinition = new GenericOAuth20ProfileDefinition();
profileDefinition.setFirstNodePath(profilePath); profileDefinition.setFirstNodePath(profilePath);
profileDefinition.setProfileMethod(profileMethod); profileDefinition.setProfileVerb(profileVerb);
profileDefinition.setProfileUrl(profileUrl); profileDefinition.setProfileUrl(profileUrl);


if (profileAttrs != null) { if (profileAttrs != null) {
Expand All @@ -57,31 +59,31 @@ protected void internalInit(final WebContext context) {
super.internalInit(context); super.internalInit(context);
} }


public void setAuthUrl(String authUrl) { public void setAuthUrl(final String authUrl) {
this.authUrl = authUrl; this.authUrl = authUrl;
} }


public void setTokenUrl(String tokenUrl) { public void setTokenUrl(final String tokenUrl) {
this.tokenUrl = tokenUrl; this.tokenUrl = tokenUrl;
} }


public void setProfileUrl(String profileUrl) { public void setProfileUrl(final String profileUrl) {
this.profileUrl = profileUrl; this.profileUrl = profileUrl;
} }


public void setProfileNodePath(String profilePath) { public void setProfileNodePath(final String profilePath) {
this.profilePath = profilePath; this.profilePath = profilePath;
} }


public void setProfileMethod(String profileMethod) { public void setProfileVerb(final Verb profileVerb) {
this.profileMethod = profileMethod; this.profileVerb = profileVerb;
} }


public void setProfileAttrs(Map<String, String> profileAttrsMap) { public void setProfileAttrs(final Map<String, String> profileAttrsMap) {
this.profileAttrs = profileAttrsMap; this.profileAttrs = profileAttrsMap;
} }


public void setCustomParams(Map<String, String> customParamsMap) { public void setCustomParams(final Map<String, String> customParamsMap) {
this.customParams = customParamsMap; this.customParams = customParamsMap;
} }
} }
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -27,21 +27,19 @@ public class GenericOAuth20ProfileDefinition extends OAuth20ProfileDefinition<OA
private final Map<String,String> profileAttributes = new HashMap<>(); private final Map<String,String> profileAttributes = new HashMap<>();


String profileUrl = null; String profileUrl = null;
String profileMethod = null; Verb profileVerb = null;
String firstNodePath = null; String firstNodePath = null;


public void setProfileMethod(String value) { public void setProfileVerb(final Verb value) {
this.profileMethod = value; this.profileVerb = value;
} }


@Override @Override
public Verb getProfileVerb() { public Verb getProfileVerb() {
if ("POST".equalsIgnoreCase(profileMethod)) { if (profileVerb != null) {
return Verb.POST; return this.profileVerb;
} else if ("GET".equalsIgnoreCase(profileMethod)) {
return Verb.GET;
} else { } else {
return super.getProfileVerb(); return super.getProfileVerb();
} }
} }


Expand Down Expand Up @@ -109,10 +107,7 @@ public String getFirstNodePath() {
return firstNodePath; return firstNodePath;
} }


public void setFirstNodePath(String firstNodePath) { public void setFirstNodePath(final String firstNodePath) {
this.firstNodePath = firstNodePath; this.firstNodePath = firstNodePath;
} }



} }

0 comments on commit 917f1c8

Please sign in to comment.