Skip to content
Closed
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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -52,52 +52,64 @@ public Response createPrincipalRole(
RealmContext realmContext,
SecurityContext securityContext) {
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.BEFORE_CREATE_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap().put(EventAttributes.CREATE_PRINCIPAL_ROLE_REQUEST, request)));
PolarisEventType.BEFORE_CREATE_PRINCIPAL_ROLE,
() ->
new PolarisEvent(
PolarisEventType.BEFORE_CREATE_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap().put(EventAttributes.CREATE_PRINCIPAL_ROLE_REQUEST, request)));
Response resp = delegate.createPrincipalRole(request, realmContext, securityContext);
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.AFTER_CREATE_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE, (PrincipalRole) resp.getEntity())));
PolarisEventType.AFTER_CREATE_PRINCIPAL_ROLE,
() ->
new PolarisEvent(
PolarisEventType.AFTER_CREATE_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE, (PrincipalRole) resp.getEntity())));
return resp;
}

@Override
public Response deletePrincipalRole(
String principalRoleName, RealmContext realmContext, SecurityContext securityContext) {
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.BEFORE_DELETE_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap().put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)));
PolarisEventType.BEFORE_DELETE_PRINCIPAL_ROLE,
() ->
new PolarisEvent(
PolarisEventType.BEFORE_DELETE_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap().put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)));
Response resp = delegate.deletePrincipalRole(principalRoleName, realmContext, securityContext);
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.AFTER_DELETE_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap().put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)));
PolarisEventType.AFTER_DELETE_PRINCIPAL_ROLE,
() ->
new PolarisEvent(
PolarisEventType.AFTER_DELETE_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap().put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)));
return resp;
}

@Override
public Response getPrincipalRole(
String principalRoleName, RealmContext realmContext, SecurityContext securityContext) {
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.BEFORE_GET_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap().put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)));
PolarisEventType.BEFORE_GET_PRINCIPAL_ROLE,
() ->
new PolarisEvent(
PolarisEventType.BEFORE_GET_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap().put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)));
Response resp = delegate.getPrincipalRole(principalRoleName, realmContext, securityContext);
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.AFTER_GET_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE, (PrincipalRole) resp.getEntity())));
PolarisEventType.AFTER_GET_PRINCIPAL_ROLE,
() ->
new PolarisEvent(
PolarisEventType.AFTER_GET_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE, (PrincipalRole) resp.getEntity())));
return resp;
}

Expand All @@ -108,37 +120,45 @@ public Response updatePrincipalRole(
RealmContext realmContext,
SecurityContext securityContext) {
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.BEFORE_UPDATE_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)
.put(EventAttributes.UPDATE_PRINCIPAL_ROLE_REQUEST, updateRequest)));
PolarisEventType.BEFORE_UPDATE_PRINCIPAL_ROLE,
() ->
new PolarisEvent(
PolarisEventType.BEFORE_UPDATE_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)
.put(EventAttributes.UPDATE_PRINCIPAL_ROLE_REQUEST, updateRequest)));
Response resp =
delegate.updatePrincipalRole(
principalRoleName, updateRequest, realmContext, securityContext);
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.AFTER_UPDATE_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE, (PrincipalRole) resp.getEntity())));
PolarisEventType.AFTER_UPDATE_PRINCIPAL_ROLE,
() ->
new PolarisEvent(
PolarisEventType.AFTER_UPDATE_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE, (PrincipalRole) resp.getEntity())));
return resp;
}

@Override
public Response listPrincipalRoles(RealmContext realmContext, SecurityContext securityContext) {
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.BEFORE_LIST_PRINCIPAL_ROLES,
eventMetadataFactory.create(),
new AttributeMap()));
PolarisEventType.BEFORE_LIST_PRINCIPAL_ROLES,
() ->
new PolarisEvent(
PolarisEventType.BEFORE_LIST_PRINCIPAL_ROLES,
eventMetadataFactory.create(),
new AttributeMap()));
Response resp = delegate.listPrincipalRoles(realmContext, securityContext);
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.AFTER_LIST_PRINCIPAL_ROLES,
eventMetadataFactory.create(),
new AttributeMap()));
PolarisEventType.AFTER_LIST_PRINCIPAL_ROLES,
() ->
new PolarisEvent(
PolarisEventType.AFTER_LIST_PRINCIPAL_ROLES,
eventMetadataFactory.create(),
new AttributeMap()));
return resp;
}

Expand All @@ -150,24 +170,28 @@ public Response assignCatalogRoleToPrincipalRole(
RealmContext realmContext,
SecurityContext securityContext) {
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.BEFORE_ASSIGN_CATALOG_ROLE_TO_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)
.put(EventAttributes.CATALOG_NAME, catalogName)
.put(EventAttributes.CATALOG_ROLE_NAME, request.getCatalogRole().getName())));
PolarisEventType.BEFORE_ASSIGN_CATALOG_ROLE_TO_PRINCIPAL_ROLE,
() ->
new PolarisEvent(
PolarisEventType.BEFORE_ASSIGN_CATALOG_ROLE_TO_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)
.put(EventAttributes.CATALOG_NAME, catalogName)
.put(EventAttributes.CATALOG_ROLE_NAME, request.getCatalogRole().getName())));
Response resp =
delegate.assignCatalogRoleToPrincipalRole(
principalRoleName, catalogName, request, realmContext, securityContext);
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.AFTER_ASSIGN_CATALOG_ROLE_TO_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)
.put(EventAttributes.CATALOG_NAME, catalogName)
.put(EventAttributes.CATALOG_ROLE_NAME, request.getCatalogRole().getName())));
PolarisEventType.AFTER_ASSIGN_CATALOG_ROLE_TO_PRINCIPAL_ROLE,
() ->
new PolarisEvent(
PolarisEventType.AFTER_ASSIGN_CATALOG_ROLE_TO_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)
.put(EventAttributes.CATALOG_NAME, catalogName)
.put(EventAttributes.CATALOG_ROLE_NAME, request.getCatalogRole().getName())));
return resp;
}

Expand All @@ -179,43 +203,51 @@ public Response revokeCatalogRoleFromPrincipalRole(
RealmContext realmContext,
SecurityContext securityContext) {
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.BEFORE_REVOKE_CATALOG_ROLE_FROM_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)
.put(EventAttributes.CATALOG_NAME, catalogName)
.put(EventAttributes.CATALOG_ROLE_NAME, catalogRoleName)));
PolarisEventType.BEFORE_REVOKE_CATALOG_ROLE_FROM_PRINCIPAL_ROLE,
() ->
new PolarisEvent(
PolarisEventType.BEFORE_REVOKE_CATALOG_ROLE_FROM_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)
.put(EventAttributes.CATALOG_NAME, catalogName)
.put(EventAttributes.CATALOG_ROLE_NAME, catalogRoleName)));
Response resp =
delegate.revokeCatalogRoleFromPrincipalRole(
principalRoleName, catalogName, catalogRoleName, realmContext, securityContext);
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.AFTER_REVOKE_CATALOG_ROLE_FROM_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)
.put(EventAttributes.CATALOG_NAME, catalogName)
.put(EventAttributes.CATALOG_ROLE_NAME, catalogRoleName)));
PolarisEventType.AFTER_REVOKE_CATALOG_ROLE_FROM_PRINCIPAL_ROLE,
() ->
new PolarisEvent(
PolarisEventType.AFTER_REVOKE_CATALOG_ROLE_FROM_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)
.put(EventAttributes.CATALOG_NAME, catalogName)
.put(EventAttributes.CATALOG_ROLE_NAME, catalogRoleName)));
return resp;
}

@Override
public Response listAssigneePrincipalsForPrincipalRole(
String principalRoleName, RealmContext realmContext, SecurityContext securityContext) {
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.BEFORE_LIST_ASSIGNEE_PRINCIPALS_FOR_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap().put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)));
PolarisEventType.BEFORE_LIST_ASSIGNEE_PRINCIPALS_FOR_PRINCIPAL_ROLE,
() ->
new PolarisEvent(
PolarisEventType.BEFORE_LIST_ASSIGNEE_PRINCIPALS_FOR_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap().put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)));
Response resp =
delegate.listAssigneePrincipalsForPrincipalRole(
principalRoleName, realmContext, securityContext);
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.AFTER_LIST_ASSIGNEE_PRINCIPALS_FOR_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap().put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)));
PolarisEventType.AFTER_LIST_ASSIGNEE_PRINCIPALS_FOR_PRINCIPAL_ROLE,
() ->
new PolarisEvent(
PolarisEventType.AFTER_LIST_ASSIGNEE_PRINCIPALS_FOR_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap().put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)));
return resp;
}

Expand All @@ -226,22 +258,26 @@ public Response listCatalogRolesForPrincipalRole(
RealmContext realmContext,
SecurityContext securityContext) {
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.BEFORE_LIST_CATALOG_ROLES_FOR_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)
.put(EventAttributes.CATALOG_NAME, catalogName)));
PolarisEventType.BEFORE_LIST_CATALOG_ROLES_FOR_PRINCIPAL_ROLE,
() ->
new PolarisEvent(
PolarisEventType.BEFORE_LIST_CATALOG_ROLES_FOR_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)
.put(EventAttributes.CATALOG_NAME, catalogName)));
Response resp =
delegate.listCatalogRolesForPrincipalRole(
principalRoleName, catalogName, realmContext, securityContext);
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.AFTER_LIST_CATALOG_ROLES_FOR_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)
.put(EventAttributes.CATALOG_NAME, catalogName)));
PolarisEventType.AFTER_LIST_CATALOG_ROLES_FOR_PRINCIPAL_ROLE,
() ->
new PolarisEvent(
PolarisEventType.AFTER_LIST_CATALOG_ROLES_FOR_PRINCIPAL_ROLE,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.PRINCIPAL_ROLE_NAME, principalRoleName)
.put(EventAttributes.CATALOG_NAME, catalogName)));
return resp;
}
}
Loading