25
25
26
26
import org .apache .commons .logging .Log ;
27
27
import org .apache .commons .logging .LogFactory ;
28
+
28
29
import org .springframework .core .log .LogMessage ;
29
30
import org .springframework .core .serializer .DefaultDeserializer ;
30
31
import org .springframework .core .serializer .Deserializer ;
@@ -47,8 +48,8 @@ public final class JdbcAssertingPartyMetadataRepository implements AssertingPart
47
48
48
49
private final JdbcOperations jdbcOperations ;
49
50
50
- private RowMapper <AssertingPartyMetadata > assertingPartyMetadataRowMapper =
51
- new AssertingPartyMetadataRowMapper ( ResultSet ::getBytes );
51
+ private RowMapper <AssertingPartyMetadata > assertingPartyMetadataRowMapper = new AssertingPartyMetadataRowMapper (
52
+ ResultSet ::getBytes );
52
53
53
54
// @formatter:off
54
55
static final String COLUMN_NAMES = "entity_id, "
@@ -79,7 +80,6 @@ public final class JdbcAssertingPartyMetadataRepository implements AssertingPart
79
80
/**
80
81
* Constructs a {@code JdbcRelyingPartyRegistrationRepository} using the provided
81
82
* parameters.
82
- *
83
83
* @param jdbcOperations the JDBC operations
84
84
*/
85
85
public JdbcAssertingPartyMetadataRepository (JdbcOperations jdbcOperations ) {
@@ -91,21 +91,18 @@ public JdbcAssertingPartyMetadataRepository(JdbcOperations jdbcOperations) {
91
91
* Sets the {@link RowMapper} used for mapping the current row in
92
92
* {@code java.sql.ResultSet} to {@link AssertingPartyMetadata}. The default is
93
93
* {@link AssertingPartyMetadataRowMapper}.
94
- *
95
94
* @param assertingPartyMetadataRowMapper the {@link RowMapper} used for mapping the
96
- * current row in {@code java.sql.ResultSet} to {@link AssertingPartyMetadata}
95
+ * current row in {@code java.sql.ResultSet} to {@link AssertingPartyMetadata}
97
96
*/
98
- public void setAssertingPartyMetadataRowMapper (
99
- RowMapper <AssertingPartyMetadata > assertingPartyMetadataRowMapper ) {
97
+ public void setAssertingPartyMetadataRowMapper (RowMapper <AssertingPartyMetadata > assertingPartyMetadataRowMapper ) {
100
98
Assert .notNull (assertingPartyMetadataRowMapper , "assertingPartyMetadataRowMapper cannot be null" );
101
99
this .assertingPartyMetadataRowMapper = assertingPartyMetadataRowMapper ;
102
100
}
103
101
104
102
@ Override
105
103
public AssertingPartyMetadata findByEntityId (String entityId ) {
106
104
Assert .hasText (entityId , "entityId cannot be empty" );
107
- SqlParameterValue [] parameters = new SqlParameterValue []{
108
- new SqlParameterValue (Types .VARCHAR , entityId )};
105
+ SqlParameterValue [] parameters = new SqlParameterValue [] { new SqlParameterValue (Types .VARCHAR , entityId ) };
109
106
PreparedStatementSetter pss = new ArgumentPreparedStatementSetter (parameters );
110
107
List <AssertingPartyMetadata > result = this .jdbcOperations .query (LOAD_BY_ID_SQL , pss ,
111
108
this .assertingPartyMetadataRowMapper );
@@ -123,7 +120,7 @@ public Iterator<AssertingPartyMetadata> iterator() {
123
120
* The default {@link RowMapper} that maps the current row in
124
121
* {@code java.sql.ResultSet} to {@link AssertingPartyMetadata}.
125
122
*/
126
- private final static class AssertingPartyMetadataRowMapper implements RowMapper <AssertingPartyMetadata > {
123
+ private static final class AssertingPartyMetadataRowMapper implements RowMapper <AssertingPartyMetadata > {
127
124
128
125
private final Log logger = LogFactory .getLog (AssertingPartyMetadataRowMapper .class );
129
126
@@ -151,38 +148,37 @@ public AssertingPartyMetadata mapRow(ResultSet rs, int rowNum) throws SQLExcepti
151
148
AssertingPartyMetadata .Builder <?> builder = new AssertingPartyDetails .Builder ();
152
149
try {
153
150
if (signingAlgorithmsBytes != null ) {
154
- List <String > signingAlgorithms = (List <String >)
155
- this . deserializer .deserializeFromByteArray (signingAlgorithmsBytes );
156
- builder .signingAlgorithms (algorithms -> algorithms .addAll (signingAlgorithms ));
151
+ List <String > signingAlgorithms = (List <String >) this . deserializer
152
+ .deserializeFromByteArray (signingAlgorithmsBytes );
153
+ builder .signingAlgorithms (( algorithms ) -> algorithms .addAll (signingAlgorithms ));
157
154
}
158
155
if (verificationCredentialsBytes != null ) {
159
- Collection <Saml2X509Credential > verificationCredentials = (Collection <Saml2X509Credential >)
160
- this .deserializer .deserializeFromByteArray (verificationCredentialsBytes );
161
- builder .verificationX509Credentials (
162
- credentials -> credentials .addAll (verificationCredentials ));
156
+ Collection <Saml2X509Credential > verificationCredentials = (Collection <Saml2X509Credential >) this .deserializer
157
+ .deserializeFromByteArray (verificationCredentialsBytes );
158
+ builder .verificationX509Credentials ((credentials ) -> credentials .addAll (verificationCredentials ));
163
159
}
164
160
if (encryptionCredentialsBytes != null ) {
165
- Collection <Saml2X509Credential > encryptionCredentials = (Collection <Saml2X509Credential >)
166
- this .deserializer .deserializeFromByteArray (encryptionCredentialsBytes );
167
- builder .encryptionX509Credentials (
168
- credentials -> credentials .addAll (encryptionCredentials ));
161
+ Collection <Saml2X509Credential > encryptionCredentials = (Collection <Saml2X509Credential >) this .deserializer
162
+ .deserializeFromByteArray (encryptionCredentialsBytes );
163
+ builder .encryptionX509Credentials ((credentials ) -> credentials .addAll (encryptionCredentials ));
169
164
}
170
- } catch (Exception ex ) {
171
- this .logger .debug (
172
- LogMessage .format ("Parsing serialized credentials for entity %s failed" , entityId ), ex );
165
+ }
166
+ catch (Exception ex ) {
167
+ this .logger .debug (LogMessage .format ("Parsing serialized credentials for entity %s failed" , entityId ),
168
+ ex );
173
169
return null ;
174
170
}
175
171
176
- builder
177
- .entityId (entityId )
178
- .wantAuthnRequestsSigned (singleSignOnSignRequest )
179
- .singleSignOnServiceLocation (singleSignOnUrl )
180
- .singleSignOnServiceBinding (singleSignOnBinding )
181
- .singleLogoutServiceLocation (singleLogoutUrl )
182
- .singleLogoutServiceBinding (singleLogoutBinding )
183
- .singleLogoutServiceResponseLocation (singleLogoutResponseUrl );
172
+ builder .entityId (entityId )
173
+ .wantAuthnRequestsSigned (singleSignOnSignRequest )
174
+ .singleSignOnServiceLocation (singleSignOnUrl )
175
+ .singleSignOnServiceBinding (singleSignOnBinding )
176
+ .singleLogoutServiceLocation (singleLogoutUrl )
177
+ .singleLogoutServiceBinding (singleLogoutBinding )
178
+ .singleLogoutServiceResponseLocation (singleLogoutResponseUrl );
184
179
return builder .build ();
185
180
}
181
+
186
182
}
187
183
188
184
private interface GetBytes {
0 commit comments