Changeset 339:f018669698a8
- Timestamp:
- 09/16/11 20:35:43 (5 months ago)
- Branch:
- default
- Convert:
- svn:7c3792e6-d75b-4784-96a6-b298f655ee64/trunk@2773
- Location:
- kraken-dom
- Files:
-
- 1 added
- 5 edited
-
pom.xml (modified) (1 diff)
-
src/main/java/org/krakenapps/dom/api/impl/AdminApiImpl.java (modified) (5 diffs)
-
src/main/java/org/krakenapps/dom/exception/AccessControlException.java (added)
-
src/main/java/org/krakenapps/dom/exception/InvalidOtpPasswordException.java (modified) (1 diff)
-
src/main/java/org/krakenapps/dom/exception/LoginFailedException.java (modified) (1 diff)
-
src/main/java/org/krakenapps/dom/exception/MaxSessionException.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
kraken-dom/pom.xml
r329 r339 11 11 <groupId>org.krakenapps</groupId> 12 12 <artifactId>kraken-dom</artifactId> 13 <version>1.2.1 6</version>13 <version>1.2.17</version> 14 14 <packaging>bundle</packaging> 15 15 <name>Kraken DOM</name> -
kraken-dom/src/main/java/org/krakenapps/dom/api/impl/AdminApiImpl.java
r337 r339 37 37 import org.krakenapps.dom.api.OtpApi; 38 38 import org.krakenapps.dom.api.UserExtensionProvider; 39 import org.krakenapps.dom.exception.AccessControlException; 39 40 import org.krakenapps.dom.exception.AdminLockedException; 40 41 import org.krakenapps.dom.exception.CannotRemoveRequestingAdminException; … … 79 80 public Admin login(Session session, String nick, String hash, boolean force) throws LoginFailedException { 80 81 Admin admin = getAdmin(nick, session); 82 83 // check acl (trust host) 84 checkAcl(session, admin); 85 86 // check password 81 87 String password = null; 82 83 88 if (otpApi != null && admin.isUseOtp()) 84 89 password = Sha1.hash(otpApi.getOtpValue(admin.getOtpSeed())); … … 87 92 88 93 if (hash.equals(Sha1.hash(password + session.getString("nonce")))) { 89 OrganizationParameter param = orgParamApi.getOrganizationParameter(admin.getUser().getOrganization() 90 .getId(),"max_sessions");94 OrganizationParameter param = orgParamApi.getOrganizationParameter(admin.getUser().getOrganization().getId(), 95 "max_sessions"); 91 96 if (param != null) { 92 97 try { … … 111 116 for (LoginCallback callback : callbacks) 112 117 callback.onLoginSuccess(admin, session); 113 loggedIn.add(new LoggedInAdmin(admin.getRole().getLevel(), new Date(), session, admin.getUser() 114 .getLoginName())); 118 loggedIn.add(new LoggedInAdmin(admin.getRole().getLevel(), new Date(), session, admin.getUser().getLoginName())); 115 119 return admin; 116 120 } else { … … 122 126 else 123 127 throw new InvalidPasswordException(); 128 } 129 } 130 131 private void checkAcl(Session session, Admin admin) { 132 if (admin.isUseAcl()) { 133 boolean found = false; 134 String remote = session.getRemoteAddress().getHostAddress(); 135 136 for (AdminTrustHost h : admin.getTrustHosts()) 137 if (h.getIp() != null && h.getIp().equals(remote)) 138 found = true; 139 140 if (!found) { 141 updateLoginFailures(admin, false); 142 throw new AccessControlException(); 143 } 124 144 } 125 145 } -
kraken-dom/src/main/java/org/krakenapps/dom/exception/InvalidOtpPasswordException.java
r328 r339 1 /* 2 * Copyright 2011 Future Systems, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 1 16 package org.krakenapps.dom.exception; 2 17 -
kraken-dom/src/main/java/org/krakenapps/dom/exception/LoginFailedException.java
r314 r339 1 /* 2 * Copyright 2011 Future Systems, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 1 16 package org.krakenapps.dom.exception; 2 17 -
kraken-dom/src/main/java/org/krakenapps/dom/exception/MaxSessionException.java
r323 r339 1 /* 2 * Copyright 2011 Future Systems, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 1 16 package org.krakenapps.dom.exception; 2 17
Note: See TracChangeset
for help on using the changeset viewer.
