List of usage examples for java.lang SecurityException SecurityException
public SecurityException(Throwable cause)
From source file:nl.surfnet.coin.selfservice.domain.CoinUser.java
/** * It is not allowed to call this method {@inheritDoc} *///from www. j a v a2s . c o m @Override @JsonIgnore public String getPassword() { throw new SecurityException("Self service interface does not contain passwords"); }
From source file:com.vmware.identity.idm.server.IdmLoginManager.java
@Override public IIdentityManager Login(String hash) throws RemoteException, SecurityException { if (serverHash.equals(hash)) { return this.server; } else {/* w ww . ja v a 2 s . c om*/ throw new SecurityException("Access denied. Invalid Authentication Attempt."); } }
From source file:org.directwebremoting.servlet.MonitorHandler.java
public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException { if (!debug) { log.warn(/* w w w . j av a2 s .co m*/ "Failed attempt to access test pages outside of debug mode. Set the debug init-parameter to true to enable."); throw new SecurityException("Access to debug pages is denied."); } response.setContentType(MimeConstants.MIME_HTML); PrintWriter out = response.getWriter(); out.print("<html><head><title>DWR - System Monitor</title></head><body>"); WebContext webContext = WebContextFactory.get(); out.print("<h1>DWR - System Monitor</h1>"); out.print("<h2>Global Settings:</h2>"); String contextPath = webContext.getContextPath(); out.print("<p>ContextPath: " + contextPath + "</p>"); out.print("<p>Current Page: " + webContext.getCurrentPage() + "</p>"); //ScriptSession scriptSession = webContext.getScriptSession(); Container container = webContext.getContainer(); SortedMap<String, Object> beans = new TreeMap<String, Object>(); SortedMap<String, String> settings = new TreeMap<String, String>(); SortedMap<String, String> urls = new TreeMap<String, String>(); for (String name : container.getBeanNames()) { Object bean = container.getBean(name); if (name.startsWith("url:")) { urls.put(name.substring(4), bean.getClass().getName()); } else if (bean instanceof String) { settings.put(name, bean.toString()); } else { beans.put(name, bean); } } // Add all the beans to an ID map for <a name=ID> IdManager ids = new IdManager(); // Remove the URL re-writers from the Settings map for (Map.Entry<String, String> urlEntry : urls.entrySet()) { for (Iterator<Map.Entry<String, String>> it = settings.entrySet().iterator(); it.hasNext();) { Map.Entry<String, String> settingEntry = it.next(); if (urlEntry.getKey().equals(settingEntry.getValue())) { it.remove(); urls.put(urlEntry.getKey(), urlEntry.getValue() + " (" + settingEntry.getKey() + ")"); } } } out.print("<h2>Beans:</h2>"); for (Map.Entry<String, Object> entry : beans.entrySet()) { String name = entry.getKey(); Object object = entry.getValue(); digWhatever(out, ids, name, object); } out.print("<h2>Settings:</h2>"); for (Map.Entry<String, String> entry : settings.entrySet()) { out.print("<p>" + entry.getKey() + ": \"" + entry.getValue() + "\"</p>"); } out.print("<h2>URLs:</h2>"); String prefix = contextPath + webContext.getHttpServletRequest().getServletPath(); for (Map.Entry<String, String> entry : urls.entrySet()) { out.print("<p><a href='" + prefix + entry.getKey() + "'>" + entry.getKey() + "</a>: " + entry.getValue() + "</p>"); } webContext.getContextPath(); out.print("</body></html>"); }
From source file:au.com.borner.salesforce.client.rest.domain.LoginResponse.java
public void verify(String consumerSecret) { SecretKey hmacKey = null;// w w w .j ava 2s .com try { byte[] key = consumerSecret.getBytes(); hmacKey = new SecretKeySpec(key, ALGORITHM); Mac mac = Mac.getInstance(ALGORITHM); mac.init(hmacKey); byte[] digest = mac.doFinal((getIdUrl() + getIssuedAt()).getBytes()); byte[] decode_sig = new Base64(true).decode(getSignature()); if (!Arrays.equals(digest, decode_sig)) { throw new SecurityException("Signature could not be verified!"); } } catch (NoSuchAlgorithmException e) { throw new SecurityException(String.format( "Algorithm not found while trying to verifying signature: algorithm=%s; message=%s", ALGORITHM, e.getMessage()), e); } catch (InvalidKeyException e) { throw new SecurityException( String.format("Invalid key encountered while trying to verify signature: key=%s; message=%s", hmacKey, e.getMessage()), e); } }
From source file:org.callistasoftware.netcare.api.rest.AlarmApi.java
@RequestMapping(value = "/list", produces = "application/json", method = RequestMethod.GET) @ResponseBody//from ww w. jav a 2s .com public ServiceResult<Alarm[]> loadAlarmsForCareUnit(HttpServletRequest request) { final UserBaseView user = this.getUser(); if (user != null && user.isCareActor()) { final CareActorBaseView ca = (CareActorBaseView) user; ServiceResult<Alarm[]> result = this.service.getCareUnitAlarms(ca.getCareUnit().getHsaId()); for (Alarm alarm : result.getData()) { this.logAccess("list", "alarms", request, alarm.getPatient(), alarm.getHealtPlanName()); } return result; } throw new SecurityException( "Illegal to access alarms for care unit. No logged in user or user is not a care giver."); }
From source file:com.dgq.utils.EncodeUtils.java
/** * URL ?, EncodeUTF-8./*www.j a v a 2 s . c om*/ */ public static String urlDecode(String part) { try { return URLDecoder.decode(part, DEFAULT_URL_ENCODING); } catch (UnsupportedEncodingException e) { throw new SecurityException("URL?!"); } }
From source file:com.changhong.sso.core.authentication.handlers.DefaultPasswordEncoder.java
public String encode(final String password) { if (password == null) { return null; }//from ww w. j av a 2s .c o m try { MessageDigest messageDigest = MessageDigest.getInstance(this.encodingAlgorithm); if (StringUtils.hasText(this.characterEncoding)) { messageDigest.update(password.getBytes(this.characterEncoding)); } else { messageDigest.update(password.getBytes()); } final byte[] digest = messageDigest.digest(); return getFormattedText(digest); } catch (final NoSuchAlgorithmException e) { throw new SecurityException(e); } catch (final UnsupportedEncodingException e) { throw new RuntimeException(e); } }
From source file:org.commonreality.participant.impl.handlers.ConnectionHandler.java
@Override public void accept(ISessionInfo<?> t, ConnectionAcknowledgment ack) { IIdentifier id = ack.getAssignedIdentifier(); _participant.setCommonRealityIdentifier(ack.getSource()); if (LOGGER.isDebugEnabled()) LOGGER.debug("Got connection acknowledgement, our id : " + id); if (_participant.getIdentifier() != null) if (LOGGER.isWarnEnabled()) LOGGER.warn("We already have a valid identifier, but we got an acknowledgment anyway?"); /*/*w w w. j a v a 2s . c om*/ * if id is null, we're about to crap out.. */ if (id == null) { if (LOGGER.isWarnEnabled()) LOGGER.warn("Connection denied " + ack.getResponseMessage()); throw new SecurityException("Connection denied : " + ack.getResponseMessage()); } _participant.setIdentifier(id); }
From source file:org.apache.openejb.core.rmi.BlacklistClassResolver.java
public final String check(final String name) { if (isBlacklisted(name)) { throw new SecurityException(name + " is not whitelisted as deserialisable, prevented before loading it, " + "customize tomee.serialization.class.blacklist and tomee.serialization.class.whitelist to add it to not fail there. " + "-Dtomee.serialization.class.blacklist=- -Dtomee.serialization.class.whitelist=" + name + " for instance (or in conf/system.properties)."); }//from w w w .j a v a 2s .co m return name; }