-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#550] Provide messageArguments and messageIf for UsernameNotAvailabl…
…eException and BadCredentialsException
- Loading branch information
Showing
5 changed files
with
67 additions
and
3 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
30 changes: 30 additions & 0 deletions
30
src/main/java/cz/cvut/kbss/analysis/exception/BadCredentialsException.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,30 @@ | ||
package cz.cvut.kbss.analysis.exception; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.Map; | ||
|
||
@Getter | ||
@Setter | ||
public class BadCredentialsException extends org.springframework.security.authentication.BadCredentialsException { | ||
|
||
private final String messageId; | ||
private Map<String, String> messageArguments; | ||
|
||
public BadCredentialsException(String message) { | ||
super(message); | ||
this.messageId = null; | ||
} | ||
|
||
public BadCredentialsException(String message, Throwable cause) { | ||
super(message, cause); | ||
this.messageId = null; | ||
} | ||
|
||
public BadCredentialsException(String messageId, String message, Map<String, String> args){ | ||
super(message); | ||
this.messageId = messageId; | ||
messageArguments = args; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/cz/cvut/kbss/analysis/exception/UsernameNotAvailableException.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 |
---|---|---|
@@ -1,7 +1,26 @@ | ||
package cz.cvut.kbss.analysis.exception; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.Map; | ||
|
||
@Getter | ||
@Setter | ||
public class UsernameNotAvailableException extends RuntimeException { | ||
|
||
private final String messageId; | ||
private Map<String, String> messageArguments; | ||
|
||
public UsernameNotAvailableException(String message) { | ||
super(message); | ||
messageId = null; | ||
} | ||
|
||
public UsernameNotAvailableException(String messageId, String message, Map<String, String> args){ | ||
super(message); | ||
this.messageId = messageId; | ||
messageArguments = args; | ||
} | ||
|
||
} |
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