You may want to check your project dependencies to make sure you have the
osgi annotations artifacts that correspond to the r6 or later versions of
the OSGi specifications. The earlier versions of the specification stated
that the @Reference annotation was only allowed on the bind method, so a
field wasn't allowed back then.
For example, I generally have these in the pom.xml:
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.annotation</artifactId>
<version>6.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.component.annotations</artifactId>
<version>1.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.metatype.annotations</artifactId>
<version>1.3.0</version>
<scope>provided</scope>
</dependency>
Regards,
-Eric
On Tue, Jul 24, 2018 at 11:52 AM, Hasini Witharana <[email protected]>
wrote:
> Hi all,
>
> I am trying to get the service Authenticator in
> "org.apache.sling.api.auth.Authenticator" inside a service class using "
> org.osgi.service.component.annotations.Reference" annotation.
>
> But I am getting an error saying @Reference not applicable to field. How to
> solve this?
>
> Thank You.
>
> On Mon, Jul 23, 2018 at 6:42 PM, Robert Munteanu <[email protected]>
> wrote:
>
> > Hi Hasini,
> >
> > On Sun, 2018-07-22 at 23:20 +0530, Hasini Witharana wrote:
> > > Hi all,
> > >
> > > I have implemented a login with Google for Apache Sling. After user
> > > is
> > > successfully logged in using Google, a new user is created with email
> > > address and a UUID as a password in user store.
> > >
> > > I want to redirect this user to the
> > > http://localhost:8080/starter/index.html
> > > and the user should be logged in. Are there any documentations or
> > > examples
> > > for this implementation?
> >
> > The code from o.a.s.auth.core's LoginServlet should point you in the
> > right direction.
> >
> >
> > https://github.com/apache/sling-org-apache-sling-auth-
> > core/blob/master/src/main/java/org/apache/sling/auth/
> > core/impl/LoginServlet.java
> >
> >
> > Hope this helps,
> >
> > Robert
> >
> >
>
>
> --
> *Hasini Witharana*
> Undergraduate | Department of Computer Science and Engineering
> University of Moratuwa
> Linkedin <https://www.linkedin.com/in/hasini-witharana-185785109/>
>