Merge pull request #972 from menakaj/application-mgt

Reverted the camel case to previous state.
feature/appm-store/pbac
Megala Uthayakumar 7 years ago committed by GitHub
commit 28d44fec31

@ -67,14 +67,12 @@ public class AuthHandlerServiceImpl implements AuthHandlerService {
}
};
private Client disableHostnameVerification = new Client.Default(getTrustedSSLSocketFactory(),
new HostnameVerifier() {
@Override
public boolean verify(String s, SSLSession sslSession) {
return true;
}
}
);
private Client disableHostnameVerification = new Client.Default(getTrustedSSLSocketFactory(), new HostnameVerifier() {
@Override
public boolean verify(String s, SSLSession sslSession) {
return true;
}
});
@POST
@Path("/login")
@ -106,34 +104,30 @@ public class AuthHandlerServiceImpl implements AuthHandlerService {
JSONObject loginInfo = new JSONObject(accessTokenInfo);
loginInfo.append(Constants.USER_NAME, userName);
loginInfo.append(Constants.APPLICATION_INFO, new JSONObject(apiApplicationKey));
System.out.println(loginInfo);
return Response.status(200).entity(loginInfo.toString()).build();
} catch (Exception e) {
//return Response.status(500).build();
return Response.status(500).build();
}
return Response.status(200).build();
}
@POST
@Path("/refresh")
@Produces(MediaType.APPLICATION_JSON)
@Override
public Response refresh(@QueryParam("refreshToken") String refreshToken, @QueryParam("clientId") String clientId,
public Response refresh(@QueryParam("refresh_token") String refresh_token, @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,
refreshToken);
AccessTokenInfo accessTokenInfo = tokenIssuerService.getRefreshToken(Constants.REFRESH_GRANT_TYPE, refresh_token);
return Response.status(200).entity(new JSONObject(accessTokenInfo)).build();
} catch (Exception e) {
return Response.status(500).build();
}
}
@POST
@Path("/logout")
@Override

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

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

@ -1,17 +0,0 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,17 +0,0 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,17 +0,0 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

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

@ -1,22 +0,0 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import {Dispatcher} from 'flux';
export default new Dispatcher();

@ -21,6 +21,7 @@ import React, {Component} from 'react';
import Dialog from 'material-ui/Dialog';
import {withRouter} from 'react-router-dom';
import FlatButton from 'material-ui/FlatButton';
import AuthHandler from "../../api/authHandler";
import {Step1, Step2, Step3} from './CreateSteps';
import RaisedButton from 'material-ui/RaisedButton';
import ApplicationMgtApi from '../../api/applicationMgtApi';
@ -70,7 +71,7 @@ class ApplicationCreate extends Component {
* Handles next button click event.
* */
handleNext() {
console.log("Handle Next");
console.log("Handle Next"); //TODO: Remove this
const {stepIndex} = this.state;
this.setState({
stepIndex: stepIndex + 1,
@ -89,7 +90,7 @@ class ApplicationCreate extends Component {
}
).catch(
function (err) {
console.log(err);
AuthHandler.unauthorizedErrorHandler(err);
}
);
};
@ -120,7 +121,7 @@ class ApplicationCreate extends Component {
* @param data: The form data of the step.
* */
setStepData(step, data) {
console.log(step, data, this.state.stepData);
console.log(step, data, this.state.stepData); //TODO: Remove this
let tmpStepData = this.state.stepData;
tmpStepData.push({step: step, data: data});

@ -100,7 +100,7 @@ class ApplicationListing extends Component {
let getApps = ApplicationMgtApi.getApplications();
getApps.then(response => {
let apps = this.setData(response.data.applications);
console.log(apps);
console.log(apps); //TODO: Remove this.
this.setState({searchedApplications: apps});
// console.log(this.setState({data: response.data}), console.log(this.state));
}).catch(err => {
@ -142,6 +142,7 @@ class ApplicationListing extends Component {
searchedData = this.state.applications;
}
//TODO: Remove the console log.
this.setState({searchedApplications: searchedData}, console.log("Searched data ", this.state.searchedApplications));
}
@ -165,6 +166,7 @@ class ApplicationListing extends Component {
}
onRowClick(id) {
//TODO: Remove console logs.
ApplicationMgtApi.getApplication(id).then(response => {
console.log(response);
}).catch(err => {

@ -20,7 +20,9 @@ import Theme from '../../theme';
import React, {Component} from 'react';
import {withRouter} from 'react-router-dom';
import TextField from 'material-ui/TextField';
import AuthHandler from "../../api/authHandler";
import DataTable from '../UIComponents/DataTable';
import PlatformMgtApi from "../../api/platformMgtApi";
import {Card, CardActions, CardTitle} from 'material-ui/Card';
/**
@ -34,13 +36,42 @@ import {Card, CardActions, CardTitle} from 'material-ui/Card';
class PlatformListing extends Component {
constructor() {
super();
this.setPlatforms = this.setPlatforms.bind(this);
this.state = {
data: [],
platforms: [],
asc: true
};
this.scriptId = "platform-listing";
}
headers = [
{
data_id: "image",
data_type: "image",
sortable: false,
label: ""
},
{
data_id: "platformName",
data_type: String,
sortable: true,
label: "Platform Name",
sort: this.sortData
},
{
data_id: "enabled",
data_type: String,
sortable: false,
label: "Enabled"
},
{
data_id: "fileBased",
data_type: String,
sortable: false,
label: "File Based"
}
];
componentWillMount() {
/**
*Loading the theme files based on the the user-preference.
@ -52,6 +83,38 @@ class PlatformListing extends Component {
Theme.removeThemingScripts(this.scriptId);
}
componentDidMount() {
let platformsPromise = PlatformMgtApi.getPlatforms();
platformsPromise.then(
response => {
let platforms = this.setPlatforms(response.data);
this.setState({platforms: platforms});
}
).catch(
err => {
AuthHandler.unauthorizedErrorHandler(err);
}
)
}
/**
* Create platform objects from the response which can be displayed in the table.
* */
setPlatforms(platforms) {
let tmpPlatforms = [];
for (let index in platforms) {
let platform = {};
platform.id = platforms[index].identifier;
platform.platformName = platforms[index].name;
platform.enabled = platforms[index].enabled.toString();
platform.fileBased = platforms[index].fileBased.toString();
tmpPlatforms.push(platform)
}
return tmpPlatforms;
}
/**
* Handles the search action.
* When typing in the search bar, this method will be invoked.
@ -79,6 +142,7 @@ class PlatformListing extends Component {
}
onRowClick(id) {
//TODO: Remove this
console.log(id)
}
@ -94,7 +158,7 @@ class PlatformListing extends Component {
</CardActions>
<DataTable
headers={this.headers}
data={this.data}
data={this.state.platforms}
handleRowClick={this.onRowClick.bind(this)}
noDataMessage={{type: 'button', text: 'Create Platform'}}/>
</Card>

@ -62,12 +62,12 @@ class DataTable extends Component {
};
componentWillMount() {
this.setState({data: this.props.data, headers: this.props.headers});
console.log("Will mount", this.props.data); //TODO: Remove this
this.setState({data: this.props.data, headers: this.props.headers}, Theme.insertThemingScripts(this.scriptId));
/**
*Loading the theme files based on the the user-preference.
*/
Theme.insertThemingScripts(this.scriptId);
}
componentWillUnmount() {
@ -75,7 +75,6 @@ class DataTable extends Component {
}
shouldComponentUpdate(nextProps, nextState) {
console.log("next Props", nextProps.data);
this.setState({data: nextProps.data});
return true;
}
@ -91,6 +90,7 @@ class DataTable extends Component {
render() {
const {data, headers} = this.state;
//TODO: Remove this
console.log(data);
let noDataContent = null;

@ -1,19 +0,0 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export class ApplicationStore {};

@ -1,18 +0,0 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export class PlatformStore{};

@ -1,19 +0,0 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export class ReviewStore{};

@ -1,24 +0,0 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import ReviewStore from './ReviewStore';
import PlatformStore from './PlatformStore';
import ApplicationStore from './ApplicationStore';
export {ApplicationStore, PlatformStore, ReviewStore};
Loading…
Cancel
Save