Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions apps/oauth2/lib/diagrams/GetOauth2TokenController.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
```plantuml
repository Controller {
repository Oauth2Controller {
package Oauth2WebController {
// GetOauth2TokenInputPort is defined in the Features/GetOauth2Token/GetOauth2TokenPublic/GetOauth2TokenUseCase repository
class Oauth2WebController {
+ Oauth2WebControllerHTTPResponse getOauth2Token(GetOauth2TokenInputPort getOauth2TokenInputPort, Oauth2WebControllerHTTPRequest oauth2WebControllerHTTPRequest)
}

class Oauth2WebControllerHTTPRequest {
- Oauth2WebControllerHTTPRequestBody oauth2WebControllerHTTPRequestBody
+ Oauth2WebControllerHTTPRequestBody getRequestBody()
+ self setRequestBody(Oauth2WebControllerHTTPRequestBody oauth2WebControllerHTTPRequestBody)
}

class Oauth2WebControllerHTTPRequestBody {
- string grant_type
- string code
- string refresh_token
- string client_id
- string client_secret
+ string getGrantType()
+ self setGrantType(string grant_type)
+ string getCode()
+ self setCode(string code)
+ string getRefreshToken()
+ self setRefreshToken(string refresh_token)
+ string getClientId()
+ self setClientId(string client_id)
+ string getClientSecret()
+ self setClientSecret(string client_secret)
}

class Oauth2WebControllerHTTPResponse {
- integer response_code
- Oauth2WebControllerHTTPResponseBody oauth2WebControllerHTTPResponseBody
+ integer getResponseCode()
+ self setResponseCode(integer response_code)
+ Oauth2WebControllerHTTPResponseBody getResponseBody()
+ self setResponseBody(Oauth2WebControllerHTTPResponseBody oauth2WebControllerHTTPResponseBody)
}

class Oauth2WebControllerHTTPResponseBody {
- string access_token
- string refresh_token
- string user_id
+ string getAccessToken()
+ self setAccessToken(string access_token)
+ string getRefreshToken()
+ self setRefreshToken(string refresh_token)
+ string getUserId()
+ self setUserId(string user_id)
}

// GetOauth2TokenOutputPort is defined in the Features/GetOauth2Token/GetOauth2TokenPublic/GetOauth2TokenUseCase repository
class Oauth2WebControllerHTTPPresenter implements GetOauth2TokenOutputPort {
+ void retrieveGetOauth2TokenOutputPort(GetOauth2TokenOutputPort getOauth2TokenOutputPort)
+ Oauth2WebControllerHTTPResponse getHTTPResponse()
}
}
}

respository Exceptions {
// Used by contollers' input Data Transfer Objects
class BadRequestException {
- string error_message
- string custom_error_code
+ string getErrorMessage()
+ string getCustomErrorCode()
+ self setCustomErrorCode(string custom_error_code)
}
}
}
```
209 changes: 209 additions & 0 deletions apps/oauth2/lib/diagrams/GetOauth2TokenFeature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
```plantuml
repository Components {
package Oauth2Component {
repository Oauth2ComponentAPI {
class Oauth2ComponentAPI {
+ GetOauth2TokenInputPort startOauth2TokenRetrievalInputPort()
}
}

repository Features {
repository GetOauth2Token {
repository GetOauth2TokenPublic {
repository GetOauth2TokenUseCase {
interface GetOauth2TokenInputPort {
+ void getOauth2Token(GetOauth2TokenInput, GetOauth2TokenOutputPort)
}

class GetOauth2TokenInput {
- string grant_type
- string code
- string refresh_token
- string client_id
- string client_secret
+ string getGrantType()
+ self setGrantType(string grant_type)
+ string getCode()
+ self setCode(string code)
+ string getRefreshToken()
+ self setRefreshToken(string refresh_token)
+ string getClientId()
+ self setClientId(string client_id)
+ string getClientSecret()
+ self setClientSecret(string client_secret)
}

enum GetOauth2TokenAuthorisedGrantType {
case AUTHORIZATION_CODE = "authorization_code"
case REFRESH_TOKEN = "refresh_token"
}

class GetOauth2TokenOutput {
- string access_token
- string refresh_token
- string user_id
+ string getAccessToken()
+ self setAccessToken(string access_token)
+ string getRefreshToken()
+ self setRefreshToken(string refresh_token)
+ string getUserId()
+ self setUserId(string user_id)
}

interface GetOauth2TokenOutputPort {
+ void retrieveGetOauth2TokenOutputPort(GetOauth2TokenOutputPort getOauth2TokenOutputPort)
}
}
}

repository GetOauth2TokenInternals {
repository GetOauth2TokenUseCase {
class GetOauth2TokenUseCase {
+ construct(
GetOauth2TokenAccessTokenRepository getOauth2TokenAccessTokenRepository,
GetOauth2TokenClientRepository getOauth2TokenClientRepository,
GetOauth2TokenDatabaseStateHandler getOauth2TokenDatabaseStateHandler,
GetOauth2TokenCryptographyHandler getOauth2TokenCryptographyHandler,
GetOauth2TokenTimeHandler getOauth2TokenTimeHandler,
GetOauth2TokenRandomGenerator getOauth2TokenRandomGenerator,
GetOauth2TokenApplicationTokenProvider getOauth2TokenApplicationTokenProvider
)
+ void getOauth2Token(GetOauth2TokenInput getOauth2TokenInput, GetOauth2TokenOutputPort getOauth2TokenOutputPort)
}

interface GetOauth2TokenAccessTokenRepository {
+ Oauth2AccessToken getAccessTokenByCode(string oauth2_access_token_hashed_code)
+ void deleteAccessToken(integer oauth2_access_token_id)
+ integer rotateToken(
integer oauth2_access_token_id,
string code,
string new_code,
string new_encrypted_token,
boolean is_grant_type_authorization_code
)
}

interface GetOauth2TokenApplicationTokenProvider {
+ ApplicationToken getTokenById(integer token_id)
+ ApplicationToken rotate(
ApplicationToken applicationToken,
ApplicationToken decryptedToken,
ApplicationToken newToken
)
+ void updateToken(ApplicationToken applicationToken)
+ void invalidateToken(ApplicationToken applicationToken)
}

interface GetOauth2TokenClientRepository {
+ Client getByUID(string client_UID)
}

interface GetOauth2TokenCryptographyHandler {
+ string calculateHMAC(string client_secret)
+ string encrypt(string value_to_encrypt, string secret_key)
+ string decrypt(string encrypted_value, string secret_key)
}

interface GetOauth2TokenTimeHandler {
+ integer getCurrentTimestamp()
}

interface GetOauth2TokenRandomGenerator {
+ string generateToken()
+ string generateCode()
}

interface GetOauth2TokenDatabaseStateHandler {
+ void conserveDatabaseState()
+ void revertDatabaseChanges()
+ void commitDatabaseChanges()
}
}

repository GetOauth2TokenMain {
repository Database {
class Oauth2AccessTokenDatabaseOnQBMapper implements GetOauth2TokenAccessTokenRepository {
- AccessTokenMapper
+ Oauth2AccessToken getAccessTokenByCode(string oauth2_access_token_hashed_code)
+ void deleteAccessToken(integer oauth2_access_token_id)
+ integer rotateToken(
integer oauth2_access_token_id,
string code,
string new_code,
string new_encrypted_token,
boolean is_grant_type_authorization_code
)
}

class GetOauth2TokenClientMapper implements GetOauth2TokenClientRepository {
+ Client getByUID(string client_UID)
}

class GetOauth2TokenDatabaseOnMySQLHandler implements GetOauth2TokenDatabaseStateHandler {
+ void conserveDatabaseState()
+ void revertDatabaseChanges()
+ void commitDatabaseChanges()
}
}

repository Security {
class GetOauth2TokenInternalCryptographyHandler implements GetOauth2TokenCryptographyHandler {
+ string calculateHMAC(string client_secret)
+ string encrypt(string value_to_encrypt, string secret_key)
+ string decrypt(string encrypted_value, string secret_key)
}

class GetOauth2TokenInternalSecureRandomGenerator implements GetOauth2TokenRandomGenerator {
+ string generateToken()
+ string generateCode()
}
}

repository Time {
class class GetOauth2TokenUtilityTimeFactory implements GetOauth2TokenTimeHandler {
+ integer getCurrentTimestamp()
}
}

repository TokenProvider {
class GetOauth2TokenTokenProvider implements GetOauth2TokenApplicationTokenProvider {
// See lib/private/Authentication/Token/PublicKeyTokenProvider.php
+ Oauth2ApplicationToken getTokenById(integer token_id)
+ Oauth2ApplicationToken rotate(
Oauth2ApplicationToken oauth2ApplicationToken,
string old_token_id,
string new_token_id
)
+ void updateToken(Oauth2ApplicationToken oauth2ApplicationToken)
+ void invalidateToken(Oauth2ApplicationToken oauth2ApplicationToken)
}
}
}
}
}
}
}
}

repository Exceptions {
repository UseCaseExceptions {
// Used by use cases' input Data Transfer Objects
class UnauthorisedActionException {
- string error_message
- string custom_error_code
+ string getErrorMessage()
+ string getCustomErrorCode()
+ self setCustomErrorCode(string custom_error_code)
}

// Used by use cases' output Data Transfer Objects
class InternalErrorException {
- string error_message
- string custom_error_code
+ string getErrorMessage()
+ string getCustomErrorCode()
+ self setCustomErrorCode(string custom_error_code)
}
}
}
```
Loading