forked from community/device-mgt-plugins
Merge pull request #9 from dulichan/master
SSO related fixes and CDM app integrationrevert-dabc3590
commit
68bff9c21c
@ -0,0 +1,24 @@
|
||||
<IdentityProvider>
|
||||
<IdentityProviderName>default</IdentityProviderName>
|
||||
<DisplayName>default</DisplayName>
|
||||
<IdentityProviderDescription></IdentityProviderDescription>
|
||||
<Alias></Alias>
|
||||
<IsPrimary></IsPrimary>
|
||||
<IsFederationHub></IsFederationHub>
|
||||
<HomeRealmId></HomeRealmId>
|
||||
<ProvisioningRole></ProvisioningRole>
|
||||
<FederatedAuthenticatorConfigs></FederatedAuthenticatorConfigs>
|
||||
<DefaultAuthenticatorConfig>
|
||||
</DefaultAuthenticatorConfig>
|
||||
<ProvisioningConnectorConfigs>
|
||||
<ProvisioningConnectorConfig>
|
||||
<ProvisioningProperties>
|
||||
</ProvisioningProperties>
|
||||
</ProvisioningConnectorConfig>
|
||||
</ProvisioningConnectorConfigs>
|
||||
<DefaultProvisioningConnectorConfig></DefaultProvisioningConnectorConfig>
|
||||
<ClaimConfig></ClaimConfig>
|
||||
<Certificate></Certificate>
|
||||
<PermissionAndRoleConfig></PermissionAndRoleConfig>
|
||||
<JustInTimeProvisioningConfig></JustInTimeProvisioningConfig>
|
||||
</IdentityProvider>
|
@ -0,0 +1,49 @@
|
||||
<ServiceProvider>
|
||||
<ApplicationID>1</ApplicationID>
|
||||
<ApplicationName>default</ApplicationName>
|
||||
<Description>Default Service Provider</Description>
|
||||
<InboundAuthenticationConfig>
|
||||
<InboundAuthenticationRequestConfigs>
|
||||
<InboundAuthenticationRequestConfig>
|
||||
<InboundAuthKey>default</InboundAuthKey>
|
||||
<InboundAuthType></InboundAuthType>
|
||||
<Properties></Properties>
|
||||
</InboundAuthenticationRequestConfig>
|
||||
</InboundAuthenticationRequestConfigs>
|
||||
</InboundAuthenticationConfig>
|
||||
<LocalAndOutBoundAuthenticationConfig>
|
||||
<AuthenticationSteps>
|
||||
<AuthenticationStep>
|
||||
<StepOrder>1</StepOrder>
|
||||
<LocalAuthenticatorConfigs>
|
||||
<LocalAuthenticatorConfig>
|
||||
<Name>BasicAuthenticator</Name>
|
||||
<DisplayName>basicauth</DisplayName>
|
||||
<IsEnabled>true</IsEnabled>
|
||||
</LocalAuthenticatorConfig>
|
||||
</LocalAuthenticatorConfigs>
|
||||
<!-- FederatedIdentityProviders>
|
||||
<IdentityProvider>
|
||||
<IdentityProviderName>facebook</IdentityProviderName>
|
||||
<IsEnabled>true</IsEnabled>
|
||||
<DefaultAuthenticatorConfig>
|
||||
<FederatedAuthenticatorConfig>
|
||||
<Name>FacebookAuthenticator</Name>
|
||||
<IsEnabled>true</IsEnabled>
|
||||
</FederatedAuthenticatorConfig>
|
||||
</DefaultAuthenticatorConfig>
|
||||
</IdentityProvider>
|
||||
</FederatedIdentityProviders -->
|
||||
<SubjectStep>true</SubjectStep>
|
||||
<AttributeStep>true</AttributeStep>
|
||||
</AuthenticationStep>
|
||||
</AuthenticationSteps>
|
||||
</LocalAndOutBoundAuthenticationConfig>
|
||||
<RequestPathAuthenticatorConfigs></RequestPathAuthenticatorConfigs>
|
||||
<InboundProvisioningConfig></InboundProvisioningConfig>
|
||||
<OutboundProvisioningConfig></OutboundProvisioningConfig>
|
||||
<ClaimConfig>
|
||||
<AlwaysSendMappedLocalSubjectId>true</AlwaysSendMappedLocalSubjectId>
|
||||
</ClaimConfig>
|
||||
<PermissionAndRoleConfig></PermissionAndRoleConfig>
|
||||
</ServiceProvider>
|
@ -0,0 +1,49 @@
|
||||
<ServiceProvider>
|
||||
<ApplicationID>2</ApplicationID>
|
||||
<ApplicationName>wso2_cdm</ApplicationName>
|
||||
<Description>CDM</Description>
|
||||
<InboundAuthenticationConfig>
|
||||
<InboundAuthenticationRequestConfigs>
|
||||
<InboundAuthenticationRequestConfig>
|
||||
<InboundAuthKey>cdm</InboundAuthKey>
|
||||
<InboundAuthType>samlsso</InboundAuthType>
|
||||
<Properties></Properties>
|
||||
</InboundAuthenticationRequestConfig>
|
||||
</InboundAuthenticationRequestConfigs>
|
||||
</InboundAuthenticationConfig>
|
||||
<LocalAndOutBoundAuthenticationConfig>
|
||||
<AuthenticationSteps>
|
||||
<AuthenticationStep>
|
||||
<StepOrder>1</StepOrder>
|
||||
<LocalAuthenticatorConfigs>
|
||||
<LocalAuthenticatorConfig>
|
||||
<Name>BasicAuthenticator</Name>
|
||||
<DisplayName>basicauth</DisplayName>
|
||||
<IsEnabled>true</IsEnabled>
|
||||
</LocalAuthenticatorConfig>
|
||||
</LocalAuthenticatorConfigs>
|
||||
<!-- FederatedIdentityProviders>
|
||||
<IdentityProvider>
|
||||
<IdentityProviderName>facebook</IdentityProviderName>
|
||||
<IsEnabled>true</IsEnabled>
|
||||
<DefaultAuthenticatorConfig>
|
||||
<FederatedAuthenticatorConfig>
|
||||
<Name>FacebookAuthenticator</Name>
|
||||
<IsEnabled>true</IsEnabled>
|
||||
</FederatedAuthenticatorConfig>
|
||||
</DefaultAuthenticatorConfig>
|
||||
</IdentityProvider>
|
||||
</FederatedIdentityProviders -->
|
||||
<SubjectStep>true</SubjectStep>
|
||||
<AttributeStep>true</AttributeStep>
|
||||
</AuthenticationStep>
|
||||
</AuthenticationSteps>
|
||||
</LocalAndOutBoundAuthenticationConfig>
|
||||
<RequestPathAuthenticatorConfigs></RequestPathAuthenticatorConfigs>
|
||||
<InboundProvisioningConfig></InboundProvisioningConfig>
|
||||
<OutboundProvisioningConfig></OutboundProvisioningConfig>
|
||||
<ClaimConfig>
|
||||
<AlwaysSendMappedLocalSubjectId>true</AlwaysSendMappedLocalSubjectId>
|
||||
</ClaimConfig>
|
||||
<PermissionAndRoleConfig></PermissionAndRoleConfig>
|
||||
</ServiceProvider>
|
@ -0,0 +1,49 @@
|
||||
<!--
|
||||
~ Copyright (c) 2005-2010, 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.
|
||||
-->
|
||||
<SSOIdentityProviderConfig>
|
||||
<TenantRegistrationPage>https://stratos-local.wso2.com/carbon/tenant-register/select_domain.jsp</TenantRegistrationPage>
|
||||
<!-- <ServiceProviders>
|
||||
<ServiceProvider>
|
||||
<Issuer>cdm</Issuer>
|
||||
<AssertionConsumerService>https://localhost:9443/cdm/acs</AssertionConsumerService>
|
||||
<SignResponse>true</SignResponse>
|
||||
<CustomLoginPage>/cdm/login</CustomLoginPage>
|
||||
</ServiceProvider>
|
||||
</ServiceProviders> -->
|
||||
<ServiceProviders>
|
||||
<ServiceProvider>
|
||||
<Issuer>cdm</Issuer>
|
||||
<AssertionConsumerService>https://localhost:9443/cdm/acs</AssertionConsumerService>
|
||||
<SignAssertion>true</SignAssertion>
|
||||
<SignResponse>true</SignResponse>
|
||||
<EnableAttributeProfile>false</EnableAttributeProfile>
|
||||
<IncludeAttributeByDefault>false</IncludeAttributeByDefault>
|
||||
<Claims>
|
||||
<Claim>http://wso2.org/claims/role</Claim>
|
||||
<Claim>http://wso2.org/claims/emailaddress</Claim>
|
||||
</Claims>
|
||||
<EnableSingleLogout>false</EnableSingleLogout>
|
||||
<SingleLogoutUrl></SingleLogoutUrl>
|
||||
<EnableAudienceRestriction>true</EnableAudienceRestriction>
|
||||
<AudiencesList>
|
||||
<Audience>carbonServer</Audience>
|
||||
</AudiencesList>
|
||||
<ConsumingServiceIndex></ConsumingServiceIndex>
|
||||
</ServiceProvider>
|
||||
</ServiceProviders>
|
||||
</SSOIdentityProviderConfig>
|
@ -1,52 +0,0 @@
|
||||
<!--
|
||||
~ Copyright (c) 2005-2010, 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.
|
||||
-->
|
||||
<SSOIdentityProviderConfig>
|
||||
<TenantRegistrationPage>https://stratos-local.wso2.com/carbon/tenant-register/select_domain.jsp</TenantRegistrationPage>
|
||||
<ServiceProviders>
|
||||
<ServiceProvider>
|
||||
<Issuer>store</Issuer>
|
||||
<AssertionConsumerService>https://localhost:9443/store/acs</AssertionConsumerService>
|
||||
<SignResponse>true</SignResponse>
|
||||
<CustomLoginPage>/store/login.jag</CustomLoginPage>
|
||||
</ServiceProvider>
|
||||
<ServiceProvider>
|
||||
<Issuer>social</Issuer>
|
||||
<AssertionConsumerService>https://localhost:9443/social/acs</AssertionConsumerService>
|
||||
<SignResponse>true</SignResponse>
|
||||
<CustomLoginPage>/social/login</CustomLoginPage>
|
||||
</ServiceProvider>
|
||||
<ServiceProvider>
|
||||
<Issuer>publisher</Issuer>
|
||||
<AssertionConsumerService>https://localhost:9443/publisher/acs</AssertionConsumerService>
|
||||
<SignResponse>true</SignResponse>
|
||||
<CustomLoginPage>/publisher/controllers/login.jag</CustomLoginPage>
|
||||
</ServiceProvider>
|
||||
<ServiceProvider>
|
||||
<Issuer>emm</Issuer>
|
||||
<AssertionConsumerService>https://localhost:9443/emm/acs</AssertionConsumerService>
|
||||
<SignResponse>true</SignResponse>
|
||||
<CustomLoginPage>/emm/login</CustomLoginPage>
|
||||
</ServiceProvider>
|
||||
<ServiceProvider>
|
||||
<Issuer>mam</Issuer>
|
||||
<AssertionConsumerService>https://localhost:9443/mam/acs</AssertionConsumerService>
|
||||
<SignResponse>true</SignResponse>
|
||||
<CustomLoginPage>/mam/login</CustomLoginPage>
|
||||
</ServiceProvider>
|
||||
</ServiceProviders>
|
||||
</SSOIdentityProviderConfig>
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
@ -1,13 +0,0 @@
|
||||
// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
|
||||
require('../../js/transition.js')
|
||||
require('../../js/alert.js')
|
||||
require('../../js/button.js')
|
||||
require('../../js/carousel.js')
|
||||
require('../../js/collapse.js')
|
||||
require('../../js/dropdown.js')
|
||||
require('../../js/modal.js')
|
||||
require('../../js/tooltip.js')
|
||||
require('../../js/popover.js')
|
||||
require('../../js/scrollspy.js')
|
||||
require('../../js/tab.js')
|
||||
require('../../js/affix.js')
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"APP_CONTEXT" : "/cdm/",
|
||||
"API_CONTEXT" : "api",
|
||||
"HTTPS_URL": "%https.ip%",
|
||||
"HTTP_URL": "%http.ip%",
|
||||
"ssoConfiguration": {
|
||||
"enabled": true,
|
||||
"issuer": "cdm",
|
||||
"identityProviderURL": "%https.ip%/sso/samlsso.jag",
|
||||
"keyStorePassword": "wso2carbon",
|
||||
"identityAlias": "wso2carbon",
|
||||
"responseSigningEnabled": "true",
|
||||
"storeAcs": "%https.ip%/emm/acs",
|
||||
"keyStoreName": "/repository/resources/security/wso2carbon.jks"
|
||||
}
|
||||
}
|
@ -1,76 +1,35 @@
|
||||
<%
|
||||
var dataConfi = require('/config/emm.js').config();
|
||||
/*
|
||||
* Copyright (c) 2015, 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.
|
||||
*/
|
||||
var dataConfig = require('/modules/mdm-props.js').config();
|
||||
var sso = require("/modules/sso.js").sso;
|
||||
var log = new Log();
|
||||
var keyStoreParams = {
|
||||
keyStoreName: dataConfi.ssoConfiguration.keyStoreName,
|
||||
keyStorePassword: dataConfi.ssoConfiguration.keyStorePassword,
|
||||
identityAlias: dataConfi.ssoConfiguration.identityAlias
|
||||
keyStoreName: dataConfig.ssoConfiguration.keyStoreName,
|
||||
keyStorePassword: dataConfig.ssoConfiguration.keyStorePassword,
|
||||
identityAlias: dataConfig.ssoConfiguration.identityAlias
|
||||
}
|
||||
sso.configure(dataConfi.ssoConfiguration.issuer, "emm", keyStoreParams, dataConfi.ssoConfiguration.identityProviderURL);
|
||||
sso.configure(dataConfig.ssoConfiguration.issuer, "cdm", keyStoreParams, dataConfig.ssoConfiguration.identityProviderURL);
|
||||
sso.acs(function(loggedInUser) {
|
||||
session.put("LOGGED_IN_USER", loggedInUser);
|
||||
session.put("Loged", "true");
|
||||
session.put("USER", loggedInUser);
|
||||
var username = loggedInUser;
|
||||
var userModule = require('/modules/user.js').user;
|
||||
var db = common.getDatabase();
|
||||
var user = new userModule(db);
|
||||
var objUser = user.getUser({
|
||||
'userid': username,
|
||||
login: true
|
||||
});
|
||||
if (objUser != null) {
|
||||
var userFeed = {};
|
||||
userFeed.tenantId = stringify(objUser["tenantId"]);
|
||||
userFeed.username = objUser["username"];
|
||||
userFeed.email = objUser["email"];
|
||||
userFeed.firstName = objUser["firstName"];
|
||||
userFeed.lastName = objUser["lastName"];
|
||||
userFeed.mobile = objUser["mobile"];
|
||||
userFeed.tenantDomain = user.getTenantDomainFromID(stringify(objUser["tenantId"]));
|
||||
var parsedRoles = parse(objUser["roles"]);
|
||||
userFeed.roles = parsedRoles;
|
||||
var isEMMAdmin = false;
|
||||
var isAdmin = false;
|
||||
for (var i = 0; i < parsedRoles.length; i++) {
|
||||
if (parsedRoles[i] == 'Internal/emmadmin') {
|
||||
isEMMAdmin = true;
|
||||
break;
|
||||
}
|
||||
if (parsedRoles[i] == 'admin') {
|
||||
isAdmin = true;
|
||||
isEMMAdmin = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
userFeed.isEMMAdmin = isEMMAdmin;
|
||||
userFeed.isAdmin = isAdmin;
|
||||
session.put("emmConsoleUserLogin", "true");
|
||||
session.put("emmConsoleUser", userFeed);
|
||||
//var db = common.getDatabase();
|
||||
|
||||
var startupModule = require('/modules/startup.js').startup;
|
||||
var startup = new startupModule(db);
|
||||
startup.onUserLogin(userFeed);
|
||||
|
||||
var groupModule = require('/modules/group.js').group;
|
||||
var group = new groupModule(db);
|
||||
|
||||
if (!group.roleExists("Internal/emmadmin")) {
|
||||
var userList = new Array();
|
||||
group.addGroup({
|
||||
'name': 'Internal/emmadmin',
|
||||
'users': userList
|
||||
});
|
||||
}
|
||||
var appController = require('/controller/app.js');
|
||||
|
||||
if (isAdmin || isEMMAdmin) {
|
||||
response.sendRedirect('console/dashboard');
|
||||
} else {
|
||||
response.sendRedirect(appController.appInfo().server_url + 'users/devices?user=' + userFeed.username);
|
||||
}
|
||||
}
|
||||
log.debug("User logged in: "+username);
|
||||
response.sendRedirect('/cdm/dashboard');
|
||||
}, function() {
|
||||
response.sendRedirect('/emm');
|
||||
response.sendRedirect('/cdm');
|
||||
}); %>
|
@ -1,17 +1,35 @@
|
||||
<%
|
||||
/*
|
||||
* Copyright (c) 2015, 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.
|
||||
*/
|
||||
(function(){
|
||||
if (!session.get("emmConsoleUserLogin")) {
|
||||
var dataConfi = require('/config/emm.js').config();
|
||||
if (!session.get("USER")) {
|
||||
var dataConfig = require('/modules/mdm-props.js').config();
|
||||
var sso = require("/modules/sso.js").sso;
|
||||
|
||||
var keyStoreParams = {
|
||||
keyStoreName : dataConfi.ssoConfiguration.keyStoreName,
|
||||
keyStorePassword : dataConfi.ssoConfiguration.keyStorePassword,
|
||||
identityAlias : dataConfi.ssoConfiguration.identityAlias
|
||||
keyStoreName : dataConfig.ssoConfiguration.keyStoreName,
|
||||
keyStorePassword : dataConfig.ssoConfiguration.keyStorePassword,
|
||||
identityAlias : dataConfig.ssoConfiguration.identityAlias
|
||||
}
|
||||
sso.configure(dataConfi.ssoConfiguration.issuer, "emm", keyStoreParams, dataConfi.ssoConfiguration.identityProviderURL);
|
||||
sso.configure(dataConfig.ssoConfiguration.issuer, "cdm", keyStoreParams, dataConfig.ssoConfiguration.identityProviderURL);
|
||||
sso.login();
|
||||
}else{
|
||||
response.sendRedirect("/emm");
|
||||
response.sendRedirect("/cdm");
|
||||
}
|
||||
}());
|
||||
%>
|
||||
|
@ -1,15 +1,32 @@
|
||||
<%
|
||||
var user = session.get("emmConsoleUser");
|
||||
/*
|
||||
* Copyright (c) 2015, 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.
|
||||
*/
|
||||
var user = session.get("USER");
|
||||
if (user === null) {
|
||||
response.sendRedirect('/emm');
|
||||
response.sendRedirect('/cdm/dashboard');
|
||||
} else {
|
||||
var dataConfi = require('/config/emm.js').config();
|
||||
var dataConfi = require('/modules/mdm-props.js').config();
|
||||
var sso = require("/modules/sso.js").sso;
|
||||
var keyStoreParams = {
|
||||
keyStoreName: dataConfi.ssoConfiguration.keyStoreName,
|
||||
keyStorePassword: dataConfi.ssoConfiguration.keyStorePassword,
|
||||
identityAlias: dataConfi.ssoConfiguration.identityAlias
|
||||
}
|
||||
sso.configure(dataConfi.ssoConfiguration.issuer, "emm", keyStoreParams, dataConfi.ssoConfiguration.identityProviderURL);
|
||||
sso.configure(dataConfi.ssoConfiguration.issuer, "cdm", keyStoreParams, dataConfi.ssoConfiguration.identityProviderURL);
|
||||
sso.logout(user);
|
||||
} %>
|
@ -1,6 +1,6 @@
|
||||
[
|
||||
{
|
||||
"appName": "8d748f0b-5781-4071",
|
||||
"packageName": "Dulitha's iPhone"
|
||||
"packageName": "Appzone"
|
||||
}
|
||||
]
|
@ -1,3 +1,23 @@
|
||||
<%
|
||||
// This will have the auth headers
|
||||
/*
|
||||
* Copyright (c) 2015, 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.
|
||||
*/
|
||||
var loggedUser = session.get("USER");
|
||||
if(loggedUser==null){
|
||||
response.sendRedirect("/cdm/login");
|
||||
}
|
||||
%>
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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.
|
||||
*/
|
||||
|
||||
var config = function () {
|
||||
var conf = application.get("PINCH_CONFIG");
|
||||
if (!conf) {
|
||||
var pinch = require('/modules/pinch.min.js').pinch,
|
||||
server = require('carbon').server;
|
||||
config = require('/config/config.json'),
|
||||
pinch(config, /^/, function (path, key, value) {
|
||||
if ((typeof value === 'string') && value.indexOf('%https.ip%') > -1) {
|
||||
return value.replace('%https.ip%', server.address("https"));
|
||||
} else if ((typeof value === 'string') && value.indexOf('%http.ip%') > -1) {
|
||||
return value.replace('%http.ip%', server.address("http"));
|
||||
}
|
||||
return value;
|
||||
});
|
||||
application.put("PINCH_CONFIG", config);
|
||||
conf = config;
|
||||
}
|
||||
return conf;
|
||||
};
|
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* *
|
||||
* * Copyright (c) 2005-2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
* *
|
||||
* * Licensed 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.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(){var k=function(a,c){return a.length!==c.length?!1:a.every(function(a,b){return c[b]===a})},j=function(a,c,d){var b,e;if("[object Array]"===Object.prototype.toString.call(a)){b=0;for(e=a.length;b<e;b++)c.apply(d,[b,a[b],a])}else for(b in a)a.hasOwnProperty(b)&&c.apply(d,[b,a[b],a])},h=function(a){for(var c=[],d=!1,b=0,e=a.length,f="",g=function(){f&&(c.push(f),f="")};b<e;b++)a[b].match(/\[|\]/)?(g(),d="]"===a[b]?!1:!0):'"'!==a[b]&&"'"!==a[b]&&("."===a[b]&&!d?g():f+=a[b]),b===e-1&&g();return c},
|
||||
g=function(a,c,d){var b=-1!==["string","object"].indexOf(typeof a),e="string"===typeof c||c&&c.test&&c.exec,f=-1!==["string","object","function"].indexOf(typeof d);b&&e&&f&&("string"===typeof a?(this.instance=JSON.parse(a),this.json=!0):this.instance=a,this.pattern="string"===typeof c?c.replace(/'/g,'"'):c,this.replacement=d,this.createIndex(this.instance))};g.prototype.createIndex=function(a,c){var d=this;this.index=this.index||[];c=c||"";j(a,function(a,e){var f,a=a+"";f=a.match(/^[a-zA-Z]+$/)?c?
|
||||
c+"."+a:a:a.match(/\d+/)?c+"["+a+"]":c+'["'+a+'"]';d.index.push(f);"object"===typeof e&&d.createIndex(e,f)})};g.prototype.replace=function(){var a=this;j(this.index,function(c,d){if(a.pattern&&a.pattern.test&&a.pattern.exec&&d.match(a.pattern))return a.replaceValue(d);if("string"===typeof a.pattern){var b=h(d),e=h(a.pattern);if(k(b,e))return a.replaceValue(d)}});return this.json?JSON.stringify(this.instance):this.instance};g.prototype.replaceValue=function(a){var c=this,d=h(a);d.reduce(function(b,
|
||||
e,f){if(f===d.length-1)f="function"===typeof c.replacement?c.replacement(a,e,b[e]):c.replacement,b[e]=f;else return b[e]},this.instance)};var i=function(a,c,d,b){a=(new g(a,c,d)).replace();return"function"===typeof b?b(null,a):a};"undefined"!==typeof module&&module.exports?module.exports=i:"undefined"!==typeof define?define(function(){return i}):this.pinch=i})();
|
Loading…
Reference in new issue