Class OA2ClientUtils
- java.lang.Object
-
- org.oa4mp.server.loader.oauth2.servlet.OA2ClientUtils
-
public class OA2ClientUtils extends Object
A budding set of utilities for working with clients.Created by Jeff Gaynor
on 3/17/14 at 12:57 PM
-
-
Constructor Summary
Constructors Constructor Description OA2ClientUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
check(Client client, String redirect)
Note that all of the exceptions thrown here are because the callback cannot be verified, hence it is unclear where the error is to be sent.static LinkedList<String>
createCallbacks(List<String> rawCBs, List<String> dudUris)
This takes a list of callbacks and checks policies for each of them.static LinkedList<String>
createCallbacksForWebUI(OA2Client client, String rawCBs)
This is for use with the web interface.protected static boolean
isOnPrivateNetwork(String address)
protected static boolean
isPrivate(String host, String scheme)
static OA2Client
resolvePrototypes(OA2SE oa2SE, OA2Client baseClient)
static OA2Client
resolvePrototypes(ClientStore store, OA2Client baseClient)
static List<String>
scopesFromTemplates(List<String> scopes, OA2ServiceTransaction t)
static void
setupDriverPayloadConfig(AbstractPayloadConfig pc, OA2Client client)
Assumes that the configuration for the client is just a qdl script element or list of them.static void
setupHandlers(JWTRunner jwtRunner, OA2SE oa2SE, OA2ServiceTransaction transaction, OA2Client client, TXRecord idTX, TXRecord atTX, TXRecord rtTX, javax.servlet.http.HttpServletRequest req)
static void
setupHandlers(JWTRunner jwtRunner, OA2SE oa2SE, OA2ServiceTransaction transaction, OA2Client client, javax.servlet.http.HttpServletRequest req)
protected static int[]
toQuad(String address)
Used when resolving which network from its dotted quad address.
-
-
-
Method Detail
-
check
public static void check(Client client, String redirect)
Note that all of the exceptions thrown here are because the callback cannot be verified, hence it is unclear where the error is to be sent.- Parameters:
client
-redirect
-
-
createCallbacks
public static LinkedList<String> createCallbacks(List<String> rawCBs, List<String> dudUris) throws IOException
This takes a list of callbacks and checks policies for each of them. This does the actual work for checking- Parameters:
rawCBs
-dudUris
- -- this is a list of any URIs that are rejected. The caller may do with them what they will.- Returns:
- Throws:
IOException
-
createCallbacksForWebUI
public static LinkedList<String> createCallbacksForWebUI(OA2Client client, String rawCBs) throws IOException
This is for use with the web interface. The string in this case is the contents of a textbox that has one callback per line. Each callback is processed.- Parameters:
client
-rawCBs
-- Returns:
- Throws:
IOException
-
toQuad
protected static int[] toQuad(String address)
Used when resolving which network from its dotted quad address.- Parameters:
address
-- Returns:
-
isOnPrivateNetwork
protected static boolean isOnPrivateNetwork(String address)
-
setupHandlers
public static void setupHandlers(JWTRunner jwtRunner, OA2SE oa2SE, OA2ServiceTransaction transaction, OA2Client client, javax.servlet.http.HttpServletRequest req) throws Throwable
- Throws:
Throwable
-
setupHandlers
public static void setupHandlers(JWTRunner jwtRunner, OA2SE oa2SE, OA2ServiceTransaction transaction, OA2Client client, TXRecord idTX, TXRecord atTX, TXRecord rtTX, javax.servlet.http.HttpServletRequest req) throws Throwable
- Throws:
Throwable
-
scopesFromTemplates
public static List<String> scopesFromTemplates(List<String> scopes, OA2ServiceTransaction t)
-
resolvePrototypes
public static OA2Client resolvePrototypes(ClientStore store, OA2Client baseClient)
-
setupDriverPayloadConfig
public static void setupDriverPayloadConfig(AbstractPayloadConfig pc, OA2Client client)
Assumes that the configuration for the client is just a qdl script element or list of them.- Parameters:
pc
-client
-
-
-