-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
5b659d6
commit c5c4cd9
Showing
14 changed files
with
235 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...urity/powerauth/lib/webflow/authentication/service/websocket/WebSocketMessageService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright 2024 Wultra s.r.o. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package io.getlime.security.powerauth.lib.webflow.authentication.service.websocket; | ||
|
||
import io.getlime.security.powerauth.lib.nextstep.model.enumeration.AuthResult; | ||
|
||
/** | ||
* Interface for WebSocket messages. | ||
* | ||
* @author Roman Strobl, roman.strobl@wultra.com | ||
*/ | ||
public interface WebSocketMessageService { | ||
|
||
/** | ||
* Notification of clients about completed authorization. | ||
* | ||
* @param operationId Operation ID. | ||
* @param authResult Authorization result. | ||
*/ | ||
void notifyAuthorizationComplete(String operationId, AuthResult authResult); | ||
|
||
/** | ||
* Sends a message about successful websocket registration to the user. | ||
* | ||
* @param operationHash Operation hash. | ||
* @param sessionId Session ID. | ||
* @param registrationSucceeded Whether Web Socket registration was successful. | ||
*/ | ||
void sendRegistrationMessage(String operationHash, String sessionId, boolean registrationSucceeded); | ||
|
||
/** | ||
* Get Web Socket session ID for given operation hash. | ||
* | ||
* @param operationHash Operation hash. | ||
* @return Web Socket session ID. | ||
*/ | ||
String lookupWebSocketSessionId(String operationHash); | ||
|
||
/** | ||
* Store a mapping for new web socket identifier to the Web Socket session with given ID. | ||
* | ||
* @param operationHash Operation hash. | ||
* @param webSocketSessionId Web Socket Session ID. | ||
* @param clientIpAddress Remote client IP address. | ||
* @return Whether Web Socket registration was successful. | ||
*/ | ||
boolean registerWebSocketSession(String operationHash, String webSocketSessionId, String clientIpAddress); | ||
|
||
} |
56 changes: 56 additions & 0 deletions
56
.../powerauth/lib/webflow/authentication/service/websocket/WebSocketMessageServiceDummy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright 2024 Wultra s.r.o. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package io.getlime.security.powerauth.lib.webflow.authentication.service.websocket; | ||
|
||
import io.getlime.security.powerauth.lib.nextstep.model.enumeration.AuthResult; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* Dummy WebSocket service. | ||
* | ||
* @author Roman Strobl, roman.strobl@wultra.com | ||
*/ | ||
@Service | ||
@Slf4j | ||
@ConditionalOnProperty(name = "powerauth.webflow.websockets.enabled", havingValue = "false", matchIfMissing = true) | ||
public class WebSocketMessageServiceDummy implements WebSocketMessageService { | ||
|
||
{ | ||
logger.info("WebSocketMessageServiceDummy was initialized."); | ||
} | ||
|
||
@Override | ||
public void notifyAuthorizationComplete(String operationId, AuthResult authResult) { | ||
} | ||
|
||
@Override | ||
public void sendRegistrationMessage(String operationHash, String sessionId, boolean registrationSucceeded) { | ||
} | ||
|
||
@Override | ||
public String lookupWebSocketSessionId(String operationHash) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean registerWebSocketSession(String operationHash, String webSocketSessionId, String clientIpAddress) { | ||
return false; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.