Skip to content
/ cas Public

Commit 7f2c36d

Browse files
committed
fix: rework null checks with nullaway [skip ci]
1 parent 721eafc commit 7f2c36d

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
run: find ./ci -type f -name "*.sh" -exec chmod +x "{}" \; && ./ci/init-build.sh
6868
- name: Configure PGP
6969
run: echo "$PGP_PRIVATE_KEY" | gpg --batch --import
70-
- name: Release CAS
70+
- name: Release CAS ${{ inputs.releaseVersion }}
7171
run: |
7272
RELEASE_VERSION="${{ inputs.releaseVersion }}"
7373

core/cas-server-core/src/main/java/org/apereo/cas/DefaultCentralAuthenticationService.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,10 @@
6868
*/
6969
@Slf4j
7070
public class DefaultCentralAuthenticationService extends AbstractCentralAuthenticationService {
71-
@Serial
72-
private static final long serialVersionUID = -8943828074939533986L;
73-
7471
public DefaultCentralAuthenticationService(final CentralAuthenticationServiceContext context) {
7572
super(context);
7673
}
7774

78-
7975
@Audit(
8076
action = AuditableActions.TICKET_GRANTING_TICKET,
8177
actionResolverName = AuditActionResolvers.CREATE_TICKET_GRANTING_TICKET_RESOLVER,
@@ -257,7 +253,7 @@ public Assertion validateServiceTicket(final String serviceTicketId, final Servi
257253
val ticketGrantingTicket = (TicketGrantingTicket) serviceTicket.getTicketGrantingTicket();
258254
var authentication = serviceTicket.isStateless()
259255
? serviceTicket.getAuthentication()
260-
: ticketGrantingTicket.getRoot().getAuthentication();
256+
: Objects.requireNonNull(ticketGrantingTicket).getRoot().getAuthentication();
261257

262258
authentication = getAuthenticationSatisfiedByPolicy(authentication, selectedService, Objects.requireNonNull(registeredService));
263259
Objects.requireNonNull(authentication, "Authentication cannot be determined for service ticket validation");
@@ -309,7 +305,7 @@ public Assertion validateServiceTicket(final String serviceTicketId, final Servi
309305

310306
val assertionContext = serviceTicket.isStateless()
311307
? CollectionUtils.<String, Serializable>wrap(Principal.class.getName(), authentication.getPrincipal().getId())
312-
: CollectionUtils.<String, Serializable>wrap(TicketGrantingTicket.class.getName(), ticketGrantingTicket.getRoot().getId());
308+
: CollectionUtils.<String, Serializable>wrap(TicketGrantingTicket.class.getName(), Objects.requireNonNull(ticketGrantingTicket).getRoot().getId());
313309

314310
val assertion = DefaultAssertionBuilder.builder()
315311
.primaryAuthentication(finalAuthentication)
@@ -318,7 +314,7 @@ public Assertion validateServiceTicket(final String serviceTicketId, final Servi
318314
.registeredService(registeredService)
319315
.authentications(serviceTicket.isStateless()
320316
? List.of(Objects.requireNonNull(serviceTicket.getAuthentication()))
321-
: ticketGrantingTicket.getChainedAuthentications())
317+
: Objects.requireNonNull(ticketGrantingTicket).getChainedAuthentications())
322318
.newLogin(((RenewableServiceTicket) serviceTicket).isFromNewLogin())
323319
.stateless(serviceTicket.isStateless())
324320
.context(assertionContext)
@@ -376,7 +372,8 @@ public Ticket createProxyGrantingTicket(final String serviceTicketId,
376372
val addedTicket = configurationContext.getTicketRegistry().addTicket(proxyGrantingTicket);
377373
LOGGER.debug("Generated proxy granting ticket [{}] based off of [{}]", proxyGrantingTicket, serviceTicketId);
378374
if (!serviceTicket.isStateless()) {
379-
configurationContext.getTicketRegistry().updateTicket(serviceTicket.getTicketGrantingTicket());
375+
configurationContext.getTicketRegistry()
376+
.updateTicket(Objects.requireNonNull(serviceTicket.getTicketGrantingTicket()));
380377
}
381378
val clientInfo = ClientInfoHolder.getClientInfo();
382379
doPublishEvent(new CasProxyGrantingTicketCreatedEvent(this, addedTicket, clientInfo));

support/cas-server-support-openrewrite/recipes/META-INF/rewrite/cas800.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ recipeList:
2929
overwrite: true
3030
filePattern: 'gradle.properties'
3131
- org.openrewrite.gradle.UpdateGradleWrapper:
32-
version: 9.3.0-rc-3
32+
version: 9.3.0
3333
addIfMissing: true
3434
- org.openrewrite.gradle.AddProperty:
3535
key: tomcatVersion

0 commit comments

Comments
 (0)