mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-03-01 02:49:11 +00:00
Consistently NonNull annotation
Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
This commit is contained in:
parent
31fb7feed5
commit
5d089f680e
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -20,10 +20,9 @@ import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.function.Function;
|
||||
|
||||
import reactor.util.annotation.NonNull;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.security.core.annotation.AnnotationTemplateExpressionDefaults;
|
||||
import org.springframework.security.core.annotation.SecurityAnnotationScanner;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -29,7 +29,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@ -67,6 +66,7 @@ import org.opensaml.saml.saml2.core.SubjectConfirmationData;
|
||||
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.core.log.LogMessage;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
||||
import org.springframework.security.authentication.AuthenticationProvider;
|
||||
import org.springframework.security.core.Authentication;
|
||||
@ -565,13 +565,13 @@ class BaseOpenSamlAuthenticationProvider implements AuthenticationProvider {
|
||||
conditions.add(new AudienceRestrictionConditionValidator());
|
||||
conditions.add(new DelegationRestrictionConditionValidator());
|
||||
conditions.add(new ConditionValidator() {
|
||||
@Nonnull
|
||||
@NonNull
|
||||
@Override
|
||||
public QName getServicedCondition() {
|
||||
return OneTimeUse.DEFAULT_ELEMENT_NAME;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@NonNull
|
||||
@Override
|
||||
public ValidationResult validate(Condition condition, Assertion assertion, ValidationContext context) {
|
||||
// applications should validate their own OneTimeUse conditions
|
||||
@ -580,16 +580,16 @@ class BaseOpenSamlAuthenticationProvider implements AuthenticationProvider {
|
||||
});
|
||||
conditions.add(new ProxyRestrictionConditionValidator());
|
||||
subjects.add(new BearerSubjectConfirmationValidator() {
|
||||
@Nonnull
|
||||
protected ValidationResult validateAddress(@Nonnull SubjectConfirmation confirmation,
|
||||
@Nonnull Assertion assertion, @Nonnull ValidationContext context, boolean required)
|
||||
@NonNull
|
||||
protected ValidationResult validateAddress(@NonNull SubjectConfirmation confirmation,
|
||||
@NonNull Assertion assertion, @NonNull ValidationContext context, boolean required)
|
||||
throws AssertionValidationException {
|
||||
return ValidationResult.VALID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
protected ValidationResult validateAddress(@Nonnull SubjectConfirmationData confirmationData,
|
||||
@Nonnull Assertion assertion, @Nonnull ValidationContext context, boolean required)
|
||||
@NonNull
|
||||
protected ValidationResult validateAddress(@NonNull SubjectConfirmationData confirmationData,
|
||||
@NonNull Assertion assertion, @NonNull ValidationContext context, boolean required)
|
||||
throws AssertionValidationException {
|
||||
// applications should validate their own addresses - gh-7514
|
||||
return ValidationResult.VALID;
|
||||
@ -599,7 +599,7 @@ class BaseOpenSamlAuthenticationProvider implements AuthenticationProvider {
|
||||
|
||||
static final SAML20AssertionValidator attributeValidator = new SAML20AssertionValidator(conditions, subjects,
|
||||
statements, null, null, null) {
|
||||
@Nonnull
|
||||
@NonNull
|
||||
@Override
|
||||
protected ValidationResult validateSignature(Assertion token, ValidationContext context) {
|
||||
return ValidationResult.VALID;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -26,8 +26,6 @@ import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
|
||||
import org.opensaml.core.criterion.EntityIdCriterion;
|
||||
import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
|
||||
@ -265,7 +263,7 @@ public final class OpenSaml4AssertingPartyMetadataRepository implements Assertin
|
||||
return this.resource.getFile();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@NonNull
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return this.resource.getInputStream();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -19,7 +19,6 @@ package org.springframework.security.saml2.provider.service.authentication;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
@ -40,6 +39,7 @@ import org.opensaml.saml.common.xml.SAMLConstants;
|
||||
import org.opensaml.saml.saml2.core.AttributeValue;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.security.saml2.core.OpenSamlInitializationService;
|
||||
|
||||
public final class TestCustomOpenSaml4Objects {
|
||||
@ -103,7 +103,7 @@ public final class TestCustomOpenSaml4Objects {
|
||||
|
||||
public static class CustomOpenSamlObjectImpl extends AbstractXMLObject implements CustomOpenSamlObject {
|
||||
|
||||
@Nonnull
|
||||
@NonNull
|
||||
private IndexedXMLObjectChildrenList<XMLObject> unknownXMLObjects;
|
||||
|
||||
/**
|
||||
@ -113,22 +113,22 @@ public final class TestCustomOpenSaml4Objects {
|
||||
* represents
|
||||
* @param namespacePrefix the prefix for the given namespace
|
||||
*/
|
||||
protected CustomOpenSamlObjectImpl(@Nullable String namespaceURI, @Nonnull String elementLocalName,
|
||||
@Nullable String namespacePrefix) {
|
||||
protected CustomOpenSamlObjectImpl(@javax.annotation.Nullable String namespaceURI,
|
||||
@NonNull String elementLocalName, @Nullable String namespacePrefix) {
|
||||
super(namespaceURI, elementLocalName, namespacePrefix);
|
||||
super.getNamespaceManager().registerNamespaceDeclaration(new Namespace(CUSTOM_NS, TYPE_CUSTOM_PREFIX));
|
||||
this.unknownXMLObjects = new IndexedXMLObjectChildrenList<>(this);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@NonNull
|
||||
@Override
|
||||
public List<XMLObject> getUnknownXMLObjects() {
|
||||
return this.unknownXMLObjects;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@NonNull
|
||||
@Override
|
||||
public List<XMLObject> getUnknownXMLObjects(@Nonnull QName typeOrName) {
|
||||
public List<XMLObject> getUnknownXMLObjects(@NonNull QName typeOrName) {
|
||||
return (List<XMLObject>) this.unknownXMLObjects.subList(typeOrName);
|
||||
}
|
||||
|
||||
@ -162,9 +162,9 @@ public final class TestCustomOpenSaml4Objects {
|
||||
|
||||
public static class CustomSamlObjectBuilder extends AbstractXMLObjectBuilder<CustomOpenSamlObject> {
|
||||
|
||||
@Nonnull
|
||||
@NonNull
|
||||
@Override
|
||||
public CustomOpenSamlObject buildObject(@Nullable String namespaceURI, @Nonnull String localName,
|
||||
public CustomOpenSamlObject buildObject(@Nullable String namespaceURI, @NonNull String localName,
|
||||
@Nullable String namespacePrefix) {
|
||||
return new CustomOpenSamlObjectImpl(namespaceURI, localName, namespacePrefix);
|
||||
}
|
||||
@ -178,7 +178,7 @@ public final class TestCustomOpenSaml4Objects {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void marshallElementContent(@Nonnull XMLObject xmlObject, @Nonnull Element domElement) {
|
||||
protected void marshallElementContent(@NonNull XMLObject xmlObject, @NonNull Element domElement) {
|
||||
final CustomOpenSamlObject customSamlObject = (CustomOpenSamlObject) xmlObject;
|
||||
|
||||
for (XMLObject object : customSamlObject.getOrderedChildren()) {
|
||||
@ -195,15 +195,15 @@ public final class TestCustomOpenSaml4Objects {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processChildElement(@Nonnull XMLObject parentXMLObject, @Nonnull XMLObject childXMLObject)
|
||||
protected void processChildElement(@NonNull XMLObject parentXMLObject, @NonNull XMLObject childXMLObject)
|
||||
throws UnmarshallingException {
|
||||
final CustomOpenSamlObject customSamlObject = (CustomOpenSamlObject) parentXMLObject;
|
||||
customSamlObject.getUnknownXMLObjects().add(childXMLObject);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@NonNull
|
||||
@Override
|
||||
protected XMLObject buildXMLObject(@Nonnull Element domElement) {
|
||||
protected XMLObject buildXMLObject(@NonNull Element domElement) {
|
||||
return new CustomOpenSamlObjectImpl(SAMLConstants.SAML20_NS, AttributeValue.DEFAULT_ELEMENT_LOCAL_NAME,
|
||||
CustomOpenSamlObject.TYPE_CUSTOM_PREFIX);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -26,8 +26,6 @@ import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.shibboleth.shared.resolver.CriteriaSet;
|
||||
import org.opensaml.core.criterion.EntityIdCriterion;
|
||||
import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
|
||||
@ -266,7 +264,7 @@ public final class OpenSaml5AssertingPartyMetadataRepository implements Assertin
|
||||
return this.resource.getFile();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@NonNull
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return this.resource.getInputStream();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -19,7 +19,6 @@ package org.springframework.security.saml2.provider.service.authentication;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
@ -40,6 +39,7 @@ import org.opensaml.saml.common.xml.SAMLConstants;
|
||||
import org.opensaml.saml.saml2.core.AttributeValue;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.security.saml2.core.OpenSamlInitializationService;
|
||||
|
||||
public final class TestCustomOpenSaml5Objects {
|
||||
@ -103,7 +103,7 @@ public final class TestCustomOpenSaml5Objects {
|
||||
|
||||
public static class CustomOpenSamlObjectImpl extends AbstractXMLObject implements CustomOpenSamlObject {
|
||||
|
||||
@Nonnull
|
||||
@NonNull
|
||||
private IndexedXMLObjectChildrenList<XMLObject> unknownXMLObjects;
|
||||
|
||||
/**
|
||||
@ -113,22 +113,22 @@ public final class TestCustomOpenSaml5Objects {
|
||||
* represents
|
||||
* @param namespacePrefix the prefix for the given namespace
|
||||
*/
|
||||
protected CustomOpenSamlObjectImpl(@Nullable String namespaceURI, @Nonnull String elementLocalName,
|
||||
protected CustomOpenSamlObjectImpl(@Nullable String namespaceURI, @NonNull String elementLocalName,
|
||||
@Nullable String namespacePrefix) {
|
||||
super(namespaceURI, elementLocalName, namespacePrefix);
|
||||
super.getNamespaceManager().registerNamespaceDeclaration(new Namespace(CUSTOM_NS, TYPE_CUSTOM_PREFIX));
|
||||
this.unknownXMLObjects = new IndexedXMLObjectChildrenList<>(this);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@NonNull
|
||||
@Override
|
||||
public List<XMLObject> getUnknownXMLObjects() {
|
||||
return this.unknownXMLObjects;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@NonNull
|
||||
@Override
|
||||
public List<XMLObject> getUnknownXMLObjects(@Nonnull QName typeOrName) {
|
||||
public List<XMLObject> getUnknownXMLObjects(@NonNull QName typeOrName) {
|
||||
return (List<XMLObject>) this.unknownXMLObjects.subList(typeOrName);
|
||||
}
|
||||
|
||||
@ -162,9 +162,9 @@ public final class TestCustomOpenSaml5Objects {
|
||||
|
||||
public static class CustomSamlObjectBuilder extends AbstractXMLObjectBuilder<CustomOpenSamlObject> {
|
||||
|
||||
@Nonnull
|
||||
@NonNull
|
||||
@Override
|
||||
public CustomOpenSamlObject buildObject(@Nullable String namespaceURI, @Nonnull String localName,
|
||||
public CustomOpenSamlObject buildObject(@Nullable String namespaceURI, @NonNull String localName,
|
||||
@Nullable String namespacePrefix) {
|
||||
return new CustomOpenSamlObjectImpl(namespaceURI, localName, namespacePrefix);
|
||||
}
|
||||
@ -178,7 +178,7 @@ public final class TestCustomOpenSaml5Objects {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void marshallElementContent(@Nonnull XMLObject xmlObject, @Nonnull Element domElement) {
|
||||
protected void marshallElementContent(@NonNull XMLObject xmlObject, @NonNull Element domElement) {
|
||||
final CustomOpenSamlObject customSamlObject = (CustomOpenSamlObject) xmlObject;
|
||||
|
||||
for (XMLObject object : customSamlObject.getOrderedChildren()) {
|
||||
@ -195,15 +195,15 @@ public final class TestCustomOpenSaml5Objects {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processChildElement(@Nonnull XMLObject parentXMLObject, @Nonnull XMLObject childXMLObject)
|
||||
protected void processChildElement(@NonNull XMLObject parentXMLObject, @NonNull XMLObject childXMLObject)
|
||||
throws UnmarshallingException {
|
||||
final CustomOpenSamlObject customSamlObject = (CustomOpenSamlObject) parentXMLObject;
|
||||
customSamlObject.getUnknownXMLObjects().add(childXMLObject);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@NonNull
|
||||
@Override
|
||||
protected XMLObject buildXMLObject(@Nonnull Element domElement) {
|
||||
protected XMLObject buildXMLObject(@NonNull Element domElement) {
|
||||
return new CustomOpenSamlObjectImpl(SAMLConstants.SAML20_NS, AttributeValue.DEFAULT_ELEMENT_LOCAL_NAME,
|
||||
CustomOpenSamlObject.TYPE_CUSTOM_PREFIX);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user