Changed to camel case text.

feature/appm-store/pbac
Menaka Jayawardena 7 years ago
parent 9619371cab
commit a582997c80

@ -40,7 +40,7 @@ public interface AuthHandlerService {
@Path("/refresh")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
Response refresh(@QueryParam("refresh_token") String refresh_token, @QueryParam("clientId") String clientId,
Response refresh(@QueryParam("refreshToken") String refreshToken, @QueryParam("clientId") String clientId,
@QueryParam("clientSecret") String clientSecret);
@POST

@ -67,12 +67,14 @@ public class AuthHandlerServiceImpl implements AuthHandlerService {
}
};
private Client disableHostnameVerification = new Client.Default(getTrustedSSLSocketFactory(), new HostnameVerifier() {
private Client disableHostnameVerification = new Client.Default(getTrustedSSLSocketFactory(),
new HostnameVerifier() {
@Override
public boolean verify(String s, SSLSession sslSession) {
return true;
}
});
}
);
@POST
@Path("/login")
@ -116,14 +118,15 @@ public class AuthHandlerServiceImpl implements AuthHandlerService {
@Path("/refresh")
@Produces(MediaType.APPLICATION_JSON)
@Override
public Response refresh(@QueryParam("refresh_token") String refresh_token, @QueryParam("clientId") String clientId,
public Response refresh(@QueryParam("refreshToken") String refreshToken, @QueryParam("clientId") String clientId,
@QueryParam("clientSecret") String clientSecret) {
try {
TokenIssuerService tokenIssuerService = Feign.builder().client(disableHostnameVerification)
.requestInterceptor(new BasicAuthRequestInterceptor(clientId, clientSecret))
.contract(new JAXRSContract()).encoder(new JacksonEncoder()).decoder(new JacksonDecoder())
.target(TokenIssuerService.class, Constants.TOKEN_ENDPOINT);
AccessTokenInfo accessTokenInfo = tokenIssuerService.getRefreshToken(Constants.REFRESH_GRANT_TYPE, refresh_token);
AccessTokenInfo accessTokenInfo = tokenIssuerService.getRefreshToken(Constants.REFRESH_GRANT_TYPE,
refreshToken);
return Response.status(200).entity(new JSONObject(accessTokenInfo)).build();
} catch (Exception e) {
return Response.status(500).build();
@ -131,7 +134,6 @@ public class AuthHandlerServiceImpl implements AuthHandlerService {
}
@POST
@Path("/logout")
@Override

@ -18,6 +18,7 @@
package org.wso2.carbon.device.application.mgt.auth.handler.util;
//TODO: Remove hardcoded localhost and ports
public class Constants {
public static String SCOPES = "perm:application:get perm:application:create perm:application:update " +
"perm:application-mgt:login perm:application:delete perm:platform:add perm:platform:remove " +

@ -30,54 +30,54 @@ import javax.xml.bind.annotation.XmlRootElement;
@JsonIgnoreProperties(ignoreUnknown = true)
public class AccessTokenInfo {
@XmlElement(required = true, name = "token_type")
private String token_type;
@XmlElement(required = true, name = "tokenType")
private String tokenType;
@XmlElement(required = true, name = "expires_in")
private String expires_in;
@XmlElement(required = true, name = "expiresIn")
private String expiresIn;
@XmlElement(required = true, name = "refresh_token")
private String refresh_token;
@XmlElement(required = true, name = "refreshToken")
private String refreshToken;
@XmlElement(required = true, name = "access_token")
private String access_token;
@XmlElement(required = true, name = "accessToken")
private String accessToken;
public AccessTokenInfo() {}
public String getToken_type() {
return token_type;
public String getTokenType() {
return tokenType;
}
public void setToken_type(String token_type) {
this.token_type = token_type;
public void setTokenType(String tokenType) {
this.tokenType = tokenType;
}
public String getExpires_in() {
return expires_in;
public String getExpiresIn() {
return expiresIn;
}
public void setExpires_in(String expires_in) {
this.expires_in = expires_in;
public void setExpiresIn(String expiresIn) {
this.expiresIn = expiresIn;
}
public String getRefresh_token() {
return refresh_token;
public String getRefreshToken() {
return refreshToken;
}
public void setRefresh_token(String refresh_token) {
this.refresh_token = refresh_token;
public void setRefreshToken(String refreshToken) {
this.refreshToken = refreshToken;
}
public String getAccess_token() {
return access_token;
public String getAccessToken() {
return accessToken;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
@Override
public String toString() {
return access_token + " " + token_type + " " + refresh_token + " ";
return accessToken + " " + tokenType + " " + refreshToken + " ";
}
}

@ -27,23 +27,23 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class ApiApplicationKey {
@XmlElement
private String client_id;
private String clientId;
@XmlElement
private String client_secret;
private String clientSecret;
public String getConsumerKey() {
return this.client_id;
return this.clientId;
}
public void setClient_id(String consumerKey) {
this.client_id = consumerKey;
public void setClientId(String consumerKey) {
this.clientId = consumerKey;
}
public String getConsumerSecret() {
return this.client_secret;
return this.clientSecret;
}
public void setClient_secret(String consumerSecret) {
this.client_secret = consumerSecret;
public void setClientSecret(String consumerSecret) {
this.clientSecret = consumerSecret;
}
}

@ -43,9 +43,9 @@ class AuthHandler {
login_promise.then(response => {
console.log(response);
const userName = response.data.userName;
const validityPeriod = response.data.expires_in; // In seconds
const WSO2_IOT_TOKEN = response.data.access_token;
const refreshToken = response.data.refresh_token;
const validityPeriod = response.data.expiresIn; // In seconds
const WSO2_IOT_TOKEN = response.data.accessToken;
const refreshToken = response.data.refreshToken;
const clientId = response.data.application_info[0].consumerKey;
const clientSecret = response.data.application_info[0].consumerSecret;

Loading…
Cancel
Save