2ae424118f48ba5c0a1df06e43c732f4b8af85ec
java/com.sap.sailing.gwt.ui/GWT Sailing SDM.launch
| ... | ... | @@ -20,20 +20,6 @@ |
| 20 | 20 | <listEntry value="com.sap.sailing.gwt.home.Home"/> |
| 21 | 21 | <listEntry value="com.sap.sailing.gwt.ui.Leaderboard"/> |
| 22 | 22 | <listEntry value="com.sap.sailing.gwt.ui.Simulator"/> |
| 23 | - <listEntry value="com.sap.sailing.gwt.autoplay.AutoPlay"/> |
|
| 24 | - <listEntry value="com.sap.sailing.gwt.ui.YoutubePopup"/> |
|
| 25 | - <listEntry value="com.sap.sailing.gwt.ui.VideoPopup"/> |
|
| 26 | - <listEntry value="com.sap.sailing.gwt.ui.Simulator"/> |
|
| 27 | - <listEntry value="com.sap.sailing.gwt.ui.DataMining"/> |
|
| 28 | - <listEntry value="com.sap.sailing.gwt.regattaoverview.RegattaOverview"/> |
|
| 29 | - <listEntry value="com.sap.sailing.gwt.ui.RaceBoard"/> |
|
| 30 | - <listEntry value="com.sap.sailing.gwt.ui.EmbeddedMapAndWindChart"/> |
|
| 31 | - <listEntry value="com.sap.sailing.gwt.ui.Spectator"/> |
|
| 32 | - <listEntry value="com.sap.sailing.gwt.ui.Leaderboard"/> |
|
| 33 | - <listEntry value="com.sap.sailing.gwt.ui.LeaderboardEditing"/> |
|
| 34 | - <listEntry value="com.sap.sailing.gwt.ui.PairingList"/> |
|
| 35 | - <listEntry value="com.sap.sailing.gwt.ui.AdminConsole"/> |
|
| 36 | - <listEntry value="com.sap.sailing.gwt.home.Home"/> |
|
| 37 | 23 | </listAttribute> |
| 38 | 24 | <booleanAttribute key="com.gwtplugins.gwt.eclipse.core.SUPERDEVMODE_ENABLED" value="true"/> |
| 39 | 25 | <stringAttribute key="com.gwtplugins.gwt.eclipse.core.URL" value="/gwt/Home.html"/> |
java/com.sap.sailing.gwt.ui/src/main/java/com/google/gwt/user/client/rpc/core/com/sap/sse/security/ui/shared/IpToTimedLockDTO_CustomFieldSerializer.java
| ... | ... | @@ -0,0 +1,48 @@ |
| 1 | +package com.google.gwt.user.client.rpc.core.com.sap.sse.security.ui.shared; |
|
| 2 | + |
|
| 3 | +import com.google.gwt.user.client.rpc.CustomFieldSerializer; |
|
| 4 | +import com.google.gwt.user.client.rpc.SerializationException; |
|
| 5 | +import com.google.gwt.user.client.rpc.SerializationStreamReader; |
|
| 6 | +import com.google.gwt.user.client.rpc.SerializationStreamWriter; |
|
| 7 | +import com.sap.sse.common.TimedLock; |
|
| 8 | +import com.sap.sse.security.ui.shared.IpToTimedLockDTO; |
|
| 9 | + |
|
| 10 | +public class IpToTimedLockDTO_CustomFieldSerializer extends CustomFieldSerializer<IpToTimedLockDTO> { |
|
| 11 | + @Override |
|
| 12 | + public void serializeInstance(SerializationStreamWriter streamWriter, IpToTimedLockDTO instance) |
|
| 13 | + throws SerializationException { |
|
| 14 | + serialize(streamWriter, instance); |
|
| 15 | + } |
|
| 16 | + |
|
| 17 | + public static void serialize(SerializationStreamWriter streamWriter, IpToTimedLockDTO instance) |
|
| 18 | + throws SerializationException { |
|
| 19 | + streamWriter.writeString(instance.getIp()); |
|
| 20 | + streamWriter.writeObject(instance.getTimedLock()); |
|
| 21 | + } |
|
| 22 | + |
|
| 23 | + @Override |
|
| 24 | + public boolean hasCustomInstantiateInstance() { |
|
| 25 | + return true; |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + @Override |
|
| 29 | + public IpToTimedLockDTO instantiateInstance(SerializationStreamReader streamReader) |
|
| 30 | + throws SerializationException { |
|
| 31 | + return instantiate(streamReader); |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + public static IpToTimedLockDTO instantiate(SerializationStreamReader streamReader) |
|
| 35 | + throws SerializationException { |
|
| 36 | + return new IpToTimedLockDTO(streamReader.readString(), (TimedLock) streamReader.readObject()); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + @Override |
|
| 40 | + public void deserializeInstance(SerializationStreamReader streamReader, IpToTimedLockDTO instance) |
|
| 41 | + throws SerializationException { |
|
| 42 | + deserialize(streamReader, instance); |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + public static void deserialize(SerializationStreamReader streamReader, IpToTimedLockDTO instance) { |
|
| 46 | + // Done by instantiateInstance |
|
| 47 | + } |
|
| 48 | +} |
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/IPBlocklistTableWrapper.java
| ... | ... | @@ -2,9 +2,7 @@ package com.sap.sailing.gwt.ui.adminconsole; |
| 2 | 2 | |
| 3 | 3 | import java.util.ArrayList; |
| 4 | 4 | import java.util.Comparator; |
| 5 | -import java.util.HashMap; |
|
| 6 | 5 | import java.util.List; |
| 7 | -import java.util.Map.Entry; |
|
| 8 | 6 | |
| 9 | 7 | import com.google.gwt.event.dom.client.ClickEvent; |
| 10 | 8 | import com.google.gwt.event.dom.client.ClickHandler; |
| ... | ... | @@ -18,7 +16,6 @@ import com.google.gwt.user.client.ui.Label; |
| 18 | 16 | import com.google.gwt.user.client.ui.Widget; |
| 19 | 17 | import com.sap.sailing.gwt.ui.client.SailingServiceWriteAsync; |
| 20 | 18 | import com.sap.sailing.gwt.ui.client.StringMessages; |
| 21 | -import com.sap.sse.common.TimedLock; |
|
| 22 | 19 | import com.sap.sse.gwt.client.ErrorReporter; |
| 23 | 20 | import com.sap.sse.gwt.client.celltable.EntityIdentityComparator; |
| 24 | 21 | import com.sap.sse.gwt.client.celltable.RefreshableSelectionModel; |
| ... | ... | @@ -28,6 +25,7 @@ import com.sap.sse.security.shared.WildcardPermission; |
| 28 | 25 | import com.sap.sse.security.shared.impl.SecuredSecurityTypes; |
| 29 | 26 | import com.sap.sse.security.ui.client.UserService; |
| 30 | 27 | import com.sap.sse.security.ui.client.component.SelectedElementsCountingButton; |
| 28 | +import com.sap.sse.security.ui.shared.IpToTimedLockDTO; |
|
| 31 | 29 | |
| 32 | 30 | abstract class IPBlocklistTableWrapper |
| 33 | 31 | extends TableWrapper<IpToTimedLockDTO, RefreshableSelectionModel<IpToTimedLockDTO>> { |
| ... | ... | @@ -35,7 +33,7 @@ abstract class IPBlocklistTableWrapper |
| 35 | 33 | private final LabeledAbstractFilterablePanel<IpToTimedLockDTO> filterField; |
| 36 | 34 | private final String errorMessageOnDataFailureString; |
| 37 | 35 | |
| 38 | - protected abstract void fetchData(AsyncCallback<HashMap<String, TimedLock>> callback); |
|
| 36 | + protected abstract void fetchData(AsyncCallback<ArrayList<IpToTimedLockDTO>> callback); |
|
| 39 | 37 | |
| 40 | 38 | protected abstract void unlockIP(String ip, AsyncCallback<Void> asyncCallback); |
| 41 | 39 | |
| ... | ... | @@ -46,12 +44,12 @@ abstract class IPBlocklistTableWrapper |
| 46 | 44 | new EntityIdentityComparator<IpToTimedLockDTO>() { |
| 47 | 45 | @Override |
| 48 | 46 | public boolean representSameEntity(IpToTimedLockDTO dto1, IpToTimedLockDTO dto2) { |
| 49 | - return dto1.ip.equals(dto2.ip); |
|
| 47 | + return dto1.getIp().equals(dto2.getIp()); |
|
| 50 | 48 | } |
| 51 | 49 | |
| 52 | 50 | @Override |
| 53 | 51 | public int hashCode(IpToTimedLockDTO t) { |
| 54 | - return t.ip.hashCode(); |
|
| 52 | + return t.getIp().hashCode(); |
|
| 55 | 53 | } |
| 56 | 54 | }); |
| 57 | 55 | this.userService = userService; |
| ... | ... | @@ -108,7 +106,7 @@ abstract class IPBlocklistTableWrapper |
| 108 | 106 | @Override |
| 109 | 107 | public void onClick(ClickEvent event) { |
| 110 | 108 | for (IpToTimedLockDTO e : getSelectionModel().getSelectedSet()) { |
| 111 | - unlockIP(e.ip, new AsyncCallback<Void>() { |
|
| 109 | + unlockIP(e.getIp(), new AsyncCallback<Void>() { |
|
| 112 | 110 | @Override |
| 113 | 111 | public void onFailure(Throwable caught) { |
| 114 | 112 | errorReporter.reportError(errorMessageOnDataFailureString); |
| ... | ... | @@ -125,23 +123,17 @@ abstract class IPBlocklistTableWrapper |
| 125 | 123 | } |
| 126 | 124 | |
| 127 | 125 | private void loadDataAndPopulateTable() { |
| 128 | - final AsyncCallback<HashMap<String, TimedLock>> dataInitializationCallback = new AsyncCallback<HashMap<String, TimedLock>>() { |
|
| 126 | + final AsyncCallback<ArrayList<IpToTimedLockDTO>> dataInitializationCallback = new AsyncCallback<ArrayList<IpToTimedLockDTO>>() { |
|
| 129 | 127 | @Override |
| 130 | 128 | public void onFailure(Throwable caught) { |
| 131 | 129 | errorReporter.reportError(errorMessageOnDataFailureString); |
| 132 | 130 | } |
| 133 | 131 | |
| 134 | 132 | @Override |
| 135 | - public void onSuccess(HashMap<String, TimedLock> result) { |
|
| 133 | + public void onSuccess(ArrayList<IpToTimedLockDTO> result) { |
|
| 136 | 134 | filterField.clear(); |
| 137 | 135 | clear(); |
| 138 | - final ArrayList<IpToTimedLockDTO> iterable = new ArrayList<IpToTimedLockDTO>(); |
|
| 139 | - for (Entry<String, TimedLock> e : result.entrySet()) { |
|
| 140 | - if (e.getValue().isLocked()) { |
|
| 141 | - iterable.add(new IpToTimedLockDTO(e.getKey(), e.getValue())); |
|
| 142 | - } |
|
| 143 | - } |
|
| 144 | - filterField.addAll(iterable); |
|
| 136 | + filterField.addAll(result); |
|
| 145 | 137 | } |
| 146 | 138 | }; |
| 147 | 139 | fetchData(dataInitializationCallback); |
| ... | ... | @@ -149,11 +141,11 @@ abstract class IPBlocklistTableWrapper |
| 149 | 141 | |
| 150 | 142 | private void configureDataColumns() { |
| 151 | 143 | final ListHandler<IpToTimedLockDTO> columnListHandler = getColumnSortHandler(); |
| 152 | - addColumn(record -> record.ip, getStringMessages().ipAddress()); |
|
| 144 | + addColumn(record -> record.getIp(), getStringMessages().ipAddress()); |
|
| 153 | 145 | final Comparator<IpToTimedLockDTO> expiryComparator = (o1, o2) -> { |
| 154 | - return o1.timedLock.getLockedUntil().compareTo(o2.timedLock.getLockedUntil()); |
|
| 146 | + return o1.getTimedLock().getLockedUntil().compareTo(o2.getTimedLock().getLockedUntil()); |
|
| 155 | 147 | }; |
| 156 | - addColumn(record -> record.timedLock.getLockedUntil().toString(), getStringMessages().lockedUntil(), |
|
| 148 | + addColumn(record -> record.getTimedLock().getLockedUntil().toString(), getStringMessages().lockedUntil(), |
|
| 157 | 149 | expiryComparator); |
| 158 | 150 | table.addColumnSortHandler(columnListHandler); |
| 159 | 151 | } |
| ... | ... | @@ -165,7 +157,7 @@ abstract class IPBlocklistTableWrapper |
| 165 | 157 | @Override |
| 166 | 158 | public Iterable<String> getSearchableStrings(IpToTimedLockDTO dto) { |
| 167 | 159 | final List<String> string = new ArrayList<String>(); |
| 168 | - string.add(dto.ip); |
|
| 160 | + string.add(dto.getIp()); |
|
| 169 | 161 | return string; |
| 170 | 162 | } |
| 171 | 163 |
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/IpToTimedLockDTO.java
| ... | ... | @@ -1,20 +0,0 @@ |
| 1 | -package com.sap.sailing.gwt.ui.adminconsole; |
|
| 2 | - |
|
| 3 | -import com.sap.sse.common.TimedLock; |
|
| 4 | -import com.sap.sse.common.Named; |
|
| 5 | - |
|
| 6 | -public class IpToTimedLockDTO implements Named { |
|
| 7 | - private static final long serialVersionUID = 7877190394556881643L; |
|
| 8 | - public final String ip; |
|
| 9 | - public final TimedLock timedLock; |
|
| 10 | - |
|
| 11 | - public IpToTimedLockDTO(final String ip, final TimedLock timedLock) { |
|
| 12 | - this.ip = ip; |
|
| 13 | - this.timedLock = timedLock; |
|
| 14 | - } |
|
| 15 | - |
|
| 16 | - @Override |
|
| 17 | - public String getName() { |
|
| 18 | - return "IpToTimedLockDTO"; |
|
| 19 | - } |
|
| 20 | -} |
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LocalServerManagementPanel.java
| ... | ... | @@ -5,7 +5,6 @@ import static com.sap.sse.security.shared.HasPermissions.DefaultActions.CHANGE_O |
| 5 | 5 | |
| 6 | 6 | import java.util.ArrayList; |
| 7 | 7 | import java.util.Collections; |
| 8 | -import java.util.HashMap; |
|
| 9 | 8 | import java.util.function.Consumer; |
| 10 | 9 | import java.util.function.Predicate; |
| 11 | 10 | |
| ... | ... | @@ -31,7 +30,6 @@ import com.sap.sailing.gwt.ui.adminconsole.places.advanced.UserManagementPlace; |
| 31 | 30 | import com.sap.sailing.gwt.ui.client.SailingServiceWriteAsync; |
| 32 | 31 | import com.sap.sailing.gwt.ui.client.StringMessages; |
| 33 | 32 | import com.sap.sailing.gwt.ui.shared.ServerConfigurationDTO; |
| 34 | -import com.sap.sse.common.TimedLock; |
|
| 35 | 33 | import com.sap.sse.common.Util; |
| 36 | 34 | import com.sap.sse.common.Util.Pair; |
| 37 | 35 | import com.sap.sse.common.http.HttpHeaderUtil; |
| ... | ... | @@ -54,6 +52,7 @@ import com.sap.sse.security.ui.client.UserStatusEventHandler; |
| 54 | 52 | import com.sap.sse.security.ui.client.component.AccessControlledButtonPanel; |
| 55 | 53 | import com.sap.sse.security.ui.client.component.EditOwnershipDialog; |
| 56 | 54 | import com.sap.sse.security.ui.client.component.editacl.EditACLDialog; |
| 55 | +import com.sap.sse.security.ui.shared.IpToTimedLockDTO; |
|
| 57 | 56 | |
| 58 | 57 | public class LocalServerManagementPanel extends SimplePanel { |
| 59 | 58 | private final SailingServiceWriteAsync sailingService; |
| ... | ... | @@ -168,7 +167,7 @@ public class LocalServerManagementPanel extends SimplePanel { |
| 168 | 167 | final IPBlocklistTableWrapper table = new IPBlocklistTableWrapper(sailingService, userService, |
| 169 | 168 | stringMessages.unableToLoadIpsBlockedForBearerTokenAbuse(), stringMessages, errorReporter) { |
| 170 | 169 | @Override |
| 171 | - protected void fetchData(AsyncCallback<HashMap<String, TimedLock>> callback) { |
|
| 170 | + protected void fetchData(AsyncCallback<ArrayList<IpToTimedLockDTO>> callback) { |
|
| 172 | 171 | userService.getUserManagementService().getClientIPBasedTimedLocksForBearerTokenAbuse(callback); |
| 173 | 172 | } |
| 174 | 173 | |
| ... | ... | @@ -188,7 +187,7 @@ public class LocalServerManagementPanel extends SimplePanel { |
| 188 | 187 | final IPBlocklistTableWrapper table = new IPBlocklistTableWrapper(sailingService, userService, |
| 189 | 188 | stringMessages.unableToLoadIpsBlockedForUserCreationAbuse(), stringMessages, errorReporter) { |
| 190 | 189 | @Override |
| 191 | - protected void fetchData(AsyncCallback<HashMap<String, TimedLock>> callback) { |
|
| 190 | + protected void fetchData(AsyncCallback<ArrayList<IpToTimedLockDTO>> callback) { |
|
| 192 | 191 | userService.getUserManagementService().getClientIPBasedTimedLocksForUserCreation(callback); |
| 193 | 192 | } |
| 194 | 193 |
java/com.sap.sse.security.ui/src/main/java/com/google/gwt/user/client/rpc/core/com/sap/sse/security/ui/shared/IpToTimedLockDTO_CustomFieldSerializer.java
| ... | ... | @@ -0,0 +1,48 @@ |
| 1 | +package com.google.gwt.user.client.rpc.core.com.sap.sse.security.ui.shared; |
|
| 2 | + |
|
| 3 | +import com.google.gwt.user.client.rpc.CustomFieldSerializer; |
|
| 4 | +import com.google.gwt.user.client.rpc.SerializationException; |
|
| 5 | +import com.google.gwt.user.client.rpc.SerializationStreamReader; |
|
| 6 | +import com.google.gwt.user.client.rpc.SerializationStreamWriter; |
|
| 7 | +import com.sap.sse.common.TimedLock; |
|
| 8 | +import com.sap.sse.security.ui.shared.IpToTimedLockDTO; |
|
| 9 | + |
|
| 10 | +public class IpToTimedLockDTO_CustomFieldSerializer extends CustomFieldSerializer<IpToTimedLockDTO> { |
|
| 11 | + @Override |
|
| 12 | + public void serializeInstance(SerializationStreamWriter streamWriter, IpToTimedLockDTO instance) |
|
| 13 | + throws SerializationException { |
|
| 14 | + serialize(streamWriter, instance); |
|
| 15 | + } |
|
| 16 | + |
|
| 17 | + public static void serialize(SerializationStreamWriter streamWriter, IpToTimedLockDTO instance) |
|
| 18 | + throws SerializationException { |
|
| 19 | + streamWriter.writeString(instance.getIp()); |
|
| 20 | + streamWriter.writeObject(instance.getTimedLock()); |
|
| 21 | + } |
|
| 22 | + |
|
| 23 | + @Override |
|
| 24 | + public boolean hasCustomInstantiateInstance() { |
|
| 25 | + return true; |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + @Override |
|
| 29 | + public IpToTimedLockDTO instantiateInstance(SerializationStreamReader streamReader) |
|
| 30 | + throws SerializationException { |
|
| 31 | + return instantiate(streamReader); |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + public static IpToTimedLockDTO instantiate(SerializationStreamReader streamReader) |
|
| 35 | + throws SerializationException { |
|
| 36 | + return new IpToTimedLockDTO(streamReader.readString(), (TimedLock) streamReader.readObject()); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + @Override |
|
| 40 | + public void deserializeInstance(SerializationStreamReader streamReader, IpToTimedLockDTO instance) |
|
| 41 | + throws SerializationException { |
|
| 42 | + deserialize(streamReader, instance); |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + public static void deserialize(SerializationStreamReader streamReader, IpToTimedLockDTO instance) { |
|
| 46 | + // Done by instantiateInstance |
|
| 47 | + } |
|
| 48 | +} |
java/com.sap.sse.security.ui/src/main/java/com/sap/sse/security/ui/client/UserManagementService.java
| ... | ... | @@ -2,12 +2,10 @@ package com.sap.sse.security.ui.client; |
| 2 | 2 | |
| 3 | 3 | import java.util.ArrayList; |
| 4 | 4 | import java.util.Collection; |
| 5 | -import java.util.HashMap; |
|
| 6 | 5 | import java.util.List; |
| 7 | 6 | import java.util.Map; |
| 8 | 7 | |
| 9 | 8 | import com.google.gwt.user.client.rpc.RemoteService; |
| 10 | -import com.sap.sse.common.TimedLock; |
|
| 11 | 9 | import com.sap.sse.common.Util.Pair; |
| 12 | 10 | import com.sap.sse.common.Util.Triple; |
| 13 | 11 | import com.sap.sse.gwt.client.ServerInfoDTO; |
| ... | ... | @@ -26,6 +24,7 @@ import com.sap.sse.security.shared.dto.StrippedUserGroupDTO; |
| 26 | 24 | import com.sap.sse.security.shared.dto.UserDTO; |
| 27 | 25 | import com.sap.sse.security.shared.dto.UserGroupDTO; |
| 28 | 26 | import com.sap.sse.security.ui.oauth.client.CredentialDTO; |
| 27 | +import com.sap.sse.security.ui.shared.IpToTimedLockDTO; |
|
| 29 | 28 | import com.sap.sse.security.ui.shared.SecurityServiceSharingDTO; |
| 30 | 29 | import com.sap.sse.security.ui.shared.SuccessInfo; |
| 31 | 30 | |
| ... | ... | @@ -97,7 +96,7 @@ public interface UserManagementService extends RemoteService { |
| 97 | 96 | |
| 98 | 97 | String getBrandingConfigurationId(); |
| 99 | 98 | |
| 100 | - HashMap<String,TimedLock> getClientIPBasedTimedLocksForUserCreation() throws UnauthorizedException; |
|
| 99 | + ArrayList<IpToTimedLockDTO> getClientIPBasedTimedLocksForUserCreation() throws UnauthorizedException; |
|
| 101 | 100 | |
| 102 | - HashMap<String,TimedLock> getClientIPBasedTimedLocksForBearerTokenAbuse() throws UnauthorizedException; |
|
| 101 | + ArrayList<IpToTimedLockDTO> getClientIPBasedTimedLocksForBearerTokenAbuse() throws UnauthorizedException; |
|
| 103 | 102 | } |
java/com.sap.sse.security.ui/src/main/java/com/sap/sse/security/ui/client/UserManagementServiceAsync.java
| ... | ... | @@ -2,12 +2,10 @@ package com.sap.sse.security.ui.client; |
| 2 | 2 | |
| 3 | 3 | import java.util.ArrayList; |
| 4 | 4 | import java.util.Collection; |
| 5 | -import java.util.HashMap; |
|
| 6 | 5 | import java.util.List; |
| 7 | 6 | import java.util.Map; |
| 8 | 7 | |
| 9 | 8 | import com.google.gwt.user.client.rpc.AsyncCallback; |
| 10 | -import com.sap.sse.common.TimedLock; |
|
| 11 | 9 | import com.sap.sse.common.Util.Pair; |
| 12 | 10 | import com.sap.sse.common.Util.Triple; |
| 13 | 11 | import com.sap.sse.gwt.client.ServerInfoDTO; |
| ... | ... | @@ -24,6 +22,7 @@ import com.sap.sse.security.shared.dto.StrippedUserGroupDTO; |
| 24 | 22 | import com.sap.sse.security.shared.dto.UserDTO; |
| 25 | 23 | import com.sap.sse.security.shared.dto.UserGroupDTO; |
| 26 | 24 | import com.sap.sse.security.ui.oauth.client.CredentialDTO; |
| 25 | +import com.sap.sse.security.ui.shared.IpToTimedLockDTO; |
|
| 27 | 26 | import com.sap.sse.security.ui.shared.SecurityServiceSharingDTO; |
| 28 | 27 | import com.sap.sse.security.ui.shared.SuccessInfo; |
| 29 | 28 | |
| ... | ... | @@ -110,7 +109,7 @@ public interface UserManagementServiceAsync { |
| 110 | 109 | |
| 111 | 110 | void getBrandingConfigurationId(AsyncCallback<String> callback); |
| 112 | 111 | |
| 113 | - void getClientIPBasedTimedLocksForUserCreation(AsyncCallback<HashMap<String,TimedLock>> callback); |
|
| 112 | + void getClientIPBasedTimedLocksForUserCreation(AsyncCallback<ArrayList<IpToTimedLockDTO>> callback); |
|
| 114 | 113 | |
| 115 | - void getClientIPBasedTimedLocksForBearerTokenAbuse(AsyncCallback<HashMap<String,TimedLock>> callback); |
|
| 114 | + void getClientIPBasedTimedLocksForBearerTokenAbuse(AsyncCallback<ArrayList<IpToTimedLockDTO>> callback); |
|
| 116 | 115 | } |
java/com.sap.sse.security.ui/src/main/java/com/sap/sse/security/ui/server/UserManagementServiceImpl.java
| ... | ... | @@ -3,7 +3,6 @@ package com.sap.sse.security.ui.server; |
| 3 | 3 | import java.util.ArrayList; |
| 4 | 4 | import java.util.Collection; |
| 5 | 5 | import java.util.HashMap; |
| 6 | -import java.util.Iterator; |
|
| 7 | 6 | import java.util.List; |
| 8 | 7 | import java.util.Map; |
| 9 | 8 | import java.util.Map.Entry; |
| ... | ... | @@ -62,6 +61,7 @@ import com.sap.sse.security.shared.impl.UserGroup; |
| 62 | 61 | import com.sap.sse.security.ui.client.SerializationDummy; |
| 63 | 62 | import com.sap.sse.security.ui.client.UserManagementService; |
| 64 | 63 | import com.sap.sse.security.ui.oauth.client.CredentialDTO; |
| 64 | +import com.sap.sse.security.ui.shared.IpToTimedLockDTO; |
|
| 65 | 65 | import com.sap.sse.security.ui.shared.SecurityServiceSharingDTO; |
| 66 | 66 | import com.sap.sse.security.ui.shared.SuccessInfo; |
| 67 | 67 | import com.sap.sse.util.ServiceTrackerFactory; |
| ... | ... | @@ -440,41 +440,23 @@ public class UserManagementServiceImpl extends RemoteServiceServlet implements U |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | @Override |
| 443 | - public HashMap<String, TimedLock> getClientIPBasedTimedLocksForUserCreation() throws UnauthorizedException { |
|
| 443 | + public ArrayList<IpToTimedLockDTO> getClientIPBasedTimedLocksForUserCreation() throws UnauthorizedException { |
|
| 444 | + final HashMap<String, TimedLock> ipToLockMap = getSecurityService().getClientIPBasedTimedLocksForUserCreation(); |
|
| 445 | + return filterIpToTimedLockTableByCurrentUserReadPermission(ipToLockMap); |
|
| 446 | + } |
|
| 447 | + |
|
| 448 | + private ArrayList<IpToTimedLockDTO> filterIpToTimedLockTableByCurrentUserReadPermission( |
|
| 449 | + final HashMap<String, TimedLock> ipToLockMap) { |
|
| 444 | 450 | final SecurityService securityService = getSecurityService(); |
| 445 | - final HashMap<String, TimedLock> ipToLockMap = securityService.getClientIPBasedTimedLocksForUserCreation(); |
|
| 446 | - final Iterator<Entry<String, TimedLock>> iterator = ipToLockMap.entrySet().iterator(); |
|
| 447 | - // remove from Map, those where permission == FALSE |
|
| 448 | - while (iterator.hasNext()) { |
|
| 449 | - final Entry<String, TimedLock> ipToLockPair = iterator.next(); |
|
| 450 | - final String ip = ipToLockPair.getKey(); |
|
| 451 | - final WildcardPermission userReadPermissionOnIp = SecuredSecurityTypes.LOCKED_IP |
|
| 452 | - .getPermissionForObject(DefaultActions.READ, new IPAddress(ip)); |
|
| 453 | - final boolean isPermitted = SecurityUtils.getSubject().isPermitted(userReadPermissionOnIp.toString()); |
|
| 454 | - if (!isPermitted) { |
|
| 455 | - iterator.remove(); |
|
| 456 | - } |
|
| 457 | - } |
|
| 458 | - return ipToLockMap; |
|
| 451 | + return Util.mapToArrayList( |
|
| 452 | + Util.filter(ipToLockMap.entrySet(), |
|
| 453 | + e->securityService.hasCurrentUserReadPermission(new IPAddress(e.getKey()))), |
|
| 454 | + e->new IpToTimedLockDTO(e.getKey(), e.getValue())); |
|
| 459 | 455 | } |
| 460 | 456 | |
| 461 | 457 | @Override |
| 462 | - public HashMap<String, TimedLock> getClientIPBasedTimedLocksForBearerTokenAbuse() throws UnauthorizedException { |
|
| 463 | - final SecurityService securityService = getSecurityService(); |
|
| 464 | - final HashMap<String, TimedLock> ipToLockMap = securityService.getClientIPBasedTimedLocksForBearerTokenAbuse(); |
|
| 465 | - // remove from Map, those where permission == FALSE |
|
| 466 | - final Iterator<Entry<String, TimedLock>> iterator = ipToLockMap.entrySet().iterator(); |
|
| 467 | - // remove from Map, those where permission == FALSE |
|
| 468 | - while (iterator.hasNext()) { |
|
| 469 | - final Entry<String, TimedLock> ipToLockPair = iterator.next(); |
|
| 470 | - final String ip = ipToLockPair.getKey(); |
|
| 471 | - final WildcardPermission userReadPermissionOnIp = SecuredSecurityTypes.LOCKED_IP |
|
| 472 | - .getPermissionForObject(DefaultActions.READ, new IPAddress(ip)); |
|
| 473 | - final boolean isPermitted = SecurityUtils.getSubject().isPermitted(userReadPermissionOnIp.toString()); |
|
| 474 | - if (!isPermitted) { |
|
| 475 | - iterator.remove(); |
|
| 476 | - } |
|
| 477 | - } |
|
| 478 | - return ipToLockMap; |
|
| 458 | + public ArrayList<IpToTimedLockDTO> getClientIPBasedTimedLocksForBearerTokenAbuse() throws UnauthorizedException { |
|
| 459 | + final HashMap<String, TimedLock> ipToLockMap = getSecurityService().getClientIPBasedTimedLocksForBearerTokenAbuse(); |
|
| 460 | + return filterIpToTimedLockTableByCurrentUserReadPermission(ipToLockMap); |
|
| 479 | 461 | } |
| 480 | 462 | } |
java/com.sap.sse.security.ui/src/main/java/com/sap/sse/security/ui/shared/IpToTimedLockDTO.java
| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | +package com.sap.sse.security.ui.shared; |
|
| 2 | + |
|
| 3 | +import com.sap.sse.common.TimedLock; |
|
| 4 | +import com.sap.sse.common.Named; |
|
| 5 | + |
|
| 6 | +public class IpToTimedLockDTO implements Named { |
|
| 7 | + private static final long serialVersionUID = 7877190394556881643L; |
|
| 8 | + private final String ip; |
|
| 9 | + private final TimedLock timedLock; |
|
| 10 | + |
|
| 11 | + public IpToTimedLockDTO(final String ip, final TimedLock timedLock) { |
|
| 12 | + this.ip = ip; |
|
| 13 | + this.timedLock = timedLock; |
|
| 14 | + } |
|
| 15 | + |
|
| 16 | + @Override |
|
| 17 | + public String getName() { |
|
| 18 | + return "IpToTimedLockDTO"; |
|
| 19 | + } |
|
| 20 | + |
|
| 21 | + public String getIp() { |
|
| 22 | + return ip; |
|
| 23 | + } |
|
| 24 | + |
|
| 25 | + public TimedLock getTimedLock() { |
|
| 26 | + return timedLock; |
|
| 27 | + } |
|
| 28 | +} |