{"record":{"id":"2edab0b580c834bc","repo":"quarkusio/quarkus","slug":"you-must-override-this-method-or-identityprovider-2edab0","errorCode":null,"errorMessage":"You must override this method or IdentityProvider.authenticate","messagePattern":"You must override this method or IdentityProvider\\.authenticate","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaIdentityProvider.java","lineNumber":39,"sourceCode":"    @Override\n    default Uni<SecurityIdentity> authenticate(LambdaAuthenticationRequest request, AuthenticationRequestContext context) {\n        AwsProxyRequest event = request.getEvent();\n        SecurityIdentity identity = authenticate(event);\n        if (identity == null) {\n            return Uni.createFrom().optional(Optional.empty());\n        }\n        return Uni.createFrom().item(identity);\n    }\n\n    /**\n     * You must override this method unless you directly override\n     * IdentityProvider.authenticate\n     *\n     * @param event\n     * @return\n     */\n    default SecurityIdentity authenticate(AwsProxyRequest event) {\n        throw new IllegalStateException(\"You must override this method or IdentityProvider.authenticate\");\n    }\n}\n","sourceCodeStart":21,"sourceCodeEnd":42,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaIdentityProvider.java#L21-L42","documentation":"Same contract as the lambda-http variant but for the lambda-rest extension: LambdaIdentityProvider.authenticate(AwsProxyRequest) is a default method that must be overridden when the provider is used, otherwise IllegalStateException is thrown during authentication.","triggerScenarios":"Registering a LambdaIdentityProvider for REST (AwsProxyRequest) API Gateway events without overriding authenticate(event); an authenticated request then hits the default method.","commonSituations":"Copy-pasting an identity provider between lambda-http and lambda-rest extensions and keeping the wrong event type signature; implementing the interface without custom authentication logic.","solutions":["Override SecurityIdentity authenticate(AwsProxyRequest event) in your provider bean","Remove the provider bean if custom authentication is not needed","Ensure the event-type signature matches the extension (AwsProxyRequest for rest, APIGatewayV2HTTPEvent for http)"],"exampleFix":"// before\npublic class MyIdentityProvider implements LambdaIdentityProvider {}\n// after\npublic class MyIdentityProvider implements LambdaIdentityProvider {\n    @Override\n    public SecurityIdentity authenticate(AwsProxyRequest event) {\n        return SecurityIdentity.builder().build();\n    }\n}","handlingStrategy":"validation","validationCode":"LambdaIdentityProvider p = ...;\nif (p.getClass().getMethod(\"authenticate\", AwsProxyRequest.class)\n        .getDeclaringClass() == LambdaIdentityProvider.class) {\n    throw new IllegalStateException(\"Override authenticate(AwsProxyRequest)\");\n}","typeGuard":"boolean overridesAuthenticate(LambdaIdentityProvider p) {\n    try {\n        return p.getClass().getMethod(\"authenticate\", AwsProxyRequest.class)\n                .getDeclaringClass() != LambdaIdentityProvider.class;\n    } catch (NoSuchMethodException e) { return false; }\n}","tryCatchPattern":"try { identity = provider.authenticate(event); } catch (IllegalStateException e) { return anonymousIdentity(); }","preventionTips":["Use AwsProxyRequest-typed providers only with the lambda-rest extension","Always implement authenticate(event) in your provider","Unit-test providers with a sample AwsProxyRequest before deployment"],"tags":["security","authentication","amazon-lambda-rest"],"backgroundTag":"unimplemented-method","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}