/** * @return the set of all service's names present in the application */ public static Set<String> getSocialRelated() { return getServicesToQualifier().keySet(); }
/** * * @param clazz provider qualifier class for which we're looking service name * @return the service name */ public static String getServiceFromClass(Class<? extends Annotation> clazz) { return getQualifierToService().get(getClassToQualifierQualifier().get(clazz)); }
public List<String> getListOfServices() { return AgoravaContext.getListOfServices(); }
@Produces @PicketLink @RequestScoped public Authenticator authenticatorProducer() { Annotation qualifier; if (session != OAuthSession.NULL) { qualifier = session.getServiceQualifier(); } else if (AgoravaContext.getListOfServices().contains(provider)) { qualifier = AgoravaContext.getServicesToQualifier().get(provider); } else { throw new AgoravaException("Current OAuthSession is NULL and Request doesn't contain " + AgoravaConstants .PROVIDER_PARAM + " parameter"); } if (qualifier == null) { throw new AgoravaException("No qualifier found for the following provider " + provider); } return authenticators.select(qualifier).get(); } }
/** * @return the name of the service */ public String getServiceName() { return AgoravaContext.getQualifierToService().get(getServiceQualifier()); }
@Override public String startDanceFor(Class<? extends Annotation> providerClass) { Annotation qualifier = getClassToQualifierQualifier().get(providerClass); if (qualifier == null) { throw new AgoravaException("Cannot find configured service provider with class : " + providerClass); } return startDanceFor(qualifier); }
/** * @return the list of all service's names present in the application */ public static List<String> getListOfServices() { if (listOfServices == null) listOfServices = new ArrayList<String>(getSocialRelated()); return listOfServices; }
public String getProviderName() { return AgoravaContext.getServiceFromClass(profile.getQualifier()); }
protected void renderResponse(HttpServletRequest req, HttpServletResponse resp) { String internalCallBack = (String) lifeCycleService.getCurrentSession().getExtraData().get(AgoravaConstants .INTERN_CALLBACK_PARAM); if (internalCallBack == null) internalCallBack = AgoravaContext.getInternalCallBack(); try { if (internalCallBack.startsWith("/")) internalCallBack = req.getContextPath() + internalCallBack; internalCallBack = resp.encodeRedirectURL(internalCallBack + "?" + req.getQueryString()); resp.sendRedirect(internalCallBack); } catch (IOException e) { throw new AgoravaException(e); } }
/** * Set the provider qualifier for the session * * @param qualifier with {@link org.agorava.api.atinject.ProviderRelated} meta-annotation * @return this builder * @throws ProviderMismatchException if parameter is null or if no provider exists for this qualifier */ public Builder qualifier(Annotation qualifier) throws ProviderMismatchException { this.qualifier = qualifier; if (qualifier != null && AgoravaContext.getQualifierToService().containsKey(qualifier)) return this; else throw new ProviderMismatchException("No provider found for qualifier : " + qualifier); }
/** * Set the provider qualifier for the session from the provider name * * @param providerName linked to a {@link org.agorava.api.atinject.ProviderRelated} qualifier * @return this builder * @throws ProviderMismatchException if parameter is null or if no provider exists for this name */ public Builder providerName(String providerName) throws ProviderMismatchException { qualifier = AgoravaContext.getServicesToQualifier().get(providerName); if (qualifier == null) throw new ProviderMismatchException("No provider found with name : " + providerName); return this; }
@Override public OAuthAppSettings produce(CreationalContext<OAuthAppSettings> ctx) { builder.name(getQualifierToService().get(qual)); OAuthAppSettings newSettings = builder.build(); ctx.push(newSettings); return newSettings; }
@Override public OAuthSession buildSessionFor(String providerName) { OAuthSession res; Annotation qualifier = getServicesToQualifier().get(providerName); if (qualifier == null) { throw new AgoravaException("Cannot find configured service provider with name : " + providerName); } return buildSessionFor(qualifier); }
@Override public OAuthAppSettings produce(CreationalContext<OAuthAppSettings> ctx) { OAuthAppSettings settings = oldProducer.produce(ctx); OAuthAppSettings newSettings = new SimpleOAuthAppSettingsBuilder().readFromSettings(settings). qualifier(qual). name(AgoravaContext.getQualifierToService().get(qual)).build(); ctx.push(newSettings); return newSettings; }