-
Notifications
You must be signed in to change notification settings - Fork 44
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
1 parent
c415ee4
commit a241fe7
Showing
8 changed files
with
118 additions
and
40 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
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
41 changes: 41 additions & 0 deletions
41
.../src/main/java/it/infn/mw/iam/audit/events/account/x509/X509CertificateUnlinkedEvent.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,41 @@ | ||
/** | ||
* Copyright (c) Istituto Nazionale di Fisica Nucleare (INFN). 2016-2021 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package it.infn.mw.iam.audit.events.account.x509; | ||
|
||
import it.infn.mw.iam.audit.events.account.AccountEvent; | ||
import it.infn.mw.iam.persistence.model.IamAccount; | ||
|
||
public class X509CertificateUnlinkedEvent extends AccountEvent { | ||
|
||
/** | ||
* | ||
*/ | ||
private static final long serialVersionUID = 1L; | ||
|
||
|
||
private final String certificateSubject; | ||
|
||
public X509CertificateUnlinkedEvent(Object source, IamAccount account, String message, | ||
String certificateSubject) { | ||
super(source, account, message); | ||
this.certificateSubject = certificateSubject; | ||
} | ||
|
||
public String getCertificateSubject() { | ||
return certificateSubject; | ||
} | ||
|
||
} |
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
23 changes: 23 additions & 0 deletions
23
...nce/src/main/java/it/infn/mw/iam/persistence/repository/IamX509CertificateRepository.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 it.infn.mw.iam.persistence.repository; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.PagingAndSortingRepository; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import it.infn.mw.iam.persistence.model.IamAccount; | ||
import it.infn.mw.iam.persistence.model.IamX509Certificate; | ||
|
||
public interface IamX509CertificateRepository | ||
extends PagingAndSortingRepository<IamX509Certificate, Long> { | ||
|
||
@Query("select c.account from IamX509Certificate c where c.subjectDn = :subject") | ||
List<IamAccount> findBySubject(@Param("subject") String subject); | ||
|
||
@Query("select c from IamX509Certificate c where c.subjectDn = :subject and c.issuerDn = :issuer") | ||
Optional<IamX509Certificate> findBySubjectAndIssuer(@Param("subject") String subject, | ||
@Param("issuer") String issuer); | ||
|
||
} |
3 changes: 2 additions & 1 deletion
3
iam-persistence/src/main/resources/db/migration/h2/V97__delete_unique_subject_dn.sql
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
ALTER TABLE iam_x509_cert DROP CONSTRAINT CONSTRAINT_32; | ||
ALTER TABLE iam_x509_cert DROP CONSTRAINT IF EXISTS CONSTRAINT_327; | ||
ALTER TABLE iam_x509_cert DROP CONSTRAINT IF EXISTS UNIQ_IAM_X509_CERT_CERIFICATE; | ||
CREATE INDEX idx_subject_dn ON iam_x509_cert(subject_dn); |