Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
titleVersion status: 0.4.3 .0 beta

Check out the federatedaccounts demo

0.4.x introduced a generic Oauth module integration with pac4j

0.3.0 refactored core module for more additional library support & rolling tokens module

0.2.0 introduced the rolling tokens module

0.1.0 introduced a new, modularized architecture with facebook and twitter modules

0.0.x versions will not be maintained, please upgrade. 0.1.x is mostly (some component were renamed) backwards compatible unless you've made customizations. There's no need to explicitly contribute the realms anymore, just add the desired modules to the classpath.

...

Code Block
        // dependencies in your pom.xml - use what you need, don't need all of these
        <dependency>
            <groupId>org.tynamo.security</groupId>
            <artifactId>tynamo-federatedaccounts-facebook</artifactId>
            <version>0.34.1<3</version>
        </dependency>
        <dependency>
            <groupId>org.tynamo.security</groupId>
            <artifactId>tynamo-federatedaccounts-twitter</artifactId>
            <version>0.34.1<3</version>
        </dependency>
        <dependency>
            <groupId>org.tynamo.security</groupId>
            <artifactId>tynamo-federatedaccounts-pac4jbasedoauth</artifactId>
            <version>0.4.3</version>
        </dependency>
		// Rolling tokens is a (semi-)secure remember me authentication based on one-time authentication tokens
        <dependency>
            <groupId>org.tynamo.security</groupId>
            <artifactId>tynamo-federatedaccounts-rollingtokens</artifactId>
            <version>0.4.3</version>
        </dependency>		

 // in your AppModule.java
	public static void bind(ServiceBinder binder) {
		binder.bind(FederatedAccountService.class, DefaultHibernateFederatedAccountServiceImpl.class);
		// Or for JPA implementation
		// binder.bind(FederatedAccountService.class, DefaultJpaFederatedAccountServiceImpl.class);
	}

	public static void contributeFederatedAccountService(MappedConfiguration<String, Object> configuration) {
		configuration.add("*", User.class);
		configuration.add("facebook.id", "facebookId");
		configuration.add("twitter.id", "twitterId");
	}

    public static void contributeApplicationDefaults(MappedConfiguration<String, String> configuration) {
	// these are the defaults, change as needed
	// configuration.add(FederatedAccountSymbols.COMMITAFTER_OAUTH, "true");
	// configuration.add(FederatedAccountSymbols.HTTPCLIENT_ON_GAE, "false");
        	// configuration.add(FederatedAccountSymbols.SUCCESSURL, ""); // empty string implies host name only

	// set your oauth app credentials
	configuration.add(FacebookRealm.FACEBOOK_CLIENTID, "<your oauth client id>");
	configuration.add(FacebookRealm.FACEBOOK_CLIENTSECRET, "<your oauth client secret>");
	configuration.add(TwitterRealm.TWITTER_CLIENTID, "<your oauth client id>");
	configuration.add(TwitterRealm.TWITTER_CLIENTSECRET, "<your oauth client secret>");
    }

...

Code Block
    // dependencies in your pom.xml 
    <dependency>
     <groupId>org.tynamo.security</groupId>
     <artifactId>tynamo-federatedaccounts-rollingtokens</artifactId>
     <version>0.34.1<3</version>
    </dependency>

    @Contribute(FederatedAccountService.class)
	public static void contributeFederatedAccountService(MappedConfiguration<String, Object> configuration) {
        configuration.add("rollingtokens", UserAccount.class);
        configuration.add("rollingtokens" + FederatedAccountService.IDPROPERTY, "id");
	}

	// Need to tell principal type to rolling tokens so it can be persisted properly with the ExpiringRollingToken
    public static void contributeApplicationDefaults(MappedConfiguration<String, String> configuration) {
        configuration.add(RollingTokenSymbols.CONFIGURED_PRINCIPALTYPE, Long.class.getName());
    }

	// rollingtokens is currently JPA only
    @Contribute(JpaEntityPackageManager.class)
    public static void addPackagesToScan(Configuration<String> configuration) {
        configuration.add(ExpiringRollingToken.class.getPackage().getName());
    } 

...