-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
77 additions
and
64 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
15 changes: 15 additions & 0 deletions
15
BE/src/main/java/com/issuetracker/auth/dto/UserAgentDTO.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,15 @@ | ||
package com.issuetracker.auth.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Setter; | ||
|
||
@Setter | ||
public class UserAgentDTO { | ||
|
||
@JsonProperty("User-Agent") | ||
private String userAgent; | ||
|
||
public String getUserAgent() { | ||
return userAgent.split("/")[0]; | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
BE/src/main/java/com/issuetracker/auth/service/UserAgent.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,23 @@ | ||
package com.issuetracker.auth.service; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
enum UserAgent { | ||
|
||
POSTMAN("PostmanRuntime"), | ||
FRONT("Mozilla"), | ||
IOS("IssueTrackerIOS"); | ||
|
||
private final String userAgent; | ||
|
||
public static boolean isFront(String userAgent) { | ||
return FRONT.userAgent.equals(userAgent) || POSTMAN.userAgent.equals(userAgent); | ||
} | ||
|
||
public static boolean isIOS(String userAgent) { | ||
return IOS.userAgent.equals(userAgent) || POSTMAN.userAgent.equals(userAgent); | ||
} | ||
} |
16 changes: 0 additions & 16 deletions
16
BE/src/main/java/com/issuetracker/config/HostHeaderConverter.java
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
BE/src/main/java/com/issuetracker/config/UserAgentHeaderConverter.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,16 @@ | ||
package com.issuetracker.config; | ||
|
||
import com.issuetracker.auth.dto.UserAgentDTO; | ||
import org.springframework.core.convert.converter.Converter; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class UserAgentHeaderConverter implements Converter<String, UserAgentDTO> { | ||
|
||
@Override | ||
public UserAgentDTO convert(String userAgent) { | ||
UserAgentDTO userAgentDTO = new UserAgentDTO(); | ||
userAgentDTO.setUserAgent(userAgent); | ||
return userAgentDTO; | ||
} | ||
} |
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