-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #446 from SEKOIA-IO/Refactor/Azure_ad
Add some actions and update others
- Loading branch information
Showing
14 changed files
with
2,168 additions
and
634 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
## 2023-10-31 - 2.5 | ||
|
||
### Changed | ||
|
||
- Add 3 actions : Delete app, Revoke sign in, Reset password | ||
- Update 5 actions : Disable User, Enable user, Get sign in, Get User, Get User authentication methods |
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,18 @@ | ||
{ | ||
"name": "Delete app", | ||
"description": "Delete an app in azure AD. Requires the Application.ReadWrite.OwnedBy or Application.ReadWrite.All.", | ||
"uuid": "ec4039ec-7991-48ac-9d8f-503ef17013a2", | ||
"docker_parameters": "DeleteApplicationAction", | ||
"arguments": { | ||
"title": "ApplicationArguments", | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"title": "Id", | ||
"description": "ID of the app.", | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"results": {} | ||
} |
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,28 @@ | ||
{ | ||
"name": "Reset User Password", | ||
"description": "Reset a user's password. You will need UserAuthenticationMethod.ReadWrite.All deleguated permission. And to disable the MFA authentication in your azure AD", | ||
"uuid": "a6676d23-4b6d-4892-95c7-d02cc8c9436d", | ||
"docker_parameters": "ResetUserPasswordAction", | ||
"arguments": { | ||
"title": "RequiredTwoUserArguments", | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"title": "Id", | ||
"description": "ID of the user. id or userPrincipalName should be specified.", | ||
"type": "string" | ||
}, | ||
"userPrincipalName": { | ||
"title": "Userprincipalname", | ||
"description": "Principal Name of the user. id or userPrincipalName should be specified.", | ||
"type": "string" | ||
}, | ||
"userNewPassword": { | ||
"title": "Usernewpassword", | ||
"description": "New password, required to reset the old one of course.", | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"results": {} | ||
} |
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 @@ | ||
{ | ||
"name": "Revoke Sign in", | ||
"description": "Invalidates all the refresh tokens issued to applications for a user. Requires the User.ReadWrite.All or Directory.ReadWrite.All permissions.", | ||
"uuid": "4be1e1e1-cb41-4b93-ac3d-cdc6a5c38c71", | ||
"docker_parameters": "RevokeSignInsSessionsAction", | ||
"arguments": { | ||
"title": "SingleUserArguments", | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"title": "Id", | ||
"description": "ID of the app.", | ||
"type": "string" | ||
}, | ||
"userPrincipalName": { | ||
"title": "Userprincipalname", | ||
"description": "Principal Name of the user. id or userPrincipalName should be specified.", | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"results": {} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import asyncio | ||
|
||
from .base import MicrosoftGraphAction, ApplicationArguments | ||
|
||
from kiota_abstractions.native_response_handler import NativeResponseHandler | ||
from kiota_http.middleware.options import ResponseHandlerOption | ||
from msgraph.generated.users.item.messages.messages_request_builder import MessagesRequestBuilder | ||
|
||
|
||
class DeleteApplicationAction(MicrosoftGraphAction): | ||
name = "Delete application" | ||
description = ( | ||
"Delete an application object. Requires the Application.ReadWrite.OwnedBy or Application.ReadWrite.All." | ||
) | ||
|
||
async def query_delete_app(self, id, req_conf): | ||
return await self.client.applications.by_application_id(id).delete(request_configuration=req_conf) | ||
|
||
async def run(self, arguments: ApplicationArguments): | ||
request_configuration = MessagesRequestBuilder.MessagesRequestBuilderGetRequestConfiguration( | ||
options=[ResponseHandlerOption(NativeResponseHandler())], | ||
) | ||
|
||
response = await self.query_delete_app(arguments.id, request_configuration) | ||
|
||
response.raise_for_status() |
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.