protected GuestMethodInterceptor guestInterceptor(Provider<SubjectProvider> subjectProviderProvider, Provider<AnnotationResolver> annotationResolverProvider) { return new GuestMethodInterceptor(subjectProviderProvider, annotationResolverProvider); }
/** * Ensures that the calling <code>Subject</code> is NOT a <em>user</em>, that is, they do not * have an {@link org.apache.shiro.subject.Subject#getPrincipal() identity} before continuing. If they are * a user ({@link org.apache.shiro.subject.Subject#getPrincipal() Subject.getPrincipal()} != null), {@link #exception()} is called, indicating that * execution is not allowed to continue. * * @param a * the annotation to check for one or more roles */ public void assertAuthorized(RequiresGuest a) throws AuthorizationException { if (getSubject().getPrincipal() != null) { throw new NotAGuestException(); } } }
/** * Ensures that the calling <code>Subject</code> is NOT a <em>user</em>, that is, they do not * have an {@link org.apache.shiro.subject.Subject#getPrincipal() identity} before continuing. If they are * a user ({@link org.apache.shiro.subject.Subject#getPrincipal() Subject.getPrincipal()} != null), {@link #exception()} is called, indicating that * execution is not allowed to continue. * * @param a * the annotation to check for one or more roles */ public void assertAuthorized(RequiresGuest a) throws AuthorizationException { if (getSubject().getPrincipal() != null) { throw new NotAGuestException(); } } }
protected GuestMethodInterceptor guestInterceptor(Provider<SubjectProvider> subjectProviderProvider, Provider<AnnotationResolver> annotationResolverProvider) { return new GuestMethodInterceptor(subjectProviderProvider, annotationResolverProvider); }