use of no.nav.vedtak.exception.TekniskException in project fp-felles by navikt.
the class SpøkelseKlient method hentGrunnlag.
@Override
public List<SykepengeVedtak> hentGrunnlag(String fnr) {
try {
var request = new URIBuilder(uri).addParameter("fodselsnummer", fnr).build();
var grunnlag = restClient.get(request, SykepengeVedtak[].class);
return Arrays.asList(grunnlag);
} catch (Exception e) {
LOG.info("SPokelse felles: feil ved oppslag mot {}, returnerer ingen grunnlag", uriString, e);
throw new TekniskException("FP-180126", String.format("SPokelse %s gir feil, ta opp med team sykepenger.", uriString), e);
}
}
use of no.nav.vedtak.exception.TekniskException in project fp-felles by navikt.
the class SAMLTokenSignedInInterceptor method handleMessage.
@Override
public void handleMessage(SoapMessage msg) {
super.handleMessage(msg);
SecurityContext securityContext = msg.get(SecurityContext.class);
SAMLTokenPrincipal samlTokenPrincipal = (SAMLTokenPrincipal) securityContext.getUserPrincipal();
Assertion assertion = samlTokenPrincipal.getToken().getSaml2();
try {
String result = getSamlAssertionAsString(assertion);
LoginContext loginContext = createLoginContext(loginContextConfiguration, result);
loginContext.login();
msg.getInterceptorChain().add(new SAMLLogoutInterceptor(loginContext));
MDCOperations.putUserId(SubjectHandler.getSubjectHandler().getUid());
MDCOperations.putConsumerId(SubjectHandler.getSubjectHandler().getConsumerId());
} catch (LoginException | TransformerException e) {
throw new TekniskException("F-499051", "Noe gikk galt ved innlogging", e);
}
}
use of no.nav.vedtak.exception.TekniskException in project fp-felles by navikt.
the class XmlUtils method createUnmodifiableMap.
public static Map<String, Map.Entry<Class<?>, Schema>> createUnmodifiableMap(String jaxbClassName, List<String> namespaces, List<String> xsdLocations) {
if (namespaces.size() != xsdLocations.size()) {
throw new IllegalArgumentException();
}
Map<String, Map.Entry<Class<?>, Schema>> tempMap;
try {
final Class<?> jaxbClass = Class.forName(jaxbClassName);
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
tempMap = new HashMap<>();
for (int i = 0; i < namespaces.size(); i++) {
var schema = schemaFactory.newSchema(new StreamSource(XmlUtils.class.getClassLoader().getResource(xsdLocations.get(i)).toExternalForm()));
tempMap.put(namespaces.get(i), new SimpleEntry<>(jaxbClass, schema));
}
} catch (SAXException e) {
throw new TekniskException("F-350888", "Feilet på instansiering av schema for xsd-validering.", e);
} catch (ClassNotFoundException e) {
throw new TekniskException("F-991095", String.format("Fant ikke jaxb-class '%s'", jaxbClassName), e);
}
return Collections.unmodifiableMap(tempMap);
}
use of no.nav.vedtak.exception.TekniskException in project fp-felles by navikt.
the class AbstractOidcRestClient method put.
protected String put(URI endpoint, Object dto, Set<Header> headers, ResponseHandler<String> responseHandler) {
HttpPut put = new HttpPut(endpoint);
String json = toJson(dto);
put.setEntity(new StringEntity(json, UTF_8));
headers.forEach(put::addHeader);
try {
return this.execute(put, responseHandler);
} catch (IOException e) {
throw new TekniskException("F-432937", String.format("Kunne ikke PUT mot %s", endpoint), e);
}
}
use of no.nav.vedtak.exception.TekniskException in project fp-felles by navikt.
the class LdapInnlogging method lagLdapContext.
public static LdapContext lagLdapContext() {
String authMode = ENV.getProperty("ldap.auth", "simple");
String url = getRequiredProperty("ldap.url");
// NOSONAR //metodeparameter krever Hashtable
Hashtable<String, Object> environment = new Hashtable<>();
environment.put(Context.INITIAL_CONTEXT_FACTORY, ENV.getProperty("ldap.ctxfactory", "com.sun.jndi.ldap.LdapCtxFactory"));
environment.put(Context.PROVIDER_URL, url);
environment.put(Context.SECURITY_AUTHENTICATION, authMode);
if ("simple".equals(authMode)) {
String user = getRequiredProperty("ldap.username") + "@" + getRequiredProperty("ldap.domain");
environment.put(Context.SECURITY_CREDENTIALS, getRequiredProperty("ldap.password"));
environment.put(Context.SECURITY_PRINCIPAL, user);
} else if ("none".equals(authMode)) {
// do nothing
} else {
// støtter ikke [java.naming.security.authentication]="strong" eller andre.
// Ignorerer også foreløpig.
}
try {
return new InitialLdapContext(environment, null);
} catch (NamingException e) {
throw new TekniskException("F-222862", String.format("Klarte ikke koble til LDAP på URL %s", url));
}
}
Aggregations