-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for http authorization & authentication
- Loading branch information
1 parent
0b8cc59
commit d42f5b0
Showing
15 changed files
with
284 additions
and
230 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
53 changes: 0 additions & 53 deletions
53
src/main/kotlin/online/danielstefani/paddy/authentication/AuthenticationController.kt
This file was deleted.
Oops, something went wrong.
61 changes: 0 additions & 61 deletions
61
src/main/kotlin/online/danielstefani/paddy/authorization/AuthorizationController.kt
This file was deleted.
Oops, something went wrong.
43 changes: 0 additions & 43 deletions
43
src/main/kotlin/online/danielstefani/paddy/authorization/dto/AuthorizationResultDto.kt
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
src/main/kotlin/online/danielstefani/paddy/db/device/Device.kt
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
src/main/kotlin/online/danielstefani/paddy/db/device/DeviceRepository.kt
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
src/main/kotlin/online/danielstefani/paddy/security/AbstractAuthorizationController.kt
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,31 @@ | ||
package online.danielstefani.paddy.security | ||
|
||
import io.quarkus.logging.Log | ||
import online.danielstefani.paddy.security.dto.AuthorizationResultDto | ||
import online.danielstefani.paddy.security.dto.AuthorizationResultDto.* | ||
import org.jboss.resteasy.reactive.RestResponse | ||
import org.jboss.resteasy.reactive.RestResponse.* | ||
|
||
abstract class AbstractAuthorizationController { | ||
|
||
fun allow(principal: String, resource: String): RestResponse<AuthorizationResultDto> { | ||
Log.info("Allowing <$principal>'s access to <$resource>.") | ||
return ResponseBuilder.ok(AuthorizationResultDto(AuthorizationResult.ALLOW, resource)) | ||
.status(Status.OK) | ||
.build() | ||
} | ||
|
||
fun forbid(principal: String, resource: String): RestResponse<AuthorizationResultDto> { | ||
Log.info("Forbidding <$principal>'s access to <$resource>.") | ||
return ResponseBuilder.ok(AuthorizationResultDto(AuthorizationResult.DENY, resource)) | ||
.status(Status.OK) | ||
.build() | ||
} | ||
|
||
fun ignore(principal: String, resource: String): RestResponse<AuthorizationResultDto> { | ||
Log.info("Sending <$principal>'s access to <$resource> to next authorizer in chain.") | ||
return ResponseBuilder.ok(AuthorizationResultDto(AuthorizationResult.IGNORE, resource)) | ||
.status(Status.OK) | ||
.build() | ||
} | ||
} |
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.