Restored the camel case text.

feature/appm-store/pbac
Menaka Jayawardena 7 years ago
parent b9721845d8
commit 52f9a0ad1e

@ -67,14 +67,12 @@ public class AuthHandlerServiceImpl implements AuthHandlerService {
} }
}; };
private Client disableHostnameVerification = new Client.Default(getTrustedSSLSocketFactory(), private Client disableHostnameVerification = new Client.Default(getTrustedSSLSocketFactory(), new HostnameVerifier() {
new HostnameVerifier() { @Override
@Override public boolean verify(String s, SSLSession sslSession) {
public boolean verify(String s, SSLSession sslSession) { return true;
return true; }
} });
}
);
@POST @POST
@Path("/login") @Path("/login")
@ -108,31 +106,28 @@ public class AuthHandlerServiceImpl implements AuthHandlerService {
loginInfo.append(Constants.APPLICATION_INFO, new JSONObject(apiApplicationKey)); loginInfo.append(Constants.APPLICATION_INFO, new JSONObject(apiApplicationKey));
return Response.status(200).entity(loginInfo.toString()).build(); return Response.status(200).entity(loginInfo.toString()).build();
} catch (Exception e) { } catch (Exception e) {
//return Response.status(500).build(); return Response.status(500).build();
} }
return Response.status(200).build();
} }
@POST @POST
@Path("/refresh") @Path("/refresh")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Override @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) { @QueryParam("clientSecret") String clientSecret) {
try { try {
TokenIssuerService tokenIssuerService = Feign.builder().client(disableHostnameVerification) TokenIssuerService tokenIssuerService = Feign.builder().client(disableHostnameVerification)
.requestInterceptor(new BasicAuthRequestInterceptor(clientId, clientSecret)) .requestInterceptor(new BasicAuthRequestInterceptor(clientId, clientSecret))
.contract(new JAXRSContract()).encoder(new JacksonEncoder()).decoder(new JacksonDecoder()) .contract(new JAXRSContract()).encoder(new JacksonEncoder()).decoder(new JacksonDecoder())
.target(TokenIssuerService.class, Constants.TOKEN_ENDPOINT); .target(TokenIssuerService.class, Constants.TOKEN_ENDPOINT);
AccessTokenInfo accessTokenInfo = tokenIssuerService.getRefreshToken(Constants.REFRESH_GRANT_TYPE, AccessTokenInfo accessTokenInfo = tokenIssuerService.getRefreshToken(Constants.REFRESH_GRANT_TYPE, refresh_token);
refreshToken);
return Response.status(200).entity(new JSONObject(accessTokenInfo)).build(); return Response.status(200).entity(new JSONObject(accessTokenInfo)).build();
} catch (Exception e) { } catch (Exception e) {
return Response.status(500).build(); return Response.status(500).build();
} }
} }
@POST @POST
@Path("/logout") @Path("/logout")
@Override @Override

@ -30,54 +30,54 @@ import javax.xml.bind.annotation.XmlRootElement;
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public class AccessTokenInfo { public class AccessTokenInfo {
@XmlElement(required = true, name = "tokenType") @XmlElement(required = true, name = "token_type")
private String tokenType; private String token_type;
@XmlElement(required = true, name = "expiresIn") @XmlElement(required = true, name = "expires_in")
private String expiresIn; private String expires_in;
@XmlElement(required = true, name = "refreshToken") @XmlElement(required = true, name = "refresh_token")
private String refreshToken; private String refresh_token;
@XmlElement(required = true, name = "accessToken") @XmlElement(required = true, name = "access_token")
private String accessToken; private String access_token;
public AccessTokenInfo() {} public AccessTokenInfo() {}
public String getTokenType() { public String getToken_type() {
return tokenType; return token_type;
} }
public void setTokenType(String tokenType) { public void setToken_type(String token_type) {
this.tokenType = tokenType; this.token_type = token_type;
} }
public String getExpiresIn() { public String getExpires_in() {
return expiresIn; return expires_in;
} }
public void setExpiresIn(String expiresIn) { public void setExpires_in(String expires_in) {
this.expiresIn = expiresIn; this.expires_in = expires_in;
} }
public String getRefreshToken() { public String getRefresh_token() {
return refreshToken; return refresh_token;
} }
public void setRefreshToken(String refreshToken) { public void setRefresh_token(String refresh_token) {
this.refreshToken = refreshToken; this.refresh_token = refresh_token;
} }
public String getAccessToken() { public String getAccess_token() {
return accessToken; return access_token;
} }
public void setAccessToken(String accessToken) { public void setAccess_token(String access_token) {
this.accessToken = accessToken; this.access_token = access_token;
} }
@Override @Override
public String toString() { 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 @XmlRootElement
public class ApiApplicationKey { public class ApiApplicationKey {
@XmlElement @XmlElement
private String clientId; private String client_id;
@XmlElement @XmlElement
private String clientSecret; private String client_secret;
public String getConsumerKey() { public String getConsumerKey() {
return this.clientId; return this.client_id;
} }
public void setClientId(String consumerKey) { public void setClient_id(String consumerKey) {
this.clientId = consumerKey; this.client_id = consumerKey;
} }
public String getConsumerSecret() { public String getConsumerSecret() {
return this.clientSecret; return this.client_secret;
} }
public void setClientSecret(String consumerSecret) { public void setClient_secret(String consumerSecret) {
this.clientSecret = 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 => { login_promise.then(response => {
console.log(response); console.log(response);
const userName = response.data.userName; const userName = response.data.userName;
const validityPeriod = response.data.expiresIn; // In seconds const validityPeriod = response.data.expires_in; // In seconds
const WSO2_IOT_TOKEN = response.data.accessToken; const WSO2_IOT_TOKEN = response.data.access_token;
const refreshToken = response.data.refreshToken; const refreshToken = response.data.refresh_token;
const clientId = response.data.application_info[0].consumerKey; const clientId = response.data.application_info[0].consumerKey;
const clientSecret = response.data.application_info[0].consumerSecret; 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 Dialog from 'material-ui/Dialog';
import {withRouter} from 'react-router-dom'; import {withRouter} from 'react-router-dom';
import FlatButton from 'material-ui/FlatButton'; import FlatButton from 'material-ui/FlatButton';
import AuthHandler from "../../api/authHandler";
import {Step1, Step2, Step3} from './CreateSteps'; import {Step1, Step2, Step3} from './CreateSteps';
import RaisedButton from 'material-ui/RaisedButton'; import RaisedButton from 'material-ui/RaisedButton';
import ApplicationMgtApi from '../../api/applicationMgtApi'; import ApplicationMgtApi from '../../api/applicationMgtApi';
@ -70,7 +71,7 @@ class ApplicationCreate extends Component {
* Handles next button click event. * Handles next button click event.
* */ * */
handleNext() { handleNext() {
console.log("Handle Next"); console.log("Handle Next"); //TODO: Remove this
const {stepIndex} = this.state; const {stepIndex} = this.state;
this.setState({ this.setState({
stepIndex: stepIndex + 1, stepIndex: stepIndex + 1,
@ -89,7 +90,7 @@ class ApplicationCreate extends Component {
} }
).catch( ).catch(
function (err) { function (err) {
console.log(err); AuthHandler.unauthorizedErrorHandler(err);
} }
); );
}; };
@ -120,7 +121,7 @@ class ApplicationCreate extends Component {
* @param data: The form data of the step. * @param data: The form data of the step.
* */ * */
setStepData(step, data) { 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; let tmpStepData = this.state.stepData;
tmpStepData.push({step: step, data: data}); tmpStepData.push({step: step, data: data});

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

@ -20,7 +20,9 @@ import Theme from '../../theme';
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withRouter} from 'react-router-dom'; import {withRouter} from 'react-router-dom';
import TextField from 'material-ui/TextField'; import TextField from 'material-ui/TextField';
import AuthHandler from "../../api/authHandler";
import DataTable from '../UIComponents/DataTable'; import DataTable from '../UIComponents/DataTable';
import PlatformMgtApi from "../../api/platformMgtApi";
import {Card, CardActions, CardTitle} from 'material-ui/Card'; import {Card, CardActions, CardTitle} from 'material-ui/Card';
/** /**
@ -34,13 +36,42 @@ import {Card, CardActions, CardTitle} from 'material-ui/Card';
class PlatformListing extends Component { class PlatformListing extends Component {
constructor() { constructor() {
super(); super();
this.setPlatforms = this.setPlatforms.bind(this);
this.state = { this.state = {
data: [], platforms: [],
asc: true asc: true
}; };
this.scriptId = "platform-listing"; 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() { componentWillMount() {
/** /**
*Loading the theme files based on the the user-preference. *Loading the theme files based on the the user-preference.
@ -52,6 +83,38 @@ class PlatformListing extends Component {
Theme.removeThemingScripts(this.scriptId); 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. * Handles the search action.
* When typing in the search bar, this method will be invoked. * When typing in the search bar, this method will be invoked.
@ -79,6 +142,7 @@ class PlatformListing extends Component {
} }
onRowClick(id) { onRowClick(id) {
//TODO: Remove this
console.log(id) console.log(id)
} }
@ -94,7 +158,7 @@ class PlatformListing extends Component {
</CardActions> </CardActions>
<DataTable <DataTable
headers={this.headers} headers={this.headers}
data={this.data} data={this.state.platforms}
handleRowClick={this.onRowClick.bind(this)} handleRowClick={this.onRowClick.bind(this)}
noDataMessage={{type: 'button', text: 'Create Platform'}}/> noDataMessage={{type: 'button', text: 'Create Platform'}}/>
</Card> </Card>

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